This commit is contained in:
Ohio2 2021-08-29 13:26:05 +02:00
parent 3014cb3241
commit 8c7a5d0e3a

30
aps
View file

@ -7,7 +7,7 @@
if [ -f "$XDG_CONFIG_HOME/al/config" ]; then
. $XDG_CONFIG_HOME/al/config
elif [ -f "$HOME/.config/al/config"]; then
elif [ -f "$HOME/.config/al/config" ]; then
. $HOME/.config/al/config
elif [ -f "/etc/al/config" ]; then
. /etc/al/config
@ -47,7 +47,7 @@ run_package_script() {
}
}
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
confirm
echo ":: Installing package ${1}"
@ -63,11 +63,13 @@ install_local_package() {
pkg_config_makedepends=""
pkg_config_depends=""
# Download sources.
pkg_config_sources="$(cat sources | sed -n 1)"
pkg_config_sources_to="$(cat sources | sed -n 1)"
pkg_config_sources_to="$(echo ${pkg_config_sources_to} | sed s|.*/||)"
pkg_config_sources=$(cat sources)
#pkg_config_sources_to=$(cat sources)
pkg_config_sources_to=$(echo ${pkg_config_sources} | sed 's:.*/::')
#pkg_config_sources_to_ex=$(echo ${pkg_config_sources_to} | sed 's/\..*$//')
curl -# ${pkg_config_sources} -o ${pkg_config_sources_to}
tar -xf ${pkg_config_sources_to} ${pkg_name}
mkdir ${pkg_name}
tar -xf ${pkg_config_sources_to} -C ${pkg_name}
cd ${pkg_name}
# Install package
mkdir -p "${pkg_path}/payload"
@ -89,7 +91,7 @@ install_local_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"
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
# Cleanup
rm -r "${pkg_path}"
@ -161,7 +163,7 @@ upgrade() {
done
}
version(){
echo "Alnux APS v0.0.8"
echo "Alnux APS v0.0.8.1"
}
help(){
echo "Alnux APS, the packaging system for Alnux."
@ -179,17 +181,17 @@ list(){
}
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}."
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
fi
touch "${lock}"
case ${1} in
install) install_local_package "${2}" ;;
remove) remove_local_package "${2}" ;;
sync-dep)
sync_local_repo_database "official" ${official}
[ -z "${2}" ] && exit 0
install_package_from_repo "official" "${2}" ;;
#sync-dep)
# sync_local_repo_database "official" ${official}
# [ -z "${2}" ] && exit 0
# install_package_from_repo "official" "${2}" ;;
sync)
sync_local_repo_database "official" ${official}
[ -z "${2}" ] && exit 0
@ -198,7 +200,7 @@ main() {
help) help ;;
version) version ;;
list) list ;;
*) die "[E] Invalid option ${1}, exiting..." ;;
*) die "Invalid option ${1}, exiting..." ;;
esac
rm "${lock}"
}