summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-05-31 17:47:44 +0100
committerdavidovski <david@davidovski.xyz>2022-05-31 17:47:44 +0100
commit4bac1f97b9990e70d71639ed1678a4256cc26098 (patch)
tree67500bfe9f22454328114327afe5cf8f92b1c717
parent9752813e90d663aab55c33d3877886a9013f36db (diff)
added default cmd option
-rwxr-xr-xscripts/installer.sh1
-rwxr-xr-xsrc/profile.sh3
-rw-r--r--src/query.sh2
-rw-r--r--src/stats.sh23
-rwxr-xr-xsrc/xi.sh5
-rw-r--r--xipkg.conf6
6 files changed, 17 insertions, 23 deletions
diff --git a/scripts/installer.sh b/scripts/installer.sh
index c974951..589574d 100755
--- a/scripts/installer.sh
+++ b/scripts/installer.sh
@@ -115,6 +115,7 @@ install_base () {
}
copy_resolvconf () {
+ [ ! -d $sysroot/etc ] && mkdir $sysroot/etc
cp /etc/resolv.conf $sysroot/etc/resolv.conf
}
diff --git a/src/profile.sh b/src/profile.sh
index 683738e..c2bda20 100755
--- a/src/profile.sh
+++ b/src/profile.sh
@@ -6,11 +6,12 @@
export HBAR_COMPLETE="-c ${GREEN}${BG_DEFAULT}"
export HBAR_RED="-c ${BLACK}${BG_RED}"
-
export CONF_FILE="/etc/xipkg.conf"
export CURL_OPTS="-sSL"
+export DEFAULT_OPTION=$(parseconf -v default_cmd)
+
export DEP_DIR=$(parseconf -v dir.deps)
export REPOS="$(parseconf -v repos)"
export SOURCES="$(parseconf sources.*)"
diff --git a/src/query.sh b/src/query.sh
index 14d9adf..17f0c57 100644
--- a/src/query.sh
+++ b/src/query.sh
@@ -35,7 +35,7 @@ files () {
file_info () {
for file in $@; do
[ ! -f ${SYSROOT}$file ] && file=$(realpath $file)
- for pkg in $(list_installed); do
+ for pkg in $(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
diff --git a/src/stats.sh b/src/stats.sh
index 61eb3ef..8c2c1be 100644
--- a/src/stats.sh
+++ b/src/stats.sh
@@ -3,20 +3,15 @@
show_xipkg_stats () {
printf "${LIGHT_CYAN}${XI}${BLUE}Pkg ${LIGHT_CYAN}$VERSION ${BLUE}on ${LIGHT_BLUE}%s\n" $(cat /etc/hostname)
echo
- printf "${LIGHT_BLACK}%-7s%*s/%s\n" "repo" 10 "installed" "total"
-
- for repo in ${REPOS}; do
-
- local total=0
- local installed=0
- for package in $(list | grep "^$repo/"); do
- total=$((total+1))
- name=${package#$repo/}
- [ -d ${INSTALLED_DIR}/${name} ] &&
- installed=$((installed+1))
- done
-
- printf "${LIGHT_WHITE}%-7s${GREEN}%*s${LIGHT_WHITE}/%s\n" $repo 10 $installed $total
+ printf "${LIGHT_BLACK}%-7s%*s/%s\n" " " 10 "installed" "total"
+ local total=0
+ local installed=0
+ for package in $(list); do
+ total=$((total+1))
+ [ -d ${INSTALLED_DIR}/${package} ] &&
+ installed=$((installed+1))
done
+
+ printf "${LIGHT_WHITE}%-7s${GREEN}%*s${LIGHT_WHITE}/%s\n" "packages" 10 $installed $total
}
diff --git a/src/xi.sh b/src/xi.sh
index 4b66025..12e9243 100755
--- a/src/xi.sh
+++ b/src/xi.sh
@@ -247,9 +247,8 @@ else
usage
;;
*)
- checkroot
- $DO_SYNC && sync
- install $@
+
+ sudo $0 ${DEFAULT_OPTION:-install} $@
;;
esac
fi
diff --git a/xipkg.conf b/xipkg.conf
index 35a7908..565d9cd 100644
--- a/xipkg.conf
+++ b/xipkg.conf
@@ -12,8 +12,6 @@ sources {
davidovski https://xi.davidovski.xyz/repo/
}
-# The sources to download the keys from
-key_authority [
- davidovski
-]
+# the default command to run when no other command could be matched
+default_cmd install