Merge pull request 'APS release v0.0.8.1 codename: Cleveland' (#11) from Ohio2/aps:master into master

Reviewed-on: #11
This commit is contained in:
hippoz 2021-08-31 13:31:37 +01:00
commit 8dedd0b7da
3 changed files with 22 additions and 18 deletions

39
aps
View file

@ -7,7 +7,7 @@
if [ -f "$XDG_CONFIG_HOME/al/config" ]; then if [ -f "$XDG_CONFIG_HOME/al/config" ]; then
. $XDG_CONFIG_HOME/al/config . $XDG_CONFIG_HOME/al/config
elif [ -f "$HOME/.config/al/config"]; then elif [ -f "$HOME/.config/al/config" ]; then
. $HOME/.config/al/config . $HOME/.config/al/config
elif [ -f "/etc/al/config" ]; then elif [ -f "/etc/al/config" ]; then
. /etc/al/config . /etc/al/config
@ -18,7 +18,7 @@ else
locpkg_database="${install_root}/var/aps/repos" locpkg_database="${install_root}/var/aps/repos"
lock="${install_root}/var/aps/lock" lock="${install_root}/var/aps/lock"
official="https://git.hippoz.xyz/alnux/repo" official="https://git.hippoz.xyz/alnux/repo"
debug=off debug=off
fi fi
if [ ${debug} = on ]; then if [ ${debug} = on ]; then
set -x set -x
@ -41,13 +41,13 @@ run_package_script() {
{ {
if [ -x "${2}/${1}" ]; then if [ -x "${2}/${1}" ]; then
echo ":: Running ${1}" echo ":: Running ${1}"
cd "${2}" || die "Could not enter package working directory. Exiting..." #cd "${2}" || die "Could not enter package working directory. Exiting..."
"${2}/${1}" "${2}/payload" "${2}" "${2}/${1}" "${2}/payload" "${2}"
fi fi
} }
} }
install_local_package() { install_local_package() {
[ ! -e "${1}" ] && die "[E] File ${1} does not exist. Exiting..." [ ! -e "${1}" ] && die "File ${1} does not exist. Exiting..."
# Extract the package # Extract the package
confirm confirm
echo ":: Installing package ${1}" echo ":: Installing package ${1}"
@ -63,16 +63,19 @@ install_local_package() {
pkg_config_makedepends="" pkg_config_makedepends=""
pkg_config_depends="" pkg_config_depends=""
# Download sources. # Download sources.
pkg_config_sources="$(cat sources | sed -n 1)" if [ -f sources ]; then
pkg_config_sources_to="$(cat sources | sed -n 1)" pkg_config_sources=$(cat sources)
pkg_config_sources_to="$(echo ${pkg_config_sources_to} | sed s|.*/||)" pkg_config_sources_to=$(echo ${pkg_config_sources} | sed 's:.*/::')
curl -# ${pkg_config_sources} -o ${pkg_config_sources_to} curl -# ${pkg_config_sources} -o ${pkg_config_sources_to}
tar -xf ${pkg_config_sources_to} ${pkg_name} mkdir pkg_bd
cd ${pkg_name} tar -xf 1 ${pkg_config_sources_to} -C ${pkg_path}
fi
# Install package # Install package
mkdir -p "${pkg_path}/payload" mkdir -p "${pkg_path}/payload"
. "${pkg_path}/package" . "${pkg_path}/package"
cd pkg_bd/
run_package_script "build" "${pkg_path}" run_package_script "build" "${pkg_path}"
cd ../..
run_package_script "predeploy" "${pkg_path}" run_package_script "predeploy" "${pkg_path}"
# Deploy package # Deploy package
if [ "${pkg_config_deploy}" = true ]; then if [ "${pkg_config_deploy}" = true ]; then
@ -89,7 +92,7 @@ install_local_package() {
cp -pv "${pkg_path}/package" "${installed_pkg_database}/${pkg_name}/package" cp -pv "${pkg_path}/package" "${installed_pkg_database}/${pkg_name}/package"
[ -e "${temp_location}/${pkg_name}-payloadfiles" ] && cp -pv "${temp_location}/${pkg_name}-payloadfiles" "${installed_pkg_database}/${pkg_name}/payloadfiles" [ -e "${temp_location}/${pkg_name}-payloadfiles" ] && cp -pv "${temp_location}/${pkg_name}-payloadfiles" "${installed_pkg_database}/${pkg_name}/payloadfiles"
else else
die "[E] Target ${pkg_name} does not have a package script (it's an invalid package!). Exiting..." die "Target ${pkg_name} does not have a package script (it's an invalid package!). Exiting..."
fi fi
# Cleanup # Cleanup
rm -r "${pkg_path}" rm -r "${pkg_path}"
@ -161,7 +164,7 @@ upgrade() {
done done
} }
version(){ version(){
echo "Alnux APS v0.0.8" echo "Alnux APS v0.0.8.1"
} }
help(){ help(){
echo "Alnux APS, the packaging system for Alnux." echo "Alnux APS, the packaging system for Alnux."
@ -179,17 +182,17 @@ list(){
} }
main() { main() {
if [ -f "${lock}" ]; then 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}." echo "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}."
exit 1 exit 1
fi fi
touch "${lock}" touch "${lock}"
case ${1} in case ${1} in
install) install_local_package "${2}" ;; install) install_local_package "${2}" ;;
remove) remove_local_package "${2}" ;; remove) remove_local_package "${2}" ;;
sync-dep) #sync-dep)
sync_local_repo_database "official" ${official} # sync_local_repo_database "official" ${official}
[ -z "${2}" ] && exit 0 # [ -z "${2}" ] && exit 0
install_package_from_repo "official" "${2}" ;; # install_package_from_repo "official" "${2}" ;;
sync) sync)
sync_local_repo_database "official" ${official} sync_local_repo_database "official" ${official}
[ -z "${2}" ] && exit 0 [ -z "${2}" ] && exit 0
@ -198,7 +201,7 @@ main() {
help) help ;; help) help ;;
version) version ;; version) version ;;
list) list ;; list) list ;;
*) die "[E] Invalid option ${1}, exiting..." ;; *) die "Invalid option ${1}, exiting..." ;;
esac esac
rm "${lock}" rm "${lock}"
} }

View file

@ -13,6 +13,7 @@ if [ ${prefix} == / ]; then
kill 2 kill 2
fi fi
else else
export install_root=${prefix}
./aps sync alnux ./aps sync alnux
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/ &&

Binary file not shown.