From c27df8fa817d2578332ee49ccc79df133fd77f20 Mon Sep 17 00:00:00 2001 From: davidovski Date: Sun, 20 Feb 2022 22:42:46 +0000 Subject: added versioning information --- Makefile | 2 +- src/get.sh | 2 -- src/profile.sh | 3 ++- src/stats.sh | 26 ++++++++++++++++++++++++++ src/xi.sh | 6 +++++- 5 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 src/stats.sh diff --git a/Makefile b/Makefile index 8803333..d021790 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ install: install-config mkdir -p ${DESTDIR}${PREFIX}/lib/xipkg install -m755 ${SOURCE}/*.sh ${DESTDIR}${PREFIX}/lib/xipkg/ install -m755 ${SOURCE}/xi.sh ${DESTDIR}${PREFIX}/bin/xi - + git describe --always > ${DESTDIR}${PREFIX}/lib/xipkg/VERSION install-config: mkdir -p $(DESTDIR)${CONFDIR}/xipkg.d/ diff --git a/src/get.sh b/src/get.sh index e414d07..a5039c1 100755 --- a/src/get.sh +++ b/src/get.sh @@ -148,10 +148,8 @@ get () { for package in $(cat $out); do if package_exists $package; then set -- $(get_package_download_info $package) - url=$1 checksum=$2 size=$3 - files=$4 if is_installed $package; then if [ "$(get_installed_version $package)" != "$checksum" ]; then diff --git a/src/profile.sh b/src/profile.sh index 43e4900..cce8884 100755 --- a/src/profile.sh +++ b/src/profile.sh @@ -4,7 +4,7 @@ export HBAR_COMPLETE="-c ${GREEN}${BG_DEFAULT}" && export HBAR_RED="-c ${BLACK}${BG_RED}" -#. /usr/lib/glyphs.sh +. /usr/lib/glyphs.sh export CONF_FILE="/etc/xipkg.conf" @@ -22,4 +22,5 @@ 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/stats.sh b/src/stats.sh new file mode 100644 index 0000000..b7e927a --- /dev/null +++ b/src/stats.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +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 + + if [ "$repo" = "xi" ]; then + installed=35 + fi + + printf "${LIGHT_WHITE}%-7s${GREEN}%*s${LIGHT_WHITE}/%s\n" $repo 10 $installed $total + + done +} diff --git a/src/xi.sh b/src/xi.sh index 1e240dd..815fd67 100755 --- a/src/xi.sh +++ b/src/xi.sh @@ -60,6 +60,9 @@ EOF [ -z "${LIBDIR}" ] && LIBDIR=/usr/lib/xipkg +[ -f ${LIBDIR}/VERSION ] && VERSION=$(cat ${LIBDIR}/VERSION) || VERSION= +export VERSION + export SYSROOT=/ export CONF_FILE="/etc/xipkg.conf" export VERBOSE=false @@ -106,6 +109,7 @@ done . ${LIBDIR}/util.sh . ${LIBDIR}/validate.sh +. ${LIBDIR}/stats.sh . ${LIBDIR}/query.sh . ${LIBDIR}/sync.sh . ${LIBDIR}/install.sh @@ -116,7 +120,7 @@ done shift $((OPTIND-1)) if [ "$#" = "0" ]; then - echo "xilinux running xipkg (palceholder text)" + show_xipkg_stats else case "$1" in "sync") -- cgit v1.2.1