Add altools/sel, altools/repo, install.sh & add config file support. #8
5 changed files with 102 additions and 6 deletions
18
altools/repo
Executable file
18
altools/repo
Executable 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
35
altools/sel
Executable 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
23
aps
Normal file → Executable 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}"
|
||||||
|
@ -68,6 +72,13 @@ install_local_package() {
|
||||||
unset pkg_config_depends
|
unset pkg_config_depends
|
||||||
echo "[*] Install complete for package ${pkg_name}"
|
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() {
|
remove_local_package() {
|
||||||
echo ":: Removing target ${1}..."
|
echo ":: Removing target ${1}..."
|
||||||
pkg_path="${installed_pkg_database}/${1}"
|
pkg_path="${installed_pkg_database}/${1}"
|
||||||
|
|
11
config/config
Executable file
11
config/config
Executable 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
21
install.sh
Executable 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
|
Loading…
Reference in a new issue