add config

This commit is contained in:
Ohio2 2021-08-25 13:01:36 +02:00
parent b1ca212971
commit 5bcb0d1607
5 changed files with 54 additions and 36 deletions

View file

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

View file

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

16
aps
View file

@ -1,10 +1,14 @@
#!/bin/sh #!/bin/sh
temp_location="/var/tmp" if [ -f "/etc/al/config" ]; then
install_root="/var/tmp/alroot" . /etc/al/config
installed_pkg_database="${install_root}/var/aps/installed" else
locpkg_database="${install_root}/var/aps/repos" temp_location="/var/tmp"
lock="${install_root}/var/aps/lock" install_root="/var/tmp/alroot"
official="https://git.hippoz.xyz/alnux/repo" 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() { die() {
echo "aps: fatal: ${1}" echo "aps: fatal: ${1}"
rm "${lock}" 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 aps ${prefix}/usr/bin/ &&
install -v altools/sel ${prefix}/usr/bin/ && install -v altools/sel ${prefix}/usr/bin/ &&
install -v altools/repo ${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 fi