Basically previous pr but without wiki and actually i pushed this time #6
1 changed files with 14 additions and 2 deletions
16
aps
16
aps
|
@ -1,4 +1,5 @@
|
|||
#!/bin/sh
|
||||
user="$(whoami)"
|
||||
temp_location="/tmp"
|
||||
install_root="/tmp/alroot"
|
||||
installed_pkg_database="${install_root}/var/aps/installed"
|
||||
|
@ -11,6 +12,13 @@ die() {
|
|||
rm "${lock}"
|
||||
exit 2
|
||||
}
|
||||
verify(){
|
||||
if [ ${user} != root ]
|
||||
die "[E] Please run this option as root!"
|
||||
else
|
||||
#do nothing
|
||||
fi
|
||||
}
|
||||
run_package_script() { # --- $2 is the package path, and $1 is the script to run
|
||||
# --- RPS installs to root
|
||||
{
|
||||
|
@ -19,12 +27,13 @@ run_package_script() { # --- $2 is the package path, and $1 is the script to run
|
|||
cd "${2}" || die "Could not enter package working directory. Exiting..."
|
||||
"${2}/${1}" "${2}/payload" "${2}"
|
||||
fi
|
||||
}
|
||||
}
|
||||
}
|
||||
install_local_package() { # --- Install-Local-Package install package LOCALLY!
|
||||
[ ! -e "${1}" ] && die "[E] File ${1} does not exist. Exiting..."
|
||||
# Extract the package
|
||||
echo "[*] Copying package ${1} into temporary location ${temp_location}..."
|
||||
verify
|
||||
cp -prv "${1}" "${temp_location}"
|
||||
pkg_name="${1%/}"
|
||||
pkg_name="${pkg_name##*/}"
|
||||
|
@ -38,7 +47,7 @@ install_local_package() { # --- Install-Local-Package install package LOCALLY!
|
|||
pkg_config_depends=""
|
||||
# Install package
|
||||
. "${pkg_path}/package"
|
||||
run_package_script "build" "${pkg_path}"
|
||||
run_package_script "build" "${pkg_path}"
|
||||
run_package_script "predeploy" "${pkg_path}"
|
||||
# Deploy package
|
||||
if [ "${pkg_config_deploy}" = true ]; then
|
||||
|
@ -71,6 +80,7 @@ install_local_package() { # --- Install-Local-Package install package LOCALLY!
|
|||
unset pkg_config_depends
|
||||
}
|
||||
remove_local_package() { # --- Removes local packges
|
||||
verify
|
||||
pkg_path="${installed_pkg_database}/${1}"
|
||||
[ ! -d "${pkg_path}" ] && die "Package could not be found in local installed package database. Exiting..."
|
||||
payloadfiles_path="${pkg_path}/payloadfiles"
|
||||
|
@ -82,6 +92,7 @@ remove_local_package() { # --- Removes local packges
|
|||
}
|
||||
sync_local_repo_database() { # --- syncs to local repo databese
|
||||
echo ":: Syncing local database for repo ${1}..."
|
||||
verify
|
||||
if [ ! -d "${locpkg_database}/${1}" ]; then
|
||||
echo ":: Local database for repo ${1} does not exist, cloning..."
|
||||
git clone "${2}" "${locpkg_database}/${1}"
|
||||
|
@ -98,6 +109,7 @@ install_package_from_repo() { # NOTE(hippoz): This can get a tad confusing... ${
|
|||
}
|
||||
upgrade() { # --- upgrades
|
||||
echo ":: Upgrading installed packages..."
|
||||
verify
|
||||
unset_config_values
|
||||
cd "${installed_pkg_database}" || die "Could not enter installed package database. Exiting..."
|
||||
for pkg in */; do
|
||||
|
|
Loading…
Reference in a new issue