From 0c0496130f64b4ebe051172af86c0c332db9d5e9 Mon Sep 17 00:00:00 2001 From: davidovski Date: Sat, 12 Mar 2022 22:58:22 +0000 Subject: made changed to make it more posix compliant --- src/get.sh | 2 +- src/install.sh | 15 ++++++++------- src/query.sh | 9 +++++---- src/sync.sh | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/get.sh b/src/get.sh index a5039c1..64fc110 100755 --- a/src/get.sh +++ b/src/get.sh @@ -118,7 +118,7 @@ download_packages () { info_file="${pkg_file}.info" if ! validate_sig $pkg_file $info_file; then - printf "${RED}Failed to verify signature for ${LIGHT_RED}%s${RED}\n" $(basename -s .xipkg $pkg_file) + printf "${RED}Failed to verify signature for ${LIGHT_RED}%s${RED}\n" $(basename $pkg_file .xipkg) mv "$pkg_file" "${pkg_file}.invalid" else i=$((i+1)) diff --git a/src/install.sh b/src/install.sh index 737f07d..198b4e5 100644 --- a/src/install.sh +++ b/src/install.sh @@ -50,7 +50,7 @@ total_filecount() { local packages=$@ local count=0 for package in $packages; do - local name=$(basename -s .xipkg $package | cut -d. -f2) + local name=$(basename $package .xipkg | cut -d. -f2) local c=$(get_package_filecount $name) count=$((count+c)) done @@ -71,12 +71,13 @@ run_postinstall () { else xichroot ${SYSROOT} "/var/lib/xipkg/postinstall/$f" fi - - rm $file && - printf "${GREEN}run postinstall for $f!\n" - + if [ "$?" == "0" ]; then + rm $file && + printf "${GREEN}run postinstall for $f!\n" + else + printf "${RED}failed running postinstall for $f!\n" + fi done - rmdir $postinstall 2> /dev/null fi } @@ -103,7 +104,7 @@ install () { local total=$(total_filecount $packages 2>/dev/null || echo 1) local files_files="" for package in $packages; do - local name=$(basename -s .xipkg $package | cut -d. -f2) + local name=$(basename package .xipkg | cut -d. -f2) ${VERBOSE} && printf "${BLACK}installing $name from $package \n${RESET}" install_package $package $name & diff --git a/src/query.sh b/src/query.sh index c13cbcf..8ae9588 100644 --- a/src/query.sh +++ b/src/query.sh @@ -27,10 +27,11 @@ files () { file_info () { for file in $@; do [ ! -f ${SYSROOT}$file ] && file=$(realpath $file) - for list in ${INSTALLED_DIR}/*/files; do - package=$(dirname $list | xargs basename) - grep -q $file $list && - printf "${LIGHT_BLUE}%s${BLUE} belongs to ${LIGHT_BLUE}%s${RESET}\n" $file $package + for pkg in $(list_installed); do + for list in ${INSTALLED_DIR}/$pkg/files; do + grep -q $file $list && + printf "${LIGHT_BLUE}%s${BLUE} belongs to ${LIGHT_BLUE}%s${RESET}\n" $file $pkg + done done done } diff --git a/src/sync.sh b/src/sync.sh index 265c374..b6cb5b1 100755 --- a/src/sync.sh +++ b/src/sync.sh @@ -11,7 +11,7 @@ parse_line() { local size=$5 local files=$6 - local package_name=$(basename -s ".xipkg" $package) + local package_name=$(basename $package ".xipkg") local package_dir="$PACKAGES_DIR/$repo/$package_name.versions" local checksum_file=$package_dir/$checksum -- cgit v1.2.1