summaryrefslogtreecommitdiff
path: root/src/install.sh
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-05-04 23:59:42 +0100
committerdavidovski <david@davidovski.xyz>2022-05-04 23:59:42 +0100
commit8758658db49688b7cc7b55603db1b8438775ccc4 (patch)
tree276e74056ff20e3cc8de512c8c681821bedc0ecd /src/install.sh
parent0bc1eda0408ccf230e76928b0db350558bf5d0f4 (diff)
made help screen colorful
Diffstat (limited to 'src/install.sh')
-rw-r--r--src/install.sh36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/install.sh b/src/install.sh
index 3168fdc..1b7fe9a 100644
--- a/src/install.sh
+++ b/src/install.sh
@@ -17,6 +17,7 @@ install_package () {
set -- $(md5sum $pkg_file)
local package_checksum=$1
if [ ! -f $checksum ] || [ "$(cat $checksum)" != "$package_checksum" ]; then
+
[ ! -d $installed_dir ] && mkdir -p "$installed_dir"
[ -f "$files" ] && {
@@ -46,8 +47,7 @@ total_filecount() {
local packages=$@
local count=0
for package in $packages; do
- local name=$(basename $package .xipkg | cut -d. -f2)
- local c=$(get_package_filecount $name)
+ c=$(tar -tvvf $package | grep -v ^d | wc -l)
count=$((count+c))
done
echo $count
@@ -55,26 +55,28 @@ total_filecount() {
run_postinstall () {
postinstall="${SYSROOT}/var/lib/xipkg/postinstall"
- if [ -d $postinstall ]; then
+ [ -d $postinstall ] &&
for f in $(ls $postinstall); do
file=$postinstall/$f
- # run the postinstall file
- #
chmod 755 $file
- if [ "${SYSROOT}" = "/" ]; then
- sh "/var/lib/xipkg/postinstall/$f"
- else
- xichroot ${SYSROOT} "/var/lib/xipkg/postinstall/$f"
- fi
- if [ "$?" = "0" ]; then
+
+ [ "${SYSROOT}" = "/" ] && {
+ sh "/var/lib/xipkg/postinstall/$f" 2> ${LOG_FILE} > ${LOG_FILE}
+
+ } || {
+ xichroot ${SYSROOT} "/var/lib/xipkg/postinstall/$f" 2> ${LOG_FILE} > ${LOG_FILE}
+
+ }
+
+ [ "$?" = "0" ] && {
rm $file &&
- printf "${GREEN}${CHECKMARK} run postinstall for $f!\n"
- else
- printf "${RED}${CROSSMARK} failed running postinstall for $f!\n"
- fi
+ printf "${GREEN}${CHECKMARK} postinstall $f!\n"
+ } || {
+ printf "${RED}${CROSSMARK} failed postinstall $f!\n"
+ }
+
done
- fi
}
@@ -93,8 +95,6 @@ install () {
if [ "${#missing}" != "0" ]; then
${VERBOSE} && printf "${BLACK}couldnt find: $missing\n${RESET}"
- # warning: potential recursion loop here
- get $missing
else
local total=$(total_filecount $packages 2>/dev/null || echo 1)