app status 'disabled', new runonce

pull/662/head
Botspot 3 years ago
parent 765275e381
commit ad71a5e9b0

53
api

@ -37,14 +37,19 @@ list_apps() { # $1 can be: installed, uninstalled, corrupted, cpu_installable, h
elif [ "$1" == installed ];then
#list installed apps
#list apps| only show ( list of installed apps | remove match string | basename )
#list apps| only show ( list of installed apps | remove match string | basename )
list_apps local | list_intersect "$(grep -rx 'installed' "${DIRECTORY}/data/status" | awk -F: '{print $1}' | sed 's!.*/!!')"
elif [ "$1" == corrupted ];then
#list corrupted apps
#list apps|only show ( list of corrupted apps | remove match string | basename )
#list apps|only show ( list of corrupted apps | remove match string | basename )
list_apps local | list_intersect "$(grep -rx 'corrupted' "${DIRECTORY}/data/status" | awk -F: '{print $1}' | sed 's!.*/!!')"
elif [ "$1" == disabled ];then
#list corrupted apps
#list apps|only show ( list of disabled apps | remove match string | basename )
list_apps local | list_intersect "$(grep -rx 'disabled' "${DIRECTORY}/data/status" | awk -F: '{print $1}' | sed 's!.*/!!')"
elif [ "$1" == uninstalled ];then
#list uninstalled apps
#list apps that have a status file containing "uninstalled"
@ -62,8 +67,8 @@ list_apps() { # $1 can be: installed, uninstalled, corrupted, cpu_installable, h
cat "${DIRECTORY}/data/categories/structure" | grep '|hidden' | awk -F'|' '{print $1}'
elif [ "$1" == visible ];then
#list apps that are in any other category but 'hidden'
cat "${DIRECTORY}/data/categories/structure" | grep -v '|hidden' | awk -F'|' '{print $1}'
#list apps that are in any other category but 'hidden', and aren't disabled
cat "${DIRECTORY}/data/categories/structure" | grep -v '|hidden' | awk -F'|' '{print $1}' # | list_subtract "$(list_apps disabled)"
elif [ "$1" == online ];then
#list apps that exist on the online git repo
@ -222,4 +227,44 @@ script_name() { #returns name of install script(s) for the $1 app. outputs: '',
}
app_status() {
# $1 is app name
[ -z "$1" ] && error 'app_status: $1 variable empty!'
if [ -f "${DIRECTORY}/data/status/${1}" ];then
cat "${DIRECTORY}/data/status/${1}"
else
echo 'uninstalled' #if app status file doesn't exist, assume uninstalled
fi
}
runonce() {
#run a command, only if it's never been run before. Useful for one-time migration or setting changes.
#Runs a script in the form of stdin
script="$(cat /dev/stdin)"
runonce_hash="$(echo "$script" | sha256sum | awk '{print $1}')"
if grep -qx '^'"$runonce_hash"'$' "${DIRECTORY}/data/runonce_hashes" ;then
#hash found
#echo "runonce: '$script' already run before. Skipping."
true
else
#run the script.
bash <(echo "$script")
#if it succeeds, add the hash to the list to never run it again
if [ $? == 0 ];then
echo "$runonce_hash" >> "${DIRECTORY}/data/runonce_hashes"
echo "'$script' succeeded. Added to list."
else
echo "'$script' failed. Not adding hash to list."
fi
fi
}

468
gui

@ -1,4 +1,7 @@
#!/bin/bash
set -a #export all functions and variables for child processes like runonce()
DIRECTORY="$(readlink -f "$(dirname "$0")")"
function error {
@ -6,7 +9,12 @@ function error {
exit 1
}
[ -z "$(yad --help)" ] && error "YAD needs to be installed to run pi-apps."
#for the text_editor(), runonce() and app_status() functions
source "${DIRECTORY}/api" || error "failed to source ${DIRECTORY}/api"
if ! command -v yad &>/dev/null;then
error "YAD needs to be installed to run pi-apps."
fi
echo '|‾‾‾‾\(‾) /‾\
| |‾) |‾| / ⧋ \ |‾'\''‾‾\|‾'\''‾‾\/‾‾‾|
@ -23,101 +31,65 @@ if [ ! -z "$1" ];then
output="$1"
fi
runonce() {
#run a command, only if it's never been run before. Useful for one-time migration or setting changes.
#all arguments is command(s) to run
#hash the command and check if it's already been run before
runonce_hash="$(echo "$@" | sha256sum | awk '{print $1}')"
if grep -q "$runonce_hash" "${DIRECTORY}/data/runonce_hashes" ;then
#hash found
#echo "runonce: '$@' already run before. Skipping."
true
else
#run the command.
bash <(echo "$@")
#if it succeeds, add the hash to the list to never run it again
if [ $? == 0 ];then
echo "$runonce_hash" >> "${DIRECTORY}/data/runonce_hashes"
#echo "'$@' succeeded. Added to list."
else
echo "'$@' failed. Not adding hash to list."
fi
fi
}
#mark wine as installed, if twisteros
runonce "
#mark wine and box86 as installed, if twisteros
runonce <<"EOF"
if [ -f /usr/local/bin/twistver ] && command -v wine >/dev/null ;then
echo 'installed' > '${DIRECTORY}/data/status/Wine (x86)'
fi"
#mark box86 as installed, if twisteros
runonce "
echo 'disabled' > "${DIRECTORY}/data/status/Wine (x86)"
fi
if [ -f /usr/local/bin/twistver ] && command -v box86 >/dev/null ;then
echo 'installed' > '${DIRECTORY}/data/status/Box86'
fi"
#move a bunch of apps to the new multimedia category
runonce "
'${DIRECTORY}/etc/categoryedit' 'Chromium Widevine' Multimedia >/dev/null
'${DIRECTORY}/etc/categoryedit' 'FreeTube' Multimedia >/dev/null
'${DIRECTORY}/etc/categoryedit' 'Sonic Pi 3.2' Multimedia >/dev/null
'${DIRECTORY}/etc/categoryedit' 'TBOPlayer' Multimedia >/dev/null
'${DIRECTORY}/etc/categoryedit' 'WACUP (new WinAmp)' Multimedia >/dev/null
'${DIRECTORY}/etc/categoryedit' 'YouTubuddy' Multimedia >/dev/null"
echo 'disabled' > "${DIRECTORY}/data/status/Box86"
fi
EOF
#move a couple apps to tools category
runonce "
'${DIRECTORY}/etc/categoryedit' 'Snapdrop' Tools >/dev/null
'${DIRECTORY}/etc/categoryedit' 'Node.js' Tools >/dev/null"
#move some apps to the new multimedia category
runonce <<"EOF"
"${DIRECTORY}/etc/categoryedit" "Chromium Widevine" Multimedia >/dev/null
"${DIRECTORY}/etc/categoryedit" "FreeTube" Multimedia >/dev/null
"${DIRECTORY}/etc/categoryedit" "Sonic Pi 3.2" Multimedia >/dev/null
"${DIRECTORY}/etc/categoryedit" "TBOPlayer" Multimedia >/dev/null
"${DIRECTORY}/etc/categoryedit" "WACUP (new WinAmp)" Multimedia >/dev/null
"${DIRECTORY}/etc/categoryedit" "YouTubuddy" Multimedia >/dev/null
"${DIRECTORY}/etc/categoryedit" "OBS Studio" Multimedia >/dev/null
#move some apps to tools category
"${DIRECTORY}/etc/categoryedit" 'Snapdrop' Tools >/dev/null
"${DIRECTORY}/etc/categoryedit" 'Node.js' Tools >/dev/null
EOF
#re-run install script on twistos lite to show select pre-hidden apps
runonce "
if [ -f /usr/local/bin/twistver ] && [[ "\$"(twistver) != 'Twister OS version'* ]];then
'${DIRECTORY}/install'
fi"
#re-run install script on twistos lite to re-show some previously hidden apps
runonce <<"EOF"
if [ -f /usr/local/bin/twistver ] && [[ "$(twistver)" != 'Twister OS version'* ]];then
"${DIRECTORY}/install"
fi
EOF
#remove old apps and migrate chromium downgrading apps to the new "Chromium Downgrade app
runonce "
rm -rf '${DIRECTORY}/apps/Back to Chromium v86'
rm -rf '${DIRECTORY}/apps/Back to Chromium v78'
rm -rf '${DIRECTORY}/apps/FreeCAD (precompiled)'
rm -rf '${DIRECTORY}/apps/Chromium Media Edition'
rm -rf '${DIRECTORY}/apps/Cordless'
rm -rf '${DIRECTORY}/apps/Retropie'
if [ "\$"(cat '${DIRECTORY}/data/status/Back to Chromium v78' 2>/dev/null) == installed ] || [ "\$"(cat '${DIRECTORY}/data/status/Back to Chromium v86' 2>/dev/null) == installed ];then
echo 'installed' > '${DIRECTORY}/data/status/Downgrade Chromium'
#remove old apps and migrate chromium downgrading apps to the new "Chromium Downgrade" app
runonce <<"EOF"
rm -rf "${DIRECTORY}/apps/Back to Chromium v86"
rm -rf "${DIRECTORY}/apps/Back to Chromium v78"
rm -rf "${DIRECTORY}/apps/FreeCAD (precompiled)"
rm -rf "${DIRECTORY}/apps/Chromium Media Edition"
rm -rf "${DIRECTORY}/apps/Cordless"
rm -rf "${DIRECTORY}/apps/Retropie"
if [ "$(cat "${DIRECTORY}/data/status/Back to Chromium v78" 2>/dev/null)" == installed ] || [ "$(cat "${DIRECTORY}/data/status/Back to Chromium v86" 2>/dev/null)" == installed ];then
echo "installed" > "${DIRECTORY}/data/status/Downgrade Chromium"
fi
"
EOF
#rename xlunch setting to xlunch-dark
runonce "
if [ "\"""\$"(cat '${DIRECTORY}/data/settings/App List Style')"\"" == xlunch ];then
echo 'xlunch-dark' > '${DIRECTORY}/data/settings/App List Style'
runonce <<"EOF"
if [ "$(cat "${DIRECTORY}/data/settings/App List Style")" == xlunch ];then
echo 'xlunch-dark' > "${DIRECTORY}/data/settings/App List Style"
fi
"
EOF
#for old installs prior to having categories, re-run install script
runonce "
if [ ! -e '${DIRECTORY}/data/categories' ];then
'${DIRECTORY}/install'
fi
"
#on twisteros, prevent the updating of wine and steam
runonce "
if [ -f /usr/local/bin/twistver ]; then
echo -e '\napps/Wine (x86)/' >> '${DIRECTORY}/data/update-exclusion'
echo -e 'apps/Steam' >> '${DIRECTORY}/data/update-exclusion'
runonce <<"EOF"
if [ ! -e "${DIRECTORY}/data/categories" ];then
"${DIRECTORY}/install"
fi
"
#for the text_editor() function
source "${DIRECTORY}/api"
EOF
install() {
app="$1" #one app name per line
@ -272,8 +244,8 @@ while true;do
#check for an exit status code from the running terminal
while true; do
if [ -f /tmp/xlunchfinished ];then
break
echo "xlunch finished installing."
break
elif [ -f /tmp/xlunchfailed ];then
#revert back to yad
echo 'yad' > "{DIRECTORY}/data/settings/App List Style"
@ -365,171 +337,183 @@ $LIST"
#output variable populated
case $button in
1)
echo "User exited."
exit 0
;;
3)
echo "Back"
prefix="$(dirname "$prefix" | tr -d '.')"
;;
0)
echo "Details"
if echo "$output" | grep -q '/' ;then
#folder
if [ "$output" == './' ];then
echo "Back"
prefix="$(dirname "$prefix" | tr -d '.')"
else
prefix="$prefix/$output"
prefix="${prefix::-1}"
prefix="$(echo "$prefix" | sed 's+^/++')"
fi
echo "Prefix is $prefix"
output=''
1)
echo "User exited."
exit 0
;;
3)
echo "Back"
prefix="$(dirname "$prefix" | tr -d '.')"
;;
0)
echo "Details"
if echo "$output" | grep -q '/' ;then
#folder
if [ "$output" == './' ];then
echo "Back"
prefix="$(dirname "$prefix" | tr -d '.')"
else
#app
output="$(echo "$output" | head -n1)"
if [ -f "${DIRECTORY}/data/installed-packages/${output}" ] && [ ! -z "$(cat "${DIRECTORY}/data/installed-packages/${output}")" ];then
installedpackages="
prefix="$prefix/$output"
prefix="${prefix::-1}"
prefix="$(echo "$prefix" | sed 's+^/++')"
fi
echo "Prefix is $prefix"
output=''
else
#app
output="$(echo "$output" | head -n1)"
if [ -f "${DIRECTORY}/data/installed-packages/${output}" ] && [ ! -z "$(cat "${DIRECTORY}/data/installed-packages/${output}")" ];then
installedpackages="
This app installed these packages: $(cat "${DIRECTORY}/data/installed-packages/${output}" | sort | uniq | tr '\n' ' ')"
else
installedpackages=''
fi
#text below the app icon
description="$(cat "${DIRECTORY}/apps/${output}/description" || echo 'Description unavailable')$installedpackages"
#text to the right of the app icon
abovetext="<b>$output</b>
- Current status: $(echo "$(cat "${DIRECTORY}/data/status/${output}" || echo 'Uninstalled')" | sed 's/corrupted/corrupted (installation failed)/g')"
if [ -f "${DIRECTORY}/apps/${output}/website" ];then
#show website if it exists
abovetext="$abovetext
- Website: <a href="\""$(cat "${DIRECTORY}/apps/${output}/website" | head -n1)"\"">$(cat "${DIRECTORY}/apps/${output}/website" | head -n1)</a>"
fi
if [ -z "$clicklist" ];then
source "${DIRECTORY}/api"
clicklist="$(usercount)"
fi
usercount="$(echo "$clicklist" | grep " $output"'$' | awk '{print $1}' | head -n1)"
if [ ! -z "$usercount" ] && [ "$usercount" -gt 20 ];then
abovetext="$abovetext
- <b>$(printf "%'d" "$usercount")</b> users"
if [ "$usercount" -ge 1500 ] && [ "$usercount" -lt 10000 ];then
#if a lot of users, add an exclamation point!
abovetext="${abovetext}!"
elif [ "$usercount" -ge 10000 ];then
#if a crazy number of users, add two exclamation points!
abovetext="${abovetext}!!"
fi
fi
#array holding various buttons that may be passed to yad
whichbutton=()
if [ "$(cat "${DIRECTORY}/data/settings/Show Edit button")" == 'Yes' ];then
#if edit button enabled, show it
whichbutton+=("--button=Edit!${DIRECTORY}/icons/edit.png!Make changes to the app:8")
fi
if [ -f "${DIRECTORY}/apps/${output}/credits" ];then
#if credits file exists, display credits button
whichbutton+=("--button=Credits!!See who made the app and who put it on Pi-Apps:10")
fi
if [ ! -f "${DIRECTORY}/data/status/${output}" ];then
#If status file is nonexistent, assume uninstalled.
whichbutton+=("--button=!${DIRECTORY}/icons/install.png:4")
elif [ "$(cat "${DIRECTORY}/data/status/${output}")" == 'installed' ];then
#if installed, display uninstall button
whichbutton+=("--button=!${DIRECTORY}/icons/uninstall.png:2")
elif [ "$(cat "${DIRECTORY}/data/status/${output}")" == 'uninstalled' ];then
#if uninstalled, display install button
whichbutton+=("--button=!${DIRECTORY}/icons/install.png:4")
else
#if status is corrupted or unknown, then show both buttons
whichbutton+=("--button=!${DIRECTORY}/icons/uninstall.png:2" "--button=!${DIRECTORY}/icons/install.png:4")
fi
else
installedpackages=''
fi
#text below the app icon
description="$(cat "${DIRECTORY}/apps/${output}/description" || echo 'Description unavailable')$installedpackages"
#text to the right of the app icon
abovetext="<b>$output</b>
- Current status: $(echo "$(app_status "${output}")" | sed 's/corrupted/corrupted (installation failed)/g' | sed 's/disabled/disabled (installation is prevented on your system)/g')"
if [ -f "${DIRECTORY}/apps/${output}/website" ];then
#show website if it exists
abovetext="$abovetext
- Website: <a href="\""$(cat "${DIRECTORY}/apps/${output}/website" | head -n1)"\"">$(cat "${DIRECTORY}/apps/${output}/website" | head -n1)</a>"
echo "$description" | yad --text-info --fontname=12 --wrap --show-uri --text="$(echo "$abovetext" | sed 's/&/&amp;/g')" \
--image="${DIRECTORY}/apps/${output}/icon-64.png" --image-on-top \
--title="Details of ${output}" --window-icon="${DIRECTORY}/icons/logo.png" --center --width=700 --height=300 \
--button=Back!"${DIRECTORY}/icons/back.png":0 \
--button=Scripts!"${DIRECTORY}/icons/shellscript.png"!"Feel free to see how an app is installed!"$'\n'"Perfect for learning or troubleshooting.":6 \
"${whichbutton[@]}"
button=$? #get exit code to determine which button was pressed
echo "Button: ${button}"
fi
if [ -z "$clicklist" ];then
source "${DIRECTORY}/api"
clicklist="$(usercount)"
fi
usercount="$(echo "$clicklist" | grep " $output"'$' | awk '{print $1}' | head -n1)"
if [ ! -z "$usercount" ] && [ "$usercount" -gt 20 ];then
abovetext="$abovetext
- <b>$(printf "%'d" "$usercount")</b> users"
if [ $button == 0 ];then
echo 'Back' #do nothing, as user requested to go back
#clear app var
output=''
elif [ $button == 4 ];then
app="$output"
install "$app"
elif [ $button == 2 ];then
app="$output"
uninstall "$app"
elif [ $button == 6 ];then
app="$output"
#determine path to app's install script
if [ -f "${DIRECTORY}/apps/${app}/install-${arch}" ];then
install_script="${DIRECTORY}/apps/${app}/install-${arch}"
elif [ -f "${DIRECTORY}/apps/${app}/install" ];then
install_script="${DIRECTORY}/apps/${app}/install"
fi
uninstall_script="${DIRECTORY}/apps/${app}/uninstall"
text_editor "$uninstall_script" &
sleep 0.1
text_editor "$install_script" &
elif [ $button == 8 ];then
echo "edit $output"
"${DIRECTORY}/createapp" "$output"
elif [ $button == 10 ];then
echo "credits of $output"
cat "${DIRECTORY}/apps/${output}/credits" | yad --text-info --fontname=12 --wrap \
--image="${DIRECTORY}/apps/${output}/icon-64.png" --image-on-top \
--title="Credits of ${output}" --window-icon="${DIRECTORY}/icons/logo.png" --center --width=700 --height=300 \
--button=Close!"${DIRECTORY}/icons/exit.png":0
else
echo 'unknown button. Exiting now.'
exit 0
if [ "$usercount" -ge 1500 ] && [ "$usercount" -lt 10000 ];then
#if a lot of users, add an exclamation point!
abovetext="${abovetext}!"
elif [ "$usercount" -ge 10000 ];then
#if a crazy number of users, add two exclamation points!
abovetext="${abovetext}!!"
fi
fi
;;
2)
#uninstall
if ! echo "$output" | grep -q '/' ;then
uninstall "$output"
#clear output var to prompt main window to open next
else
motd="Sorry, you can"\'"t uninstall folders."
prefix=''
#array holding various buttons that may be passed to yad
whichbutton=()
if [ "$(cat "${DIRECTORY}/data/settings/Show Edit button")" == 'Yes' ];then
#if edit button enabled, show it
whichbutton+=("--button=Edit!${DIRECTORY}/icons/edit.png!Make changes to the app:8")
fi
output=''
;;
4)
#install
if ! echo "$output" | grep -q '/' ;then
install "$output"
#clear output var to prompt main window to open next
if [ -f "${DIRECTORY}/apps/${output}/credits" ];then
#if credits file exists, display credits button
whichbutton+=("--button=Credits!!See who made the app and who put it on Pi-Apps:10")
fi
#display buttons based on app's status file
if [ "$(app_status "${output}")" == 'installed' ];then
#if installed, display uninstall button
whichbutton+=("--button=!${DIRECTORY}/icons/uninstall.png:2")
elif [ "$(app_status "${output}")" == 'uninstalled' ];then
#if uninstalled, display install button
whichbutton+=("--button=!${DIRECTORY}/icons/install.png:4")
elif [ "$(app_status "${output}")" == 'disabled' ];then
#if disabled, display no buttons
whichbutton+=("--button=<b>Enable</b>!!Force this app to install on your system."$'\n'"This app was disabled for a reason so if you enable it..."$'\n'"YOU HAVE BEEN WARNED.:12")
else
motd="Sorry, you can"\'"t install folders."
prefix=''
#if status is corrupted or unknown, then show both buttons
whichbutton+=("--button=!${DIRECTORY}/icons/uninstall.png:2" "--button=!${DIRECTORY}/icons/install.png:4")
fi
output=''
;;
*)
error "Unknown button: $button"
echo "$description" | yad --text-info --fontname=12 --wrap --show-uri --text="$(echo "$abovetext" | sed 's/&/&amp;/g')" \
--image="${DIRECTORY}/apps/${output}/icon-64.png" --image-on-top \
--title="Details of ${output}" --window-icon="${DIRECTORY}/icons/logo.png" --center --width=700 --height=300 \
--button=Back!"${DIRECTORY}/icons/back.png":0 \
--button=Scripts!"${DIRECTORY}/icons/shellscript.png"!"Feel free to see how an app is installed!"$'\n'"Perfect for learning or troubleshooting.":6 \
"${whichbutton[@]}"
button=$? #get exit code to determine which button was pressed
echo "Button: ${button}"
case $button in
0)
echo 'Back' #do nothing, as user requested to go back
#clear app var
output=''
;;
4)
app="$output"
install "$app"
;;
2)
app="$output"
uninstall "$app"
;;
6)
app="$output"
#determine path to app's install script
if [ -f "${DIRECTORY}/apps/${app}/install-${arch}" ];then
install_script="${DIRECTORY}/apps/${app}/install-${arch}"
elif [ -f "${DIRECTORY}/apps/${app}/install" ];then
install_script="${DIRECTORY}/apps/${app}/install"
fi
uninstall_script="${DIRECTORY}/apps/${app}/uninstall"
text_editor "$uninstall_script" &
sleep 0.1
text_editor "$install_script" &
;;
8)
echo "edit $output"
"${DIRECTORY}/createapp" "$output"
;;
10)
echo "credits of $output"
cat "${DIRECTORY}/apps/${output}/credits" | yad --text-info --fontname=12 --wrap \
--image="${DIRECTORY}/apps/${output}/icon-64.png" --image-on-top \
--title="Credits of ${output}" --window-icon="${DIRECTORY}/icons/logo.png" --center --width=700 --height=300 \
--button=Close!"${DIRECTORY}/icons/exit.png":0
;;
12)
echo "Enabling $output..."
app="$output"
#remove status file containing 'disabled'
rm -f "${DIRECTORY}/data/status/${app}"
;;
*)
error 'unknown button. Exiting now.'
exit 1
;;
esac
fi
;;
2)
#uninstall
if ! echo "$output" | grep -q '/' ;then
uninstall "$output"
#clear output var to prompt main window to open next
else
motd="Sorry, you can't uninstall folders."
prefix=''
fi
output=''
;;
4)
#install
if ! echo "$output" | grep -q '/' ;then
install "$output"
#clear output var to prompt main window to open next
else
motd="Sorry, you can"\'"t install folders."
prefix=''
fi
output=''
;;
*)
error "Unknown button: $button"
;;
esac
done

@ -14,6 +14,8 @@ if [ -z "$1" ];then
error "You need to specify an operation, and in most cases, which app to operate on."
fi
source "${DIRECTORY}/api" || error "failed to source ${DIRECTORY}/api"
mkdir -p "${DIRECTORY}/data/status" "${DIRECTORY}/data/update-status"
#determine if host system is 64 bit arm64 or 32 bit armhf
@ -26,12 +28,13 @@ else
fi
dirhash() {
#find "${DIRECTORY}/update/pi-apps/apps/${2}" -type f -print0
#echo "Hashing this dir: $1" 1>&2
#------ hash every file in the folder ---------------- and add to it the filesystem list ------ hash it again
hash="$(echo -e "$(find "$1" -type f -print0 | xargs -0 sha1sum | awk '{print $1}')$(find "$1" -type f -exec basename {} \;)" | sha1sum | awk '{print $1}')"
#-------- hash every file in the folder and display the filenames --------------- hash all that again
hash="$(echo -e "$(find "$1" -type f -print0 2>/dev/null | xargs -0 sha1sum)" | sha1sum | awk '{print $1}')"
echo "$hash"
}
if [ "$1" == 'multi-install' ];then
failed=0
PREIFS="$IFS"
@ -112,8 +115,17 @@ elif [ "$1" == 'install' ];then
error "${DIRECTORY}/apps/$app does not exist!"
fi
#ensure not a disabled app
if [ -f "${DIRECTORY}/data/status/${app}" ] && [ "$(cat "${DIRECTORY}/data/status/${app}")" == 'disabled' ];then
echo -e "\e[93mNot installing the $app app. IT IS DISABLED.\e[39m"
sleep 1
echo 'Waiting 5 seconds...'
sleep 5
exit 0
fi
#if already installed then ask for confirmation
if [ "$(cat "${DIRECTORY}/data/status/${app}" 2>/dev/null)" == 'installed' ];then
if [ "$(app_status "${app}")" == 'installed' ];then
yad --text="$app is already installed. Are you sure you want to install it again?" \
--text-align=center --center --title='Quick question' --window-icon="${DIRECTORY}/icons/logo.png" \
--button=No!"${DIRECTORY}/icons/exit.png":1 --button=Yes!"${DIRECTORY}/icons/check.png":0 || exit 0
@ -158,7 +170,7 @@ elif [ "$1" == 'uninstall' ];then
fi
#if already uninstalled then ask for confirmation
if [ "$(cat "${DIRECTORY}/data/status/${app}" 2>/dev/null)" == 'uninstalled' ];then
if [ "$(app_status "${app}")" == 'uninstalled' ];then
yad --text="$app is already uninstalled. Are you sure you want to uninstall it again?" \
--text-align=center --center --title='Quick question' --window-icon="${DIRECTORY}/icons/logo.png" \
--button=No!"${DIRECTORY}/icons/exit.png":1 --button=Yes!"${DIRECTORY}/icons/check.png":0 || exit 0
@ -223,7 +235,7 @@ elif [ "$1" == 'update' ];then
#else
installback=no
#if install was changed #if installed already
if [ "$newinstallhash" != "$oldinstallhash" ] && [ "$(cat "${DIRECTORY}/data/status/${app}" 2>/dev/null)" == 'installed' ];then
if [ "$newinstallhash" != "$oldinstallhash" ] && [ "$(app_status "${app}")" == 'installed' ];then
installback=yes
echo "$app's install script has been updated. Reinstalling $app..."
#uninstall it using a recursive script instance
@ -293,7 +305,7 @@ elif [ "$1" == 'check-all' ];then
#echo -e "newhash: $newhash\noldhash: $oldhash" 1>&2
if [ "$newhash" == "$oldhash" ];then
echo -e "${app} is identical\e[90m to the online version. Nothing to do!\e[39m" 1>&2
#echo -e "${app} is identical\e[90m to the online version. Nothing to do!\e[39m" 1>&2
echo 'latest' > "${DIRECTORY}/data/update-status/${app}"
else
if [ ! -d "${DIRECTORY}/apps/${app}" ];then

Loading…
Cancel
Save