Compare commits
6 commits
9623569a7d
...
e45205cb2f
Author | SHA1 | Date | |
---|---|---|---|
e45205cb2f | |||
|
61bcf710c0 | ||
|
c540598726 | ||
|
3967b897df | ||
|
64de631b3f | ||
|
2ea5c8a809 |
4 changed files with 42 additions and 4 deletions
36
aps
36
aps
|
@ -1,4 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
#################################
|
||||
# Alnux Packaging System, #
|
||||
# the package manager for Alnux #
|
||||
#################################
|
||||
|
||||
if [ -f "/etc/al/config" ]; then
|
||||
. /etc/al/config
|
||||
else
|
||||
|
@ -8,12 +14,25 @@ else
|
|||
locpkg_database="${install_root}/var/aps/repos"
|
||||
lock="${install_root}/var/aps/lock"
|
||||
official="https://git.hippoz.xyz/alnux/repo"
|
||||
debug=off
|
||||
fi
|
||||
if [ ${debug} = on ]; then
|
||||
set -x
|
||||
fi
|
||||
die() {
|
||||
echo "aps: fatal: ${1}"
|
||||
rm "${lock}"
|
||||
exit 2
|
||||
}
|
||||
confirm(){
|
||||
echo -ne "Are you sure? [Y/n] "
|
||||
read prompt
|
||||
if [[ ${prompt} = [nN] ]]; then
|
||||
die "User said no. Exiting..."
|
||||
elif [[ ${prompt} != [yY] ]]; then
|
||||
die "User gave invalid input. Exiting..."
|
||||
fi
|
||||
}
|
||||
run_package_script() {
|
||||
{
|
||||
if [ -x "${2}/${1}" ]; then
|
||||
|
@ -26,6 +45,7 @@ run_package_script() {
|
|||
install_local_package() {
|
||||
[ ! -e "${1}" ] && die "[E] File ${1} does not exist. Exiting..."
|
||||
# Extract the package
|
||||
confirm
|
||||
echo ":: Installing package ${1}"
|
||||
cp -prv "${1}" "${temp_location}"
|
||||
pkg_name="${1%/}"
|
||||
|
@ -73,6 +93,7 @@ install_local_package() {
|
|||
echo "[*] Install complete for package ${pkg_name}"
|
||||
}
|
||||
sync_deps(){
|
||||
confirm
|
||||
echo ":: Syncing dependencies for ${1}"
|
||||
install_package_from_repo "${pkg_makedepends}"
|
||||
install_package_from_repo "${pkg_deps}"
|
||||
|
@ -80,6 +101,7 @@ sync_deps(){
|
|||
|
||||
}
|
||||
remove_local_package() {
|
||||
confirm
|
||||
echo ":: Removing target ${1}..."
|
||||
pkg_path="${installed_pkg_database}/${1}"
|
||||
[ ! -d "${pkg_path}" ] && die "Package could not be found in local installed package database. Exiting..."
|
||||
|
@ -106,6 +128,7 @@ install_package_from_repo() { # NOTE(hippoz): This can get a tad confusing... ${
|
|||
install_local_package "${locpkg_database}/${1}/${2}"
|
||||
}
|
||||
upgrade() {
|
||||
confirm
|
||||
echo ":: Upgrading installed packages"
|
||||
cd "${installed_pkg_database}" || die "Could not enter local installed package database directory. Exiting..."
|
||||
for pkg in */; do
|
||||
|
@ -126,6 +149,17 @@ upgrade() {
|
|||
unset pkg_config_depends
|
||||
done
|
||||
}
|
||||
version(){
|
||||
echo "Alnux APS v0.0.8"
|
||||
}
|
||||
help(){
|
||||
echo "Alnux APS, the packaging system for Alnux."
|
||||
echo ""
|
||||
echo "sync - Synchronizes from package repository."
|
||||
echo "install - Installs from local package information file and build file."
|
||||
echo "upgrade - Upgrades from package repository."
|
||||
echo "remove - Removes a package from /var/aps/installed and it's install files (payloadfiles)."
|
||||
}
|
||||
main() {
|
||||
if [ -f "${lock}" ]; then
|
||||
echo "[E] A lock file already exists (another instance of the package manager could be running). If you're sure no package manager is running, remove the file ${lock}."
|
||||
|
@ -144,6 +178,8 @@ main() {
|
|||
[ -z "${2}" ] && exit 0
|
||||
install_package_from_repo "official" "${2}" ;;
|
||||
upgrade) upgrade "official" ;;
|
||||
help) help ;;
|
||||
version) version ;;
|
||||
*) die "[E] Invalid option ${1}, exiting..." ;;
|
||||
esac
|
||||
rm "${lock}"
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
# Alnux Packaging System #
|
||||
##########################
|
||||
temp_location="/var/tmp"
|
||||
install_root="/var/tmp/alroot"
|
||||
install_root="/"
|
||||
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"
|
||||
debug=off
|
||||
|
|
|
@ -13,9 +13,10 @@ if [ ${prefix} == / ]; then
|
|||
kill 2
|
||||
fi
|
||||
else
|
||||
./aps sync alnux
|
||||
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
|
||||
install -v config/config ${prefix}/etc/al &&
|
||||
install -v -Dm644 man/aps.8.gz ${prefix}/usr/share/man/man8/
|
||||
fi
|
||||
|
|
BIN
man/aps.8.gz
Normal file
BIN
man/aps.8.gz
Normal file
Binary file not shown.
Loading…
Reference in a new issue