use curl -# instead of wget since wget shows ugly things

This commit is contained in:
Ohio2 2021-07-16 22:19:27 +02:00
parent 357ffbc80a
commit e0b1b8a8b6
43 changed files with 180 additions and 42 deletions

138
aps Normal file
View file

@ -0,0 +1,138 @@
#!/bin/sh
temp_location="/tmp"
install_root="/tmp/alroot"
installed_pkg_database="${install_root}/var/aps/installed"
locpkg_database="${install_root}/var/aps/repos"
lock="${install_root}/var/aps/lock"
official="https://git.hippoz.xyz/alnux/repo"
[ ! -d "${installed_pkg_database}" ] && mkdir -p "${installed_pkg_database}"
die() {
echo "${1}"
rm "${lock}"
exit 2
}
run_package_script() { # --- $2 is the package path, and $1 is the script to run
{
if [ -x "${2}/${1}" ]; then
echo ":: Running ${1}"
cd "${2}" || die "Could not enter package working directory. Exiting..."
"${2}/${1}" "${2}/payload" "${2}"
fi
}
}
install_local_package() {
[ ! -e "${1}" ] && die "[E] File ${1} does not exist. Exiting..."
# Extract the package
echo "[*] Copying package ${1} into temporary location ${temp_location}..."
cp -prv "${1}" "${temp_location}"
pkg_name="${1%/}"
pkg_name="${pkg_name##*/}"
pkg_name=$(echo "${pkg_name}" | cut -f 1 -d '.')
pkg_path="${temp_location}/${pkg_name}"
cd "${pkg_path}" || die "Could not enter package path."
# Set default values for package
pkg_config_deploy=true
pkg_config_ver="0"
pkg_config_makedepends=""
pkg_config_depends=""
# Install package
. "${pkg_path}/package"
run_package_script "build" "${pkg_path}"
run_package_script "predeploy" "${pkg_path}"
# Deploy package
if [ "${pkg_config_deploy}" = true ]; then
echo ":: Deploying target ${pkg_name}..."
cp -rpv "${pkg_path}/payload"/* "${install_root}" > "${temp_location}/${pkg_name}-payloaddeploylog"
sed 's/^.*-> //' "${temp_location}/${pkg_name}-payloaddeploylog" | tr -d \'\" > "${temp_location}/${pkg_name}-payloadfiles"
rm "${temp_location}/${pkg_name}-payloaddeploylog"
fi
run_package_script "postdeploy" "${pkg_path}"
echo "[*] Install complete for target ${pkg_name}"
# Add package to database
if [ -x "${pkg_path}/package" ]; then
echo ":: Adding target ${pkg_name} to installed package database..."
[ ! -d "${installed_pkg_database}/${pkg_name}" ] && mkdir "${installed_pkg_database}/${pkg_name}"
cp -pv "${pkg_path}/package" "${installed_pkg_database}/${pkg_name}/package"
[ -e "${temp_location}/${pkg_name}-payloadfiles" ] && cp -pv "${temp_location}/${pkg_name}-payloadfiles" "${installed_pkg_database}/${pkg_name}/payloadfiles"
else
die "[E] Target ${pkg_name} does not have a package script (it's an invalid package!). Exiting..."
fi
# Cleanup
echo "[*] Cleaning up after target ${pkg_name}..."
rm -r "${pkg_path}"
rm "${temp_location}/${pkg_name}-payloadfiles"
cd "${install_root}" || die "Could not return to main directory. Exiting..."
unset pkg_path
unset pkg_name
unset pkg_config_deploy
unset pkg_config_ver
unset pkg_config_makedepends
unset pkg_config_depends
}
remove_local_package() {
pkg_path="${installed_pkg_database}/${1}"
[ ! -d "${pkg_path}" ] && die "Package could not be found in local installed package database. Exiting..."
payloadfiles_path="${pkg_path}/payloadfiles"
[ ! -e "${payloadfiles_path}" ] && die "[E] Package ${1} does not have a payloadfiles file. Exiting..."
echo ":: Removing target ${1}..."
rm -rv "$(cat ${payloadfiles_path})"
rm -rv "${pkg_path}"
echo "[*] Removal complete for target ${pkg_name}"
}
sync_local_repo_database() {
echo ":: Syncing local database for repo ${1}..."
if [ ! -d "${locpkg_database}/${1}" ]; then
echo ":: Local database for repo ${1} does not exist, cloning..."
git clone "${2}" "${locpkg_database}/${1}"
else
echo ":: Local database for repo ${1} exists, updating..."
cd "${locpkg_database}/${1}" || die "Could not enter local database. Exiting..."
git pull
fi
}
install_package_from_repo() { # NOTE(hippoz): This can get a tad confusing... ${1} is the repo and ${2} is the package
echo ":: Installing package ${2} from ${1} repo"
[ ! -d "${locpkg_database}/${1}/${2}" ] && die "[E] Target not found."
install_local_package "${locpkg_database}/${1}/${2}"
}
upgrade() {
echo ":: Upgrading installed packages..."
unset_config_values
cd "${installed_pkg_database}" || die "Could not enter installed package database. Exiting..."
for pkg in */; do
installed_pkg_path="${installed_pkg_database}/${pkg}"
. "${installed_pkg_path}/package"
pkg_name="${installed_pkg_path%/}"
pkg_name="${pkg_name##*/}"
already_installed_version=${pkg_config_ver}
[ ! -d "${locpkg_database}/${1}/${pkg_name}" ] && die "[E] Package ${pkg_name} was not found in ${1}, exiting..."
. "${locpkg_database}/${1}/${pkg_name}/package"
if [ ! "${already_installed_version}" = "${pkg_config_ver}" ]; then
echo ":: Package ${pkg_name} is out of date, updating..."
install_package_from_repo "${1}" "${pkg_name}"
fi
unset pkg_config_deploy
unset pkg_config_ver
unset pkg_config_makedepends
unset pkg_config_depends
done
}
main() {
if [ -f "${lock}" ]; then
echo "[E] A lock file already exists. If you're sure no package manager is running, remove the file ${lock}."
exit 1
fi
touch "${lock}"
case ${1} in
install) install_local_package "${2}" ;;
remove) remove_local_package "${2}" ;;
sync)
sync_local_repo_database "official" ${official}
[ -z "${2}" ] && die "[*] No targets specified."
install_package_from_repo "official" "${2}" ;;
upgrade) upgrade "official" ;;
*) die "[E] Invalid option ${1}, exiting..." ;;
esac
rm "${lock}"
}
main "${1}" "${2}"

View file

@ -1,4 +1,4 @@
wget https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.xz curl -# https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.xz
tar -xf autoconf-2.71.tar.xz tar -xf autoconf-2.71.tar.xz
cd autoconf-2.71 cd autoconf-2.71

View file

@ -1,4 +1,4 @@
wget https://ftp.gnu.org/gnu/automake/automake-1.16.3.tar.xz curl -# https://ftp.gnu.org/gnu/automake/automake-1.16.3.tar.xz
tar -xf automake-1.16.3.tar.xz tar -xf automake-1.16.3.tar.xz
cd automake-1.16.3 cd automake-1.16.3

View file

@ -1,4 +1,4 @@
wget https://ftp.gnu.org/gnu/bash/bash-5.1.8.tar.gz curl -# https://ftp.gnu.org/gnu/bash/bash-5.1.8.tar.gz
tar -xf bash-5.1.8.tar.gz tar -xf bash-5.1.8.tar.gz
cd bash-5.1.8 cd bash-5.1.8

View file

@ -1,4 +1,4 @@
wget -O binutils-2.36.1.tar.xz https://ftp.gnu.org/gnu/binutils/binutils-2.36.1.tar.xz curl -# -O binutils-2.36.1.tar.xz https://ftp.gnu.org/gnu/binutils/binutils-2.36.1.tar.xz
tar -xf binutils-2.36.1.tar.xz tar -xf binutils-2.36.1.tar.xz
cd binutils-2.36.1 cd binutils-2.36.1

View file

@ -1,4 +1,4 @@
wget https://ftp.gnu.org/gnu/bison/bison-3.7.6.tar.xz curl -# https://ftp.gnu.org/gnu/bison/bison-3.7.6.tar.xz
tar -xf bison-3.7.6.tar.xz tar -xf bison-3.7.6.tar.xz
cd bison-3.7.6 cd bison-3.7.6

View file

@ -1,4 +1,4 @@
wget -O busybox-1.33.1.tar.bz2 https://busybox.net/downloads/busybox-1.33.1.tar.bz2 curl -# -O busybox-1.33.1.tar.bz2 https://busybox.net/downloads/busybox-1.33.1.tar.bz2
tar -xf busybox-1.33.1.tar.bz2 tar -xf busybox-1.33.1.tar.bz2
cd busybox-1.33.1 cd busybox-1.33.1

View file

@ -1,4 +1,4 @@
wget -O bzip2-1.0.8.tar.gz https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz curl -# -O bzip2-1.0.8.tar.gz https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz
tar -xf bzip2-1.0.8.tar.gz tar -xf bzip2-1.0.8.tar.gz
cd bzip2-1.0.8 cd bzip2-1.0.8

View file

@ -1,4 +1,4 @@
wget https://github.com/Kitware/CMake/releases/download/v3.21.0-rc2/cmake-3.21.0-rc2.tar.gz curl -# https://github.com/Kitware/CMake/releases/download/v3.21.0-rc2/cmake-3.21.0-rc2.tar.gz
tar -xf cmake-3.21.0-rc2.tar.gz tar -xf cmake-3.21.0-rc2.tar.gz
cd cmake-3.21.0-rc2.tar.gz cd cmake-3.21.0-rc2.tar.gz

View file

@ -1,4 +1,4 @@
wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.2.tar.gz curl -# https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.2.tar.gz
tar -xf ncurses-6.2.tar.gz tar -xf ncurses-6.2.tar.gz
cd ncurses-6.2 cd ncurses-6.2

View file

@ -1,4 +1,4 @@
wget http://downloads.sourceforge.net/expat/expat-2.1.0.tar.gz curl -# http://downloads.sourceforge.net/expat/expat-2.1.0.tar.gz
tar -xf expat-2.1.0.tar.gz tar -xf expat-2.1.0.tar.gz
cd expat-2.1.0 cd expat-2.1.0

View file

@ -1,4 +1,4 @@
wget https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz curl -# https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz
tar -xf flex-2.6.4.tar.gz tar -xf flex-2.6.4.tar.gz
cd flex-2.6.4 cd flex-2.6.4

View file

@ -1,4 +1,4 @@
wget https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.13.1.tar.bz2 curl -# https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.13.1.tar.bz2
tar -xf fontconfig-2.13.1.tar.bz2 tar -xf fontconfig-2.13.1.tar.bz2
cd fontconfig-2.13.1 cd fontconfig-2.13.1

View file

@ -1,4 +1,4 @@
wget https://downloads.sourceforge.net/freetype/freetype-2.10.4.tar.xz curl -# https://downloads.sourceforge.net/freetype/freetype-2.10.4.tar.xz
tar -xf freetype-2.10.4.tar.xz tar -xf freetype-2.10.4.tar.xz
cd freetype-2.10.4 cd freetype-2.10.4

View file

@ -1,4 +1,4 @@
wget -O gcc-11.1.0.tar.gz https://gcc.gnu.org/pub/gcc/releases/gcc-11.1.0/gcc-11.1.0.tar.xz curl -# -O gcc-11.1.0.tar.gz https://gcc.gnu.org/pub/gcc/releases/gcc-11.1.0/gcc-11.1.0.tar.xz
tar -xf gcc-11.1.0.tar.gz tar -xf gcc-11.1.0.tar.gz
cd gcc-11.1.0 cd gcc-11.1.0

View file

@ -1,4 +1,4 @@
wget https://ftp.gnu.org/pub/gnu/gettext/gettext-0.21.tar.gz curl -# https://ftp.gnu.org/pub/gnu/gettext/gettext-0.21.tar.gz
tar -xf gettext-0.21.tar.gz tar -xf gettext-0.21.tar.gz
cd gettext-0.21 cd gettext-0.21

View file

@ -1,4 +1,4 @@
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.xz curl -# https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.xz
tar -xf git-2.9.5.tar.xz tar -xf git-2.9.5.tar.xz
cd git-2.9.5 cd git-2.9.5

View file

@ -1,4 +1,4 @@
wget https://ftp.gnu.org/gnu/libc/glibc-2.33.tar.gz curl -# https://ftp.gnu.org/gnu/libc/glibc-2.33.tar.gz
tar -xf glibc-2.33.tar.gz tar -xf glibc-2.33.tar.gz
cd glibc-2.33 cd glibc-2.33

View file

@ -1,4 +1,4 @@
wget http://ftp.gnu.org/pub/gnu/gperf/gperf-3.1.tar.gz curl -# http://ftp.gnu.org/pub/gnu/gperf/gperf-3.1.tar.gz
tar -xf gperf-3.1.tar.gz tar -xf gperf-3.1.tar.gz
cd gperf-3.1 cd gperf-3.1

View file

@ -1,4 +1,4 @@
wget https://ftp.gnu.org/gnu/grub/grub-2.06.tar.xz curl -# https://ftp.gnu.org/gnu/grub/grub-2.06.tar.xz
tar -xf grub-2.06.tar.xz tar -xf grub-2.06.tar.xz
cd grub-2.06 cd grub-2.06

View file

@ -1,4 +1,4 @@
wget https://mirrors.nav.ro/gnu/gzip/gzip-1.10.tar.gz curl -# https://mirrors.nav.ro/gnu/gzip/gzip-1.10.tar.gz
tar -xf gzip-1.10.tar.gz tar -xf gzip-1.10.tar.gz
cd gzip-1.10 cd gzip-1.10

View file

@ -1,4 +1,4 @@
wget https://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz curl -# https://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz
tar -xf intltool-0.51.0.tar.gz tar -xf intltool-0.51.0.tar.gz
cd intltool-0.51.0 cd intltool-0.51.0

View file

@ -1,4 +1,4 @@
wget https://dri.freedesktop.org/libdrm/libdrm-2.4.104.tar.xz curl -# https://dri.freedesktop.org/libdrm/libdrm-2.4.104.tar.xz
tar -xf libdrm-2.4.104.tar.xz tar -xf libdrm-2.4.104.tar.xz
cd libdrm-2.4.104 cd libdrm-2.4.104

View file

@ -1,4 +1,4 @@
wget https://github.com/glennrp/libpng/archive/v1.6.37.tar.gz curl -# https://github.com/glennrp/libpng/archive/v1.6.37.tar.gz
tar -xf v1.6.37.tar.gz tar -xf v1.6.37.tar.gz
cd libpng-1.6.37 cd libpng-1.6.37

View file

@ -1,4 +1,4 @@
wget https://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.xz curl -# https://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.xz
tar -xf libtool-2.4.6.tar.xz tar -xf libtool-2.4.6.tar.xz
cd libtool-2.4.6 cd libtool-2.4.6

View file

@ -1,4 +1,4 @@
wget https://ftp.osuosl.org/pub/lfs/lfs-packages/8.2/udev-lfs-20171102.tar.bz2 udev.tar.bz2 curl -# https://ftp.osuosl.org/pub/lfs/lfs-packages/8.2/udev-lfs-20171102.tar.bz2 udev.tar.bz2
tar -xf udev.tar.bz2 udev tar -xf udev.tar.bz2 udev
cd udev cd udev

View file

@ -1,4 +1,4 @@
wget https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.xz curl -# https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.xz
tar -xf m4-1.4.19.tar.xz tar -xf m4-1.4.19.tar.xz
cd m4-1.4.19 cd m4-1.4.19

View file

@ -1,4 +1,4 @@
wget https://ftp.gnu.org/gnu/make/make-4.3.tar.gz curl -# https://ftp.gnu.org/gnu/make/make-4.3.tar.gz
tar -xf make-4.3.tar.gz tar -xf make-4.3.tar.gz
cd make-4.3 cd make-4.3

View file

@ -1,4 +1,4 @@
wget https://archive.mesa3d.org//mesa-21.2.0-rc1.tar.xz curl -# https://archive.mesa3d.org//mesa-21.2.0-rc1.tar.xz
tar -xf mesa-21.2.0-rc1.tar.xz tar -xf mesa-21.2.0-rc1.tar.xz
cd mesa-21.2.0-rc1 cd mesa-21.2.0-rc1

View file

@ -1,4 +1,4 @@
wget https://bitmath.org/code/mtdev/mtdev-1.1.6.tar.bz2 curl -# https://bitmath.org/code/mtdev/mtdev-1.1.6.tar.bz2
tar -xf mtdev-1.1.6.tar.bz2 tar -xf mtdev-1.1.6.tar.bz2
cd mtdev-1.1.6 cd mtdev-1.1.6

View file

@ -1,4 +1,4 @@
wget https://www.nano-editor.org/dist/v5/nano-5.8.tar.xz curl -# https://www.nano-editor.org/dist/v5/nano-5.8.tar.xz
tar -xf nano-5.8.tar.xz tar -xf nano-5.8.tar.xz
cd nano-5.8 cd nano-5.8

View file

@ -1,4 +1,4 @@
wget https://www.openssl.org/source/openssl-3.0.0-beta1.tar.gz curl -# https://www.openssl.org/source/openssl-3.0.0-beta1.tar.gz
tar -xf openssl-3.0.0-beta1.tar.gz tar -xf openssl-3.0.0-beta1.tar.gz
cd openssl-3.0.0-beta1 cd openssl-3.0.0-beta1
chmod +x ./config chmod +x ./config

View file

@ -1,4 +1,4 @@
wget https://www.cpan.org/src/5.0/perl-5.34.0.tar.gz curl -# https://www.cpan.org/src/5.0/perl-5.34.0.tar.gz
tar -xf perl-5.34.0.tar.gz tar -xf perl-5.34.0.tar.gz
cd perl-5.34.0 cd perl-5.34.0

View file

@ -1,4 +1,4 @@
wget https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz curl -# https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
tar -xf pkg-config-0.29.2.tar.gz tar -xf pkg-config-0.29.2.tar.gz
cd pkg-config-0.29.2 cd pkg-config-0.29.2

View file

@ -1,4 +1,4 @@
wget https://ftp.gnu.org/gnu/pth/pth-2.0.7.tar.gz curl -# https://ftp.gnu.org/gnu/pth/pth-2.0.7.tar.gz
tar -xf pth-2.0.7.tar.gz tar -xf pth-2.0.7.tar.gz
cd pth-2.0.7 cd pth-2.0.7

View file

@ -1,4 +1,4 @@
wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tar.xz curl -# https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tar.xz
tar -xf Python-3.9.6.tar.xz tar -xf Python-3.9.6.tar.xz
cd Python-3.9.6 cd Python-3.9.6

View file

@ -1,4 +1,4 @@
wget https://www.samba.org/ftp/talloc/talloc-2.3.3.tar.gz curl -# https://www.samba.org/ftp/talloc/talloc-2.3.3.tar.gz
tar -xf talloc-2.3.3.tar.gz tar -xf talloc-2.3.3.tar.gz
cd talloc-2.3.3 cd talloc-2.3.3

View file

@ -1,4 +1,4 @@
wget https://ftp.gnu.org/gnu/tar/tar-1.34.tar.xz curl -# https://ftp.gnu.org/gnu/tar/tar-1.34.tar.xz
tar -xf tar-1.34 tar -xf tar-1.34
cd tar-1.34 cd tar-1.34

View file

@ -1,4 +1,4 @@
wget https://anduin.linuxfromscratch.org/BLFS/vim/vim-8.2.2890.tar.gz curl -# https://anduin.linuxfromscratch.org/BLFS/vim/vim-8.2.2890.tar.gz
tar -xf vim-8.2.2890.tar.gz tar -xf vim-8.2.2890.tar.gz
cd vim-8.2.2890 cd vim-8.2.2890

View file

@ -1,4 +1,4 @@
wget https://tukaani.org/xz/xz-5.2.5.tar.gz curl -# https://tukaani.org/xz/xz-5.2.5.tar.gz
tar -xf xz-5.2.5.tar.gz tar -xf xz-5.2.5.tar.gz
cd xz-5.2.5 cd xz-5.2.5

View file

@ -1,4 +1,4 @@
wget https://zlib.net/zlib-1.2.11.tar.gz curl -# https://zlib.net/zlib-1.2.11.tar.gz
tar -xf zlib-1.2.11.tar.gz tar -xf zlib-1.2.11.tar.gz
cd zlib-1.2.11 cd zlib-1.2.11

View file

@ -1,4 +1,4 @@
wget https://www.zsh.org/pub/zsh-5.8.tar.xz curl -# https://www.zsh.org/pub/zsh-5.8.tar.xz
tar -xf zsh-5.8.tar.xz tar -xf zsh-5.8.tar.xz
cd zsh-5.8 cd zsh-5.8

View file

@ -1,4 +1,4 @@
wget https://github.com/facebook/zstd/releases/download/v1.5.0/zstd-1.5.0.tar.gz curl -# https://github.com/facebook/zstd/releases/download/v1.5.0/zstd-1.5.0.tar.gz
tar -xf zstd-1.5.0.tar.gz tar -xf zstd-1.5.0.tar.gz
cd zstd-1.5.0 cd zstd-1.5.0