diff --git a/apps/myapp/install b/apps/myapp/install index f9a1c3f..57189f6 100755 --- a/apps/myapp/install +++ b/apps/myapp/install @@ -6,8 +6,6 @@ function error { exit 1 } -false || error 'testing 1 2 3' - #use the error function often! #If a certain command is necessary for installation to continue, then add this to the end of it: # || error 'reason' diff --git a/apps/template/install b/apps/template/install index 3b2f37c..57189f6 100755 --- a/apps/template/install +++ b/apps/template/install @@ -6,8 +6,6 @@ function error { exit 1 } -false || error 'testing 1 2 3' - #use the error function often! #If a certain command is necessary for installation to continue, then add this to the end of it: # || error 'reason' @@ -15,4 +13,4 @@ false || error 'testing 1 2 3' git clone https://example.com || error 'Failed to clone example.com repository!' # Get dependencies -"${DIRECTORY}/pkg-install" "package1 package2 package3" "$(dirname "$0")" || exit 1 \ No newline at end of file +"${DIRECTORY}/pkg-install" "package1 package2 package3" "$(dirname "$0")" || exit 1 diff --git a/binaries/xdotool b/binaries/xdotool deleted file mode 100755 index 4c095b5..0000000 Binary files a/binaries/xdotool and /dev/null differ diff --git a/createapp b/createapp index a1273cf..96adb88 100755 --- a/createapp +++ b/createapp @@ -7,7 +7,7 @@ function error { } #start on this step: -step=3 +step=6 name=myapp while true;do @@ -107,44 +107,28 @@ And yes, the happy face above will be just fine when you erase him. Don'\''t wor #find the best text editor if [ -f /usr/bin/geany ];then - geany "${DIRECTORY}/apps/${name}/uninstall" & - windowname=Geany + geany "${DIRECTORY}/apps/${name}/install" & elif [ -f /usr/bin/mousepad ];then - mousepad "${DIRECTORY}/apps/${name}/uninstall" & - windowname=Mousepad + mousepad "${DIRECTORY}/apps/${name}/install" & elif [ -f /usr/bin/leafpad ];then - leafpad "${DIRECTORY}/apps/${name}/uninstall" & - windowname=Leafpad + leafpad "${DIRECTORY}/apps/${name}/install" & elif [ -f /bin/nano ];then - lxterminal --title=Nano -e "nano ${DIRECTORY}/apps/${name}/uninstall" & - windowname=Nano + lxterminal --title=Nano -e "nano ${DIRECTORY}/apps/${name}/install" & else echo "No text editors found!" fi - #continually save work - - "${DIRECTORY}/binaries/xdotool" search --name geany - exit 0 - #(while true;do "${DIRECTORY}/binaries/xdotool" getwindowname "$windowname" ctrl+s;sleep 1;done) & - pid=$! - echo "pid is $pid" - #kill $pid - output="$(yad --form --on-top \ --title="Create App: Step $step" --window-icon="${DIRECTORY}/icons/logo.png" --center --width=310 --height=300 \ --text='Now it'\''s time to make your install script. This will be executed anytime somebody clicks the Install button. A text editor should have openened and you can create your install script.' \ - --field="Run script":FBTN "lxterminal --title="\""Running install script of $name"\"" -e "\""${DIRECTORY}/apps/${name}/install;echo 'Closing in 10 seconds.';sleep 10"\" \ + --field="Run script":FBTN "lxterminal --title="\""Running install script of $name"\"" -e "\""cd $HOME;${DIRECTORY}/apps/${name}/install;echo 'Closing in 10 seconds.';sleep 10"\" \ --field="Shellcheck"!!'Having problems? This utility helps you locate syntax errors.':FBTN "lxterminal --title="\""Shellcheck"\"" -e "\""${DIRECTORY}/binaries/shellcheck ${DIRECTORY}/apps/${name}/uninstall;echo 'Press Enter to exit.';read enter"\" \ --button=Previous!"${DIRECTORY}/icons/back.png":2 \ --button=Next!"${DIRECTORY}/icons/forward.png":0 \ 2>/dev/null)" button=$? #get exit code to determine which button was pressed - #kill ctrl+s loop - kill $pid - if [ $button == 0 ];then #next - save changes step=4 @@ -162,41 +146,27 @@ A text editor should have openened and you can create your install script.' \ #find the best text editor if [ -f /usr/bin/geany ];then geany "${DIRECTORY}/apps/${name}/uninstall" & - windowname=Geany elif [ -f /usr/bin/mousepad ];then mousepad "${DIRECTORY}/apps/${name}/uninstall" & - windowname=Mousepad elif [ -f /usr/bin/leafpad ];then leafpad "${DIRECTORY}/apps/${name}/uninstall" & - windowname=Leafpad elif [ -f /bin/nano ];then lxterminal --title=Nano -e "nano ${DIRECTORY}/apps/${name}/uninstall" & - windowname=Nano else echo "No text editors found!" fi - #continually save work - (while true;do "${DIRECTORY}/binaries/xdotool" getwindowname "$windowname" ctrl+s;sleep 1;done) & - pid=$! - echo "pid is $pid" - #kill $pid - output="$(yad --form --on-top \ --title="Create App: Step $step" --window-icon="${DIRECTORY}/icons/logo.png" --center --width=310 --height=300 \ --text='Now it'\''s time to make your uninstall script. This will be executed anytime somebody clicks the Uninstall button. A text editor should have openened... Never mind, you know what to do.' \ - --field="Run script":FBTN "lxterminal --title="\""Running uninstall script of $name"\"" -e "\""${DIRECTORY}/apps/${name}/uninstall;echo 'Closing in 10 seconds.';sleep 10"\" \ - --field="Shellcheck"!!'Having problems? This utility helps you locate syntax errors.':FBTN "lxterminal --title="\""Shellcheck"\"" -e "\""${DIRECTORY}/binaries/shellcheck ${DIRECTORY}/apps/${name}/sinstall;echo 'Press Enter to exit.';read enter"\" \ + --field="Run script":FBTN "lxterminal --title="\""Running uninstall script of $name"\"" -e "\""cd $HOME;${DIRECTORY}/apps/${name}/uninstall;echo 'Closing in 10 seconds.';sleep 10"\" \ + --field="Shellcheck"!!'Having problems? This utility helps you locate syntax errors.':FBTN "lxterminal --title="\""Shellcheck"\"" -e "\""${DIRECTORY}/binaries/shellcheck ${DIRECTORY}/apps/${name}/uninstall;echo 'Press Enter to exit.';read enter"\" \ --button=Previous!"${DIRECTORY}/icons/back.png":2 \ --button=Next!"${DIRECTORY}/icons/forward.png":0 \ 2>/dev/null)" button=$? #get exit code to determine which button was pressed - #kill ctrl+s loop - kill $pid - - if [ $button == 0 ];then step=5 elif [ $button == 2 ];then @@ -206,6 +176,57 @@ A text editor should have openened... Never mind, you know what to do.' \ exit 0 fi ;; + 5) + LIST="${DIRECTORY}/icons/uninstalled.png +${DIRECTORY}/apps/${name}/icon-24.png +$name +"\("uninstalled"\)" $(echo "$(cat "${DIRECTORY}/apps/${name}/description" || echo "Description unavailable")" | head -n1)" + + echo -e "$LIST" | yad --list \ + --title="Create App: Step $step" --window-icon="${DIRECTORY}/icons/logo.png" --center --width=310 --height=300 \ + --text='Make sure everything looks right. +Here'\''s what it will look like in the app list:' \ + --column=:IMG --column=:IMG --column=Name --column=tip:HD --tooltip-column=4 --no-headers \ + --button=Previous!"${DIRECTORY}/icons/back.png":2 \ + --button=Next!"${DIRECTORY}/icons/forward.png":0 \ + 2>/dev/null + button=$? #get exit code to determine which button was pressed + + if [ $button == 0 ];then + step=6 + elif [ $button == 2 ];then + step=4 + else + #like clicking the X or something + exit 0 + fi + ;; + 6) + + text="$(echo "$(cat "${DIRECTORY}/apps/${name}/description" || echo "Description unavailable")" | head -n1) +Current status: uninstalled +Website: $(cat "${DIRECTORY}/apps/${name}/website" || echo "unavailable") +$(echo "$(cat "${DIRECTORY}/apps/${name}/description" || echo "Description unavailable")" | grep -v "$(echo "$(cat "${DIRECTORY}/apps/${name}/description" || echo "Description unavailable")" | head -n1)")" + + echo "$text" | yad --text-info --fontname=12 --wrap --show-uri \ + --title="Create App: Step $step" --window-icon="${DIRECTORY}/icons/logo.png" --center --width=700 --height=300 \ + --text='Make sure everything looks right. +Here'\''s a preview of the Details window:' \ + --image="${DIRECTORY}/apps/${name}/icon-64.png" --image-on-top \ + --button=Previous!"${DIRECTORY}/icons/back.png":2 \ + --button=Next!"${DIRECTORY}/icons/forward.png":0 \ + 2>/dev/null + button=$? #get exit code to determine which button was pressed + + if [ $button == 0 ];then + step=7 + elif [ $button == 2 ];then + step=5 + else + #like clicking the X or something + exit 0 + fi + ;; *) error "Unknown step ${step}!" ;; diff --git a/gui b/gui index 227a563..8d45499 100755 --- a/gui +++ b/gui @@ -13,6 +13,11 @@ function error { mkdir -p "${DIRECTORY}/data/installed-packages" "${DIRECTORY}/data/status" +#Variable 1 is used to view the details of the specefied app +if [ ! -z "$1" ];then + output="$1" +fi + while true;do APPS="$(echo "$(ls "${DIRECTORY}/apps")" | grep -v 'template')" @@ -31,13 +36,18 @@ while true;do LIST="$LIST$(echo "${DIRECTORY}/icons/$(cat "${DIRECTORY}/data/status/${i}" || echo "none").png") ${DIRECTORY}/apps/${i}/icon-24.png $i -"\("$(cat "${DIRECTORY}/data/status/${i}" || echo "probably uninstalled")"\)" $(echo "$(cat "${DIRECTORY}/apps/${i}/description" || echo "Description unavailable")" | head -n1) +"\("$(cat "${DIRECTORY}/data/status/${i}" || echo "uninstalled")"\)" $(echo "$(cat "${DIRECTORY}/apps/${i}/description" || echo "Description unavailable")" | head -n1) " done IFS="$PREIFS" LIST="$(echo -e "$LIST")" #echo "$LIST" - if [ -z "$output" ];then + + #if output is not empty then assume button pressed was Details + button=0 + + while [ -z "$output" ] + do output="$(echo -e "$LIST" | yad --center --title='Pi-Apps' --width=310 --height=300 --no-headers \ --list --separator='\n' --window-icon="${DIRECTORY}/icons/logo.png" \ @@ -54,10 +64,16 @@ $i fi echo "Output: ${output}EOO" - else - #if output is not empty then assume button pressed was Details - button=0 + + if [ -z "$output" ];then + echo "output variable empty!" + yad --center --title='Pi-Apps' --width=310 \ + --window-icon="${DIRECTORY}/icons/logo.png" \ + --text="Mind reading is not supported. +(You didn"\'"t select an App)" \ + --button=OK:0 fi + done case $button in @@ -68,10 +84,8 @@ $i 0) echo "Details" - info="$(if [ -f "${DIRECTORY}/data/status/${output}" ];then - echo -n "Current status: " - cat "${DIRECTORY}/data/status/${output}" - fi + info="$(echo -n "Current status: " + cat "${DIRECTORY}/data/status/${output}" || echo 'Uninstalled' if [ ! -z "$(cat "${DIRECTORY}/data/installed-packages/${output}")" ];then echo -n "This app installed these packages: " @@ -84,13 +98,17 @@ $info Website: $(cat "${DIRECTORY}/apps/${output}/website" || echo "unavailable") $(echo "$(cat "${DIRECTORY}/apps/${output}/description" || echo "Description unavailable")" | grep -v "$(echo "$(cat "${DIRECTORY}/apps/${output}/description" || echo "Description unavailable")" | head -n1)")" + #if already installed then no need to provide install button. And vice versa. whichbutton="$( - if [ "$(cat "${DIRECTORY}/data/status/${output}")" == 'installed' ];then + if [ -f "${DIRECTORY}/data/status/${output}" ];then + #Taking a chance here. If status file is nonexistent, assume uninstalled. + echo "--button=Install!${DIRECTORY}/icons/install.png:4" + elif [ "$(cat "${DIRECTORY}/data/status/${output}")" == 'installed' ];then echo "--button=Uninstall!${DIRECTORY}/icons/uninstall.png:2" elif [ "$(cat "${DIRECTORY}/data/status/${output}")" == 'uninstalled' ];then echo "--button=Install!${DIRECTORY}/icons/install.png:4" else - #if status is corrupted or unknown + #if status is corrupted or unknown, then show both buttons echo "--button=Uninstall!${DIRECTORY}/icons/uninstall.png:2 --button=Install!${DIRECTORY}/icons/install.png:4" fi )"