From 5bcb0d16071ee5598201e42dd57a2bd445f051fc Mon Sep 17 00:00:00 2001 From: Ohio2 Date: Wed, 25 Aug 2021 13:01:36 +0200 Subject: [PATCH] add config --- altools/repo | 24 ++++++++++++------------ altools/sel | 36 +++++++++++++++++++----------------- aps | 16 ++++++++++------ config/config | 11 +++++++++++ install.sh | 3 ++- 5 files changed, 54 insertions(+), 36 deletions(-) create mode 100755 config/config diff --git a/altools/repo b/altools/repo index 7cbf2ae..a854b9e 100755 --- a/altools/repo +++ b/altools/repo @@ -3,16 +3,16 @@ ######################################## # Repo, a repository manager for alnux # ######################################## - case $1 in - # add a repo - add) git clone https://${3}/${2}.git /var/aps/repos/${2} - echo "${2}" >> /etc/al/repo.conf - ;; - # update a repo - update) pushd && cd /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 +. /etc/al/config +case $1 in + # add a repo + add) git clone https://${3}/${2}.git ${install_root}/var/aps/repos/${2} + echo "${2}" >> ${install_root}/etc/al/repo.conf ;; - - esac + # update a repo + update) pushd && cd ${install_root}/var/aps/repos/${2} && git pull && popd ;; + # destroy a repo (remove) + destroy) rm -rfv ${install_root}/var/aps/repos/${2} + sed -i "/^${2}/d" ${install_root}/etc/al/repo.conf + ;; +esac diff --git a/altools/sel b/altools/sel index 3994ea3..502a427 100755 --- a/altools/sel +++ b/altools/sel @@ -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 diff --git a/aps b/aps index 8766e86..3e4fb51 100755 --- a/aps +++ b/aps @@ -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}" diff --git a/config/config b/config/config new file mode 100755 index 0000000..c4db539 --- /dev/null +++ b/config/config @@ -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" diff --git a/install.sh b/install.sh index f3c534f..31ad99d 100755 --- a/install.sh +++ b/install.sh @@ -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