more updates

pull/7/head
Botspot 4 years ago
parent 190dbd046d
commit 332cf9f687

21
gui

@ -1,6 +1,18 @@
#!/bin/bash
DIRECTORY="$(readlink -f "$(dirname "$0")")"
echo "$DIRECTORY"
function error {
echo -e "\e[91m$1\e[39m"
exit 1
}
[ -z $(yad --help) ] && error "YAD needs to be installed to run pi-apps."
#check for updates in background
"${DIRECTORY}/updater" &
mkdir -p "${DIRECTORY}/data/installed-packages" "${DIRECTORY}/data/status"
while true;do
APPS="$(echo "$(ls "${DIRECTORY}/apps")" | grep -v 'template')"
@ -25,7 +37,7 @@ $i
IFS="$PREIFS"
LIST="$(echo -e "$LIST")"
#echo "$LIST"
output="$(echo -e "$LIST" | yad --center --title='Pi-Apps' --width=300 --height=300 --no-headers \
output="$(echo -e "$LIST" | yad --center --title='Pi-Apps' --width=310 --height=300 --no-headers \
--list --separator='\n' --window-icon="${DIRECTORY}/icons/logo.png" \
--column=:IMG --column=:IMG --column=Name --column=tip:HD --print-column=3 --tooltip-column=4 \
--button=Install!"${DIRECTORY}/icons/install.png":4 \
@ -47,7 +59,6 @@ $i
echo "Error"
exit 1
;;
0)
echo "Details"
@ -73,7 +84,6 @@ $(echo "$(cat "${DIRECTORY}/apps/${output}/description" || echo "Description una
--button=Uninstall!"${DIRECTORY}/icons/uninstall.png":2 \
--button=Back!"${DIRECTORY}/icons/back.png":0
;;
2)
echo "Uninstall"
"${DIRECTORY}/manage" uninstall "$output"
@ -82,5 +92,8 @@ $(echo "$(cat "${DIRECTORY}/apps/${output}/description" || echo "Description una
echo "Install"
"${DIRECTORY}/manage" install "$output"
;;
*)
error "Unknown button: $button"
;;
esac
done

@ -1,23 +1,21 @@
#!/bin/bash
#has newline chars to display properly
packagelist="$(echo "yad" | tr ' ' '\n')"
function error {
echo -e "\e[91m$1\e[39m"
exit 1
}
DIRECTORY="$(readlink -f "$(dirname "$0")")"
echo -e "$packagelist" | zenity --title='Pi-Apps' --window-icon="${DIRECTORY}/icons/logo.png" \
--list --text=" These packages are required but not installed. \n Install them now?" \
--ok-label=Yes --cancel-label=No \
--column=foo --hide-header 2>/dev/null
button=$?
if [ -z "$(dpkg-query -W --showformat='${Status}\n' yad 2>/dev/null | grep "install ok installed")" ];then
zenity --title='Pi-Apps' --window-icon="${DIRECTORY}/icons/logo.png" \
--list --text="YAD is required but not installed. \n Install now?" \
--ok-label=Yes --cancel-label=No \
--column=foo --hide-header 2>/dev/null || error "User declined."
#echo $button
if [ ! $button -eq 0 ];then
echo "User declined."
exit 1
lxterminal --title="Installing YAD" -e "sudo apt install -y yad;echo -e '\nClosing in 5 seconds.';sleep 5"
fi
#else
lxterminal --title="Installing $packagelist" -e "sudo apt install -y $PKG_LIST;echo -e '\nInstallation finished.\nClosing in 5 seconds.';sleep 5"
echo "Creating menu button..."
echo -n '' > ${HOME}/.local/share/applications/pi-apps.desktop
@ -29,3 +27,8 @@ Icon=${DIRECTORY}/icons/logo.png
Terminal=false
Type=Application
Categories=Utility;" >> ${HOME}/.local/share/applications/pi-apps.desktop
cp -f ${HOME}/.local/share/applications/pi-apps.desktop ${HOME}/Desktop/pi-apps.desktop
echo "Installation complete."

@ -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
mkdir -p "${DIRECTORY}/data/status"
if [ "$1" == 'install' ];then
#INSTALL
#for this operation, a program name must be specified.

@ -61,7 +61,10 @@ do
fi
done
mkdir
#save that list of installed packages in the program directory for future removal
mkdir -p "${DIRECTORY}/data/installed-packages"
echo "$INSTALL_LIST" >> "${DIRECTORY}/data/installed-packages/${PRG}"
if [ ! -z "$INSTALL_LIST" ];then

@ -0,0 +1,24 @@
#!/bin/bash
function error {
echo -e "\e[91m$1\e[39m"
exit 1
}
DIRECTORY="$(readlink -f "$(dirname "$0")")"
if [ -z "$(dpkg-query -W --showformat='${Status}\n' yad 2>/dev/null | grep "install ok installed")" ];then
zenity --title='Pi-Apps' --window-icon="${DIRECTORY}/icons/logo.png" \
--list --text="Do you want to uninstall YAD?" \
--ok-label=Yes --cancel-label=No \
--column=foo --hide-header 2>/dev/null && lxterminal --title="Uninstalling YAD" -e "sudo apt purge -y yad;echo -e '\nClosing in 5 seconds.';sleep 5"
fi
echo "Removing menu button..."
rm -f ${HOME}/.local/share/applications/pi-apps.desktop
rm -f ${HOME}/Desktop/pi-apps.desktop
echo -e "\e[32mUninstallation complete.
\e[97mIf Pi-apps didn"\'"t work for you, \e[4m\e[21m\e[5mPLEASE\e[0m\e[97m consider submitting a \e[1mbug report\e[0m!
--> \e[96mhttps://github.com/Botspot/pi-apps/issues/new\e[39m"

@ -7,6 +7,18 @@ function error {
exit 1
}
#if updates not checked for today, then check for updates now
if [ -f "${DIRECTORY}/data/last-update-check" ] && [ "$(date +%j)" == "$(cat "${DIRECTORY}/data/last-update-check")" ];then
echo "Already checked for updates today, so no need to check again.
To forcibly check for updates now, either delete ${DIRECTORY}/data/last-update-check,
or press any key within the next 20 seconds."
read -n 1 -t 20 || exit 0
echo ''
fi
#write today's date to file. Format is "number of days since jan 1"
echo "$(date +%j)" > "${DIRECTORY}/data/last-update-check"
#generate app update status info
updatable="$("${DIRECTORY}/manage" check-all | tail -1)"
@ -79,11 +91,11 @@ fi
LIST="${LIST::-1}"
#echo "List: ${LIST}EOL"
echo -e "$LIST" | yad --center --title='Pi-Apps' --width=300 --height=300 --no-headers \
echo -e "$LIST" | yad --center --title='Pi-Apps' --width=310 --height=300 --no-headers \
--list --separator='\n' --window-icon="${DIRECTORY}/icons/logo.png" \
--text='Updates available:' \
--column=:IMG --column=Name \
--button=Cancel!"${DIRECTORY}/icons/exit.png":1 \
--button='Later'!"${DIRECTORY}/icons/exit.png"!'Remind me tomorrow':1 \
--button='Update now'!"${DIRECTORY}/icons/download.png":0 \
2>/dev/null
Loading…
Cancel
Save