From 62ac6c319289550931696346ce08f2c0ed70fc0d Mon Sep 17 00:00:00 2001 From: davidovski Date: Sun, 28 Aug 2022 18:31:25 +0000 Subject: fixed removing removing from wrong sysroot --- build.shmk | 2 ++ src/get.sh | 11 ++++++----- src/remove.sh | 2 +- src/util.sh | 12 ++++++++++++ src/xi.sh | 2 +- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/build.shmk b/build.shmk index d23d538..91f2a95 100755 --- a/build.shmk +++ b/build.shmk @@ -1,5 +1,7 @@ #!/usr/bin/env shmk +search_path="src $search_path" + PROGS=" src/xi.sh " diff --git a/src/get.sh b/src/get.sh index 197b232..08e5ee5 100755 --- a/src/get.sh +++ b/src/get.sh @@ -156,16 +156,17 @@ get () { checksum=$2 size=$3 - if ! is_installed $package; then + if is_installed $package; then + if [ "$(get_installed_version $package)" = "$checksum" ]; then + already="$already $package" + continue + fi + else install="$install $package" total_download=$((total_download+size)) continue fi - if [ "$(get_installed_version $package)" = "$checksum" ]; then - already="$already $package" - continue - fi update="$update $package" total_download=$((total_download+size)) done diff --git a/src/remove.sh b/src/remove.sh index ae5b58a..790dc5d 100644 --- a/src/remove.sh +++ b/src/remove.sh @@ -10,7 +10,7 @@ remove () { local real="" for package in $@; do - local package_dir="${INSTALLED_DIR}/$package" + local package_dir="${SYSROOT}${INSTALLED_DIR}/$package" local filesfile="${package_dir}/files" if [ -d $package_dir ]; then [ -f $filesfile ] && diff --git a/src/util.sh b/src/util.sh index f92e4e3..871fe2a 100644 --- a/src/util.sh +++ b/src/util.sh @@ -1,9 +1,21 @@ #!/bin/sh +# Download a file and find out the http code +# download_file() { curl ${CURL_OPTS} -o $1 -w "%{http_code}" $2 2>> ${LOG_FILE} } + +# Check if the user can write to the selected systemroot +# +checkroot () { + [ -w "${SYSROOT}" ] || { + printf "${RED}Please run as root!${RESET}\n" + exit 1 + } +} + # this function is broken wait_for_jobs () { local text=$1 diff --git a/src/xi.sh b/src/xi.sh index 2f50fa5..adf7c1c 100755 --- a/src/xi.sh +++ b/src/xi.sh @@ -1,6 +1,6 @@ #!/bin/sh -#include xilib +#include xilib.sh #include profile.sh #include util.sh #include validate.sh -- cgit v1.2.1