Add altools/sel, altools/repo, install.sh & add config file support. #8

Merged
hippoz merged 11 commits from Ohio2/aps:master into master 2021-08-25 14:46:01 +03:00
5 changed files with 54 additions and 36 deletions
Showing only changes of commit 5bcb0d1607 - Show all commits

View file

@ -3,16 +3,16 @@
########################################
# Repo, a repository manager for alnux #
########################################
case $1 in
. /etc/al/config
case $1 in
# add a repo
add) git clone https://${3}/${2}.git /var/aps/repos/${2}
echo "${2}" >> /etc/al/repo.conf
add) git clone https://${3}/${2}.git ${install_root}/var/aps/repos/${2}
echo "${2}" >> ${install_root}/etc/al/repo.conf
;;
# update a repo
update) pushd && cd /var/aps/repos/${2} && git pull && popd ;;
update) pushd && cd ${install_root}/var/aps/repos/${2} && git pull && popd ;;
# destroy a repo (remove)
destroy) rm -rfv /var/aps/repos/${2}
sed -i "/^${2}/d" /etc/al/repo.conf
destroy) rm -rfv ${install_root}/var/aps/repos/${2}
sed -i "/^${2}/d" ${install_root}/etc/al/repo.conf
;;
esac
esac

View file

@ -3,31 +3,33 @@
#########################
# Alnux sel(ect) Script #
#########################
. "/etc/al/lnver.cfg"
. /etc/al/config
if [ -f "${install_root}/etc/al/lnver" ]; then
. /etc/al/lnver.cfg
fi
case $1 in
linux) if [ $(whoami) != root ]; then
case $2 in
linux) case $2 in
# Lists all kernels
list) ls /usr/src/ | grep 'linux' &&
ls -L /usr/src/linux 2>/dev/null
list) ls ${install_root}/usr/src/ | grep 'linux' &&
ls -L ${install_root}/usr/src/linux 2>/dev/null
;;
# Sets a kernel version
set) lnver=${3} > /etc/al/lnver.cfg
set) lnver=${3}
echo "lnver=${3}" > ${install_root}/etc/al/lnver.cfg
;;
# Links the set kernel version.
link) ln -sv /usr/src/linux-${lnver} /usr/src/linux &&
mkdir -pv /var/aps/packages/linux/ &&
echo "/boot/vmlinuz-linux-${lnver}" > /var/aps/packages/linux/payloadfiles &&
echo "/usr/src/${lnver}" >> /var/aps/packages/linux/payloadfiles &&
echo "pkg_config_deploy=true" > /var/aps/packages/linux/package &&
echo "pkg_config_ver='${lnver}'" >> /var/aps/packages/linux/package &&
echo "pkg_config_name='linux'" >> /var/aps/packages/linux/package &&
echo "pkg_config_makedepends=''" >> /var/aps/packages/linux/package &&
echo "pkg_config_depends=''" >> /var/aps/packages/linux/package
link) ln -sv ${install_root}/usr/src/linux-${lnver} ${install_root}/usr/src/linux &&
mkdir -pv ${install_root}/var/aps/packages/linux/ &&
echo "/boot/vmlinuz-linux-${lnver}" > ${install_root}/var/aps/packages/linux/payloadfiles &&
echo "/usr/src/${lnver}" >> ${install_root}/var/aps/packages/linux/payloadfiles &&
echo "pkg_config_deploy=true" > ${install_root}/var/aps/packages/linux/package &&
echo "pkg_config_ver='${lnver}'" >> ${install_root}/var/aps/packages/linux/package &&
echo "pkg_config_name='linux'" >> ${install_root}/var/aps/packages/linux/package &&
echo "pkg_config_makedepends=''" >> ${install_root}/var/aps/packages/linux/package &&
echo "pkg_config_depends=''" >> ${install_root}/var/aps/packages/linux/package
;;
# Destroys the symlink.
destroy) rm -rfv /usr/src/linux ;;
destroy) rm -rfv ${install_root}/usr/src/linux ;;
esac
fi
esac

16
aps
View file

@ -1,10 +1,14 @@
#!/bin/sh
temp_location="/var/tmp"
install_root="/var/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"
if [ -f "/etc/al/config" ]; then
. /etc/al/config
else
temp_location="/var/tmp"
install_root="/var/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"
fi
die() {
echo "aps: fatal: ${1}"
rm "${lock}"

11
config/config Executable file
View file

@ -0,0 +1,11 @@
##########################
# A config file for the #
# Alnux Packaging System #
##########################
temp_location="/var/tmp"
install_root="/var/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"

View file

@ -16,5 +16,6 @@ else
install -v aps ${prefix}/usr/bin/ &&
install -v altools/sel ${prefix}/usr/bin/ &&
install -v altools/repo ${prefix}/usr/bin/ &&
${prefix}/usr/bin/aps sync alnux
${prefix}/usr/bin/aps sync alnux &&
install -v config/config /etc/al
fi