Skip to content

Commit f725cf5

Browse files
authored
Merge pull request #47 from D8ATech/release/3.2.0
Release/3.2.0
2 parents 16a1336 + c3ad23c commit f725cf5

File tree

2 files changed

+80
-5
lines changed

2 files changed

+80
-5
lines changed

inc/helper.inc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,19 @@ function rmdir(){
189189
fi
190190
}
191191

192+
function deleteSystem(){
193+
if [[ -z $1 ]]; then
194+
echo "nothing to be removed"
195+
else
196+
if [ -d "$1" ]; then
197+
# delete the line below
198+
# echo "$1 will be removed"
199+
# uncomment the line below so that files are actually deleted
200+
sudo rm -rf "$1"
201+
fi
202+
fi
203+
}
204+
192205
function cleanupExit(){
193206
debugwrite ">>> cleanupExit"
194207
rmfile "$OUTPUT"

piwizard.sc

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ -f "inc/adminpanel.inc" ]; then
55
. inc/adminpanel.inc
66
fi
77

8-
__version="3.1.0"
8+
__version="3.2.0"
99

1010
[[ "$__debug" -eq 1 ]] && set -x
1111

@@ -133,12 +133,11 @@ function mainmenu(){
133133
--menu "" $MENUHEIGHT $MENUWIDTH $MENUITEMS \
134134
Rom-Downloads "Get your Roms " \
135135
SRD "Single ROM Download" \
136+
Delete "Delete Full Systems" \
136137
__ " " \
137138
Colors "Customize Your Launcher Colors" \
138-
Backup-Restore "Backup or Restore ROMS from HDD" \
139139
Utility-Scripts "Optional Utility Scripts" \
140140
Disk-Space "SD Card Disk Space" \
141-
Music "Grab a Music Pack" \
142141
Get-Support "View Support Methods" \
143142
__ " " \
144143
Reboot "Reboot" \
@@ -156,12 +155,11 @@ function mainmenu(){
156155
--menu "" $MENUHEIGHT $MENUWIDTH $MENUITEMS \
157156
Rom-Downloads "Get your Roms " \
158157
SRD "Single ROM Download" \
158+
Delete "Delete Full Systems" \
159159
__ " " \
160160
Colors "Customize Your Launcher Colors" \
161-
Backup-Restore "Backup or Restore ROMS from HDD" \
162161
Utility-Scripts "Optional Utility Scripts" \
163162
Disk-Space "SD Card Disk Space" \
164-
Music "Grab a Music Pack - PRO" \
165163
Upgrade-to-Pro "Compare Standard to Pro" \
166164
Get-Support "View Support Methods" \
167165
__ " " \
@@ -194,6 +192,7 @@ function mainmenu(){
194192
SCRIPTRUNNING=TRUE;;
195193
Upgrade-to-Pro) upgrade;;
196194
SRD) singlerom;;
195+
Delete) deleteSystemsMenu;;
197196
Reboot) rebt;;
198197
Exit) exitLauncher;;
199198
Back) ONERUNNING="FALSE";;
@@ -658,6 +657,69 @@ function colormenu(){
658657
COLORRUNNING="TRUE"
659658
}
660659

660+
############################################################
661+
## Delete Systems Menu
662+
##
663+
############################################################
664+
665+
function deleteSystemsMenu() {
666+
if [[ -n "$systemNames" ]]; then
667+
unset systemNames
668+
fi
669+
670+
if [[ -n $options ]]; then
671+
unset $options
672+
fi
673+
counter=0
674+
cd /home/pi/RetroPie/roms
675+
676+
for f in *; do
677+
if [ -d ${f} ]; then
678+
systemName=$(echo "$f")
679+
if [[ "$systemName" != "piwizard" ]]; then
680+
if [[ "$systemName" != "dev" ]]; then
681+
if [[ "$systemName" != "music" ]]; then
682+
systemNames+=("$systemName")
683+
options+=("$systemName" "$counter" "off")
684+
let counter=counter+1
685+
fi
686+
fi
687+
fi
688+
fi
689+
done
690+
691+
if [ $counter -eq 0 ]; then
692+
display_output 10 40 "There are no systems to be deleted"
693+
else
694+
if [[ -n $choices ]]; then
695+
unset choices
696+
fi
697+
698+
choices=$(dialog --backtitle "Select the systems you want to delete" \
699+
--title "Remove Systems from PiWizard" --clear \
700+
--checklist "Available Systems" 20 61 $counter \
701+
"${options[@]}" \
702+
2>&1 >/dev/tty)
703+
704+
case $choices in
705+
1)
706+
echo "Cancel pressed - $choices";;
707+
255)
708+
echo "ESC pressed";;
709+
*)
710+
arr=( $choices )
711+
dialog --title "Are you sure?" \
712+
--yesno "These Systems will be removed.\n$choices\nYou will need to restart your sytem.\nAre you sure you want to do this?" 8 60
713+
response=$?
714+
715+
case $response in
716+
0) for i in "${arr[@]}"; do deleteSystem $i; done;;
717+
*) download="False";;
718+
esac
719+
;;
720+
esac
721+
fi
722+
}
661723
############################################################
662724
## Scripts Menu
663725
##

0 commit comments

Comments
 (0)