From 4bac1f97b9990e70d71639ed1678a4256cc26098 Mon Sep 17 00:00:00 2001 From: davidovski Date: Tue, 31 May 2022 17:47:44 +0100 Subject: added default cmd option --- src/profile.sh | 3 ++- src/query.sh | 2 +- src/stats.sh | 23 +++++++++-------------- src/xi.sh | 5 ++--- 4 files changed, 14 insertions(+), 19 deletions(-) (limited to 'src') 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 -- cgit v1.2.1