summaryrefslogtreecommitdiff
path: root/src/xi.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/xi.sh')
-rwxr-xr-xsrc/xi.sh42
1 files changed, 19 insertions, 23 deletions
diff --git a/src/xi.sh b/src/xi.sh
index 92222f9..923612c 100755
--- a/src/xi.sh
+++ b/src/xi.sh
@@ -133,6 +133,21 @@ done
. ${LIBDIR}/get.sh
. ${LIBDIR}/remove.sh
+do_install () {
+ [ "$#" = "0" ] && set -- $(installed)
+
+ toinstall=${CACHE_DIR}/toinstall
+
+ echo "" > $toinstall
+ tofetch=""
+ for f in $@; do
+ [ -f "$f" ] && echo $f >> $toinstall || tofetch="$tofetch$f "
+ done
+
+ get $tofetch
+ install $(cat $toinstall)
+}
+
shift $((OPTIND-1))
if [ "$#" = "0" ]; then
@@ -147,19 +162,7 @@ else
"install" | "update")
shift
checkroot
-
- [ "$#" = "0" ] && set -- $(installed)
-
- toinstall=${CACHE_DIR}/toinstall
-
- echo "" > $toinstall
- tofetch=""
- for f in $@; do
- [ -f "$f" ] && echo $f >> $toinstall || tofetch="$tofetch$f "
- done
-
- get $tofetch
- install $(cat $toinstall)
+ do_install $@
;;
"build")
shift
@@ -187,8 +190,8 @@ else
"reinstall")
shift
checkroot
- $0 remove $@
- $0 install $@
+ remove $@
+ do_install $@
;;
"files")
shift
@@ -221,14 +224,7 @@ else
;;
"info")
shift
- for package in $@; do
- infofile=${INSTALLED_DIR}/$package/info
- [ -f $infofile ] && {
- cat $infofile
- } || {
- printf "Package info for $package could not be found!"
- }
- done
+ info $@
;;
"verify")
shift