Compare commits

...

12 commits

Author SHA1 Message Date
9623569a7d Merge pull request 'Add altools/sel, altools/repo, install.sh & add config file support.' (#8) from Ohio2/aps:master into master
Reviewed-on: #8
2021-08-25 12:46:00 +01:00
a718517dc7 what 2021-08-25 12:31:44 +01:00
Ohio2
5bcb0d1607 add config 2021-08-25 13:01:36 +02:00
Ohio2
b1ca212971 hippoz insisted on doing this so um 2021-08-25 12:21:03 +02:00
Ohio2
4223978465 tools/ does not exist 2021-08-25 11:45:35 +02:00
Ohio2
0eb142c4d6 remove whole line containing 123 when 123 is a package repo & its website is trololo.git/troll/repo 2021-08-25 11:43:35 +02:00
Ohio2
391795714b fix merge conflict 2021-08-25 11:39:48 +02:00
Ohio2
f473df35b6 lmfao 2021-08-25 11:37:56 +02:00
Ohio2
b8e8d9996a pcm 2021-08-25 06:44:51 +02:00
ed2c916609 i forgor 💀 2021-08-24 06:37:30 +01:00
Ohio2
6510fd4132 Add repo and install.sh 2021-08-24 07:32:32 +02:00
Ohio2
1ef353862d add the sel(ect) utility 2021-08-24 06:55:14 +02:00
5 changed files with 102 additions and 6 deletions

18
altools/repo Executable file
View file

@ -0,0 +1,18 @@
#!/bin/sh
########################################
# Repo, a repository manager for alnux #
########################################
. /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
;;
# 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

35
altools/sel Executable file
View file

@ -0,0 +1,35 @@
#!/bin/sh
#########################
# Alnux sel(ect) Script #
#########################
. /etc/al/config
if [ -f "${install_root}/etc/al/lnver" ]; then
. /etc/al/lnver.cfg
fi
case $1 in
linux) case $2 in
# Lists all kernels
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}
echo "lnver=${3}" > ${install_root}/etc/al/lnver.cfg
;;
# Links the set kernel version.
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 ${install_root}/usr/src/linux ;;
esac
esac

23
aps Normal file → Executable file
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}"
@ -68,6 +72,13 @@ install_local_package() {
unset pkg_config_depends
echo "[*] Install complete for package ${pkg_name}"
}
sync_deps(){
echo ":: Syncing dependencies for ${1}"
install_package_from_repo "${pkg_makedepends}"
install_package_from_repo "${pkg_deps}"
echo "[*] Install dependencies for ${1}"
}
remove_local_package() {
echo ":: Removing target ${1}..."
pkg_path="${installed_pkg_database}/${1}"

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"

21
install.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/sh
##########################
# INSTALL SCRIPT FOR APS #
##########################
case $1 in
--prefix) prefix=$2 ;;
*) prefix=/
esac
if [ ${prefix} == / ]; then
if [ $(whoami) != root ]; then
echo '[E] You must run as root!'
kill 2
fi
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 &&
install -v config/config /etc/al
fi