summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/install.sh23
-rwxr-xr-xsrc/profile.sh2
-rw-r--r--src/remove.sh8
-rwxr-xr-xsrc/xi.sh7
4 files changed, 27 insertions, 13 deletions
diff --git a/src/install.sh b/src/install.sh
index fa08d33..737f07d 100644
--- a/src/install.sh
+++ b/src/install.sh
@@ -14,11 +14,13 @@ install_package () {
local files="$installed_dir/files"
local checksum="$installed_dir/checksum"
- local package_checksum=$(md5sum $pkg_file | cut -d' ' -f1)
+ set -- $(md5sum $pkg_file)
+ local package_checksum=$1
if [ ! -f $checksum ] || [ "$(cat $checksum)" != "$package_checksum" ]; then
mkdir -p "$installed_dir"
[ -f $files ] && mv $files $files.old
- extract $1 > $files
+ ${VERBOSE} && printf "${BLACK}Extracting $name...\n"
+ extract $pkg_file > $files
[ -f $info_file ] && cp $info_file $info
@@ -31,6 +33,10 @@ install_package () {
done
rm $files.old
fi
+ return 0
+ else
+ ${VERBOSE} && printf "${BLACK}Skipping $name; already installed...\n"
+ return 1
fi
}
@@ -60,10 +66,15 @@ run_postinstall () {
# run the postinstall file
#
chmod 755 $file
- [ "${SYSROOT}" = "/" ] &&
- sh "/var/lib/xipkg/postinstall/$f" &&
- rm $file &&
- printf "${GREEN}run postinstall for $f!\n"
+ if [ "${SYSROOT}" = "/" ]; then
+ sh "/var/lib/xipkg/postinstall/$f"
+ else
+ xichroot ${SYSROOT} "/var/lib/xipkg/postinstall/$f"
+ fi
+
+ rm $file &&
+ printf "${GREEN}run postinstall for $f!\n"
+
done
rmdir $postinstall 2> /dev/null
fi
diff --git a/src/profile.sh b/src/profile.sh
index cce8884..2bd741e 100755
--- a/src/profile.sh
+++ b/src/profile.sh
@@ -22,5 +22,3 @@ export CACHE_DIR=$(parseconf -v dir.cache)
export PACKAGE_CACHE="${CACHE_DIR}/packages"
export SYNC_CACHE="${CACHE_DIR}/sync"
-. /usr/lib/glyphs.sh
-
diff --git a/src/remove.sh b/src/remove.sh
index cdea192..67bbbdd 100644
--- a/src/remove.sh
+++ b/src/remove.sh
@@ -5,6 +5,7 @@ remove () {
local to_remove="${CACHE_DIR}/toremove"
[ -f $to_remove ] && rm $to_remove
+ touch $to_remove
local real=""
for package in $@; do
@@ -12,7 +13,9 @@ remove () {
local filesfile="${package_dir}/files"
if [ -d $package_dir ]; then
[ -f $filesfile ] &&
- cat $filesfile >> $to_remove
+ while IFS= read -r file; do
+ echo ${SYSROOT}/$file >> $to_remove
+ done < $filesfile
echo $package_dir >> $to_remove
real="$real $package"
else
@@ -24,13 +27,14 @@ remove () {
${QUIET} || printf "${LIGHT_RED}The following packages will be removed from the system:\n\t${RED}%s\n" $real
${QUIET} || printf "${LIGHT_RED}Files to remove: ${RED}%s\n" $total
+ ${VERBOSE} && cat $to_remove
if prompt_question "Continue?"; then
local removed=0
${QUIET} || hbar
for file in $(cat $to_remove); do
- rm -rf ${SYSROOT}/$file
+ rm -rf $file
removed=$((removed+1))
${QUIET} || hbar ${HBAR_RED} -T "removing files" $removed $total
diff --git a/src/xi.sh b/src/xi.sh
index 5d76c6c..3ae684a 100755
--- a/src/xi.sh
+++ b/src/xi.sh
@@ -105,21 +105,20 @@ while getopts ":r:c:qnluyvh" opt; do
esac
done
+# TODO only load these modules when needed
. ${LIBDIR}/profile.sh
. ${LIBDIR}/util.sh
. ${LIBDIR}/validate.sh
-. ${LIBDIR}/stats.sh
. ${LIBDIR}/query.sh
. ${LIBDIR}/sync.sh
. ${LIBDIR}/install.sh
-. ${LIBDIR}/bootstrap.sh
-. ${LIBDIR}/remove.sh
. ${LIBDIR}/get.sh
shift $((OPTIND-1))
if [ "$#" = "0" ]; then
+ . ${LIBDIR}/stats.sh
show_xipkg_stats
else
case "$1" in
@@ -142,6 +141,7 @@ else
;;
"remove")
shift
+ . ${LIBDIR}/remove.sh
remove $@
;;
"files")
@@ -165,6 +165,7 @@ else
;;
"bootstrap")
shift
+ . ${LIBDIR}/bootstrap.sh
bootstrap $@
;;
"help")