Update shellMen

This commit is contained in:
Maxim 2015-07-25 22:03:49 -05:00
parent 60ac06cd8d
commit 59fb8f8058
1 changed files with 78 additions and 74 deletions

152
shellMen
View File

@ -30,33 +30,33 @@ fi
mainMENU() mainMENU()
{ {
INPUT=/tmp/menu.txt INPUT=/tmp/menu.txt
dialog --clear --backtitle "Shellmen" \ dialog --clear --backtitle "Shellmen" \
--title "[ M A I N - M E N U ]" \ --title "[ M A I N - M E N U ]" \
--menu "Please Select An Option" 16 50 15 \ --menu "Please Select An Option" 16 50 15 \
Accessories "General Programs" \ Accessories "General Programs" \
System "Main System Programs" \ System "Main System Programs" \
Settings "Main System Settings" \ Settings "Main System Settings" \
Multimedia "Audio & Video Programs" \ Multimedia "Audio & Video Programs" \
Graphics "Image Programs" \ Graphics "Image Programs" \
Games "Gaming Programs" \ Games "Gaming Programs" \
Office "Wordprocess & Documents Programs" \ Office "Wordprocess & Documents Programs" \
Development "Programing Programs" \ Development "Programing Programs" \
Internet "Various Internet Related Programs" \ Internet "Various Internet Related Programs" \
Wine "Windows Exe & Program Support" 2>"${INPUT}" Wine "Windows Exe & Program Support" 2>"${INPUT}"
menuitem=$(<"${INPUT}") menuitem=$(<"${INPUT}")
case $menuitem in case $menuitem in
Accessories) bash /tmp/sysMENU/Accessories.sh ;; Accessories) bash /tmp/sysMENU/Accessories.sh ;;
System) bash /tmp/sysMENU/System.sh ;; System) bash /tmp/sysMENU/System.sh ;;
Settings) bash /tmp/sysMENU/Settings.sh ;; Settings) bash /tmp/sysMENU/Settings.sh ;;
Multimedia) bash /tmp/sysMENU/Multimedia.sh ;; Multimedia) bash /tmp/sysMENU/Multimedia.sh ;;
Graphics) bash /tmp/sysMENU/Graphics.sh ;; Graphics) bash /tmp/sysMENU/Graphics.sh ;;
Games) bash /tmp/sysMENU/Game.sh ;; Games) bash /tmp/sysMENU/Game.sh ;;
Office) bash /tmp/sysMENU/Office.sh ;; Office) bash /tmp/sysMENU/Office.sh ;;
Development) bash /tmp/sysMENU/Development.sh ;; Development) bash /tmp/sysMENU/Development.sh ;;
Internet) bash /tmp/sysMENU/Internet.sh ;; Internet) bash /tmp/sysMENU/Internet.sh ;;
Wine) bash /tmp/sysMENU/Wine.sh ;; Wine) bash /tmp/sysMENU/Wine.sh ;;
Exit) echo "Bye!"; break ;; Exit) echo "Bye!"; break ;;
esac esac
} }
startScan() startScan()
@ -80,22 +80,23 @@ mkdir /tmp/sysMENU
touch /tmp/sysMENU/menu.list ; touch /tmp/sysMENU/menu.list ;
sed -i "d" /tmp/sysMENU/menu.list ; sed -i "d" /tmp/sysMENU/menu.list ;
ls /usr/share/applications/ >> /tmp/sysMENU/menu.list ; ls /usr/share/applications/ >> /tmp/sysMENU/menu.list ;
header=$(echo "#!/bin/bash header=$(echo "#!/bin/bash
INPUT=/tmp/menu.txt INPUT=/tmp/menu.txt
dialog --clear --backtitle "\"Shellmen"\" \\ dialog --clear --backtitle "\"Shellmen"\" \\
--title "\"[ S U B - M E N U ]"\" \\ --title "\"[ S U B - M E N U ]"\" \\
--menu "\"Please Select An Option"\" 15 50 10 \\ --menu "\"Please Select An Option"\" 15 50 10 \\
Main_Menu "\"Goes To Main Menu"\" \\") Main_Menu "\"Goes To Main Menu"\" \\")
echo "$header" > /tmp/sysMENU/${accss}.sh echo "$header" > /tmp/sysMENU/${accss}.sh
echo "$header" > /tmp/sysMENU/${dev}.sh echo "$header" > /tmp/sysMENU/${dev}.sh
echo "$header" > /tmp/sysMENU/${gme}.sh echo "$header" > /tmp/sysMENU/${gme}.sh
echo "$header" > /tmp/sysMENU/${int}.sh echo "$header" > /tmp/sysMENU/${int}.sh
echo "$header" > /tmp/sysMENU/${graph}.sh echo "$header" > /tmp/sysMENU/${graph}.sh
echo "$header" > /tmp/sysMENU/${offce}.sh echo "$header" > /tmp/sysMENU/${offce}.sh
echo "$header" > /tmp/sysMENU/${media}.sh echo "$header" > /tmp/sysMENU/${media}.sh
echo "$header" > /tmp/sysMENU/${sys}.sh echo "$header" > /tmp/sysMENU/${sys}.sh
echo "$header" > /tmp/sysMENU/${settngs}.sh echo "$header" > /tmp/sysMENU/${settngs}.sh
echo "$header" > /tmp/sysMENU/${wine}.sh echo "$header" > /tmp/sysMENU/${wine}.sh
menuHeaderInsert; menuHeaderInsert;
} }
@ -103,37 +104,39 @@ menuHeaderInsert()
{ {
x=$(cat /tmp/sysMENU/menu.list | wc -l) >> /dev/null ; # Variable set to number of lines filled in list.txt x=$(cat /tmp/sysMENU/menu.list | wc -l) >> /dev/null ; # Variable set to number of lines filled in list.txt
i="1" i="1"
while [ $i -le $x ]; do
line1=$(sed -n "${i}p" /tmp/sysMENU/menu.list); # Reads the number of lines in list.txt then sets as a variable counting up to variable x while [ $i -le $x ]; do
filename="${line1%.*}" # Reads the number of lines in list.txt then sets as a variable counting up to variable x
execMethod=$(grep -A 0 "Exec=" /usr/share/applications/"$line1") line1=$(sed -n "${i}p" /tmp/sysMENU/menu.list);
catagory=$(grep -A 0 "Categories=" /usr/share/applications/"$line1") filename="${line1%.*}"
preComment=$(grep -A 0 "Comment=" /usr/share/applications/"$line1") execMethod=$(grep -A 0 "Exec=" /usr/share/applications/"$line1")
comment=$(sed s/"Comment="//g <<< ${preComment}) catagory=$(grep -A 0 "Categories=" /usr/share/applications/"$line1")
inputer=$(echo "$filename "\"$comment"\" \\") preComment=$(grep -A 0 "Comment=" /usr/share/applications/"$line1")
if [[ "$catagory" == *"$accss"* ]] || [[ "$catagory" == *"$util"* ]]; then comment=$(sed s/"Comment="//g <<< ${preComment})
echo "$inputer" >> /tmp/sysMENU/${accss}.sh inputer=$(echo "$filename "\"$comment"\" \\")
if [[ "$catagory" == *"$accss"* ]] || [[ "$catagory" == *"$util"* ]]; then
echo "$inputer" >> /tmp/sysMENU/${accss}.sh
elif [[ "$catagory" == *"$dev"* ]]; then elif [[ "$catagory" == *"$dev"* ]]; then
echo "$inputer" >> /tmp/sysMENU/${dev}.sh echo "$inputer" >> /tmp/sysMENU/${dev}.sh
elif [[ "$catagory" == *"$gme"* ]]; then elif [[ "$catagory" == *"$gme"* ]]; then
echo "$inputer" >> /tmp/sysMENU/${gme}.sh echo "$inputer" >> /tmp/sysMENU/${gme}.sh
elif [[ "$catagory" == *"$int"* ]] || [[ "$catagory" == *"$net"* ]] ; then elif [[ "$catagory" == *"$int"* ]] || [[ "$catagory" == *"$net"* ]] ; then
echo "$inputer" >> /tmp/sysMENU/${int}.sh echo "$inputer" >> /tmp/sysMENU/${int}.sh
elif [[ "$catagory" == *"$graph"* ]]; then elif [[ "$catagory" == *"$graph"* ]]; then
echo "$inputer" >> /tmp/sysMENU/${graph}.sh echo "$inputer" >> /tmp/sysMENU/${graph}.sh
elif [[ "$catagory" == *"$offce"* ]]; then elif [[ "$catagory" == *"$offce"* ]]; then
echo "$inputer" >> /tmp/sysMENU/${offce}.sh echo "$inputer" >> /tmp/sysMENU/${offce}.sh
elif [[ "$catagory" == *"$media*" ]] \ elif [[ "$catagory" == *"$media*" ]] \
|| [[ "$catagory" == *"$vid"* ]] \ || [[ "$catagory" == *"$vid"* ]] \
|| [[ "$catagory" == *"$audio"* ]]; then || [[ "$catagory" == *"$audio"* ]]; then
echo "$inputer" >> /tmp/sysMENU/${media}.sh echo "$inputer" >> /tmp/sysMENU/${media}.sh
elif [[ "$catagory" == *"$sys"* ]]; then elif [[ "$catagory" == *"$sys"* ]]; then
echo "$inputer" >> /tmp/sysMENU/${sys}.sh echo "$inputer" >> /tmp/sysMENU/${sys}.sh
elif [[ "$catagory" == *"$settngs"* ]]; then elif [[ "$catagory" == *"$settngs"* ]]; then
echo "$inputer" >> /tmp/sysMENU/${settngs}.sh echo "$inputer" >> /tmp/sysMENU/${settngs}.sh
elif [[ "$catagory" == *"$wine"* ]]; then elif [[ "$catagory" == *"$wine"* ]]; then
echo "$inputer" >> /tmp/sysMENU/${wine}.sh echo "$inputer" >> /tmp/sysMENU/${wine}.sh
fi fi
i=$[$i++1]; i=$[$i++1];
done done
endMenuInsert=$(echo "2>"\"'${INPUT}'"\"") endMenuInsert=$(echo "2>"\"'${INPUT}'"\"")
@ -187,36 +190,37 @@ commandInsert()
{ {
x=$(cat /tmp/sysMENU/menu.list | wc -l) >> /dev/null ; x=$(cat /tmp/sysMENU/menu.list | wc -l) >> /dev/null ;
i="1" i="1"
while [ $i -le $x ]; do
line1=$(sed -n "${i}p" /tmp/sysMENU/menu.list); while [ $i -le $x ]; do
filename="${line1%.*}" line1=$(sed -n "${i}p" /tmp/sysMENU/menu.list);
execMethod=$(grep -A 0 "Exec=" /usr/share/applications/"$line1") filename="${line1%.*}"
catagory=$(grep -A 0 "Categories=" /usr/share/applications/"$line1") execMethod=$(grep -A 0 "Exec=" /usr/share/applications/"$line1")
preComment=$(grep -A 0 "Comment=" /usr/share/applications/"$line1") catagory=$(grep -A 0 "Categories=" /usr/share/applications/"$line1")
execCMD=$(echo "${filename}) exec ${filename} ;;") preComment=$(grep -A 0 "Comment=" /usr/share/applications/"$line1")
if [[ "$catagory" == *"$accss"* ]] || [[ "$catagory" == *"$util"* ]]; then execCMD=$(echo "${filename}) exec ${filename} ;;")
echo "$execCMD" >> /tmp/sysMENU/${accss}.sh if [[ "$catagory" == *"$accss"* ]] || [[ "$catagory" == *"$util"* ]]; then
echo "$execCMD" >> /tmp/sysMENU/${accss}.sh
elif [[ "$catagory" == *"$dev"* ]]; then elif [[ "$catagory" == *"$dev"* ]]; then
echo "$execCMD" >> /tmp/sysMENU/${dev}.sh echo "$execCMD" >> /tmp/sysMENU/${dev}.sh
elif [[ "$catagory" == *"$gme"* ]]; then elif [[ "$catagory" == *"$gme"* ]]; then
echo "$execCMD" >> /tmp/sysMENU/${gme}.sh echo "$execCMD" >> /tmp/sysMENU/${gme}.sh
elif [[ "$catagory" == *"$int"* ]] || [[ "$catagory" == *"$net"* ]] ; then elif [[ "$catagory" == *"$int"* ]] || [[ "$catagory" == *"$net"* ]] ; then
echo "$execCMD" >> /tmp/sysMENU/${int}.sh echo "$execCMD" >> /tmp/sysMENU/${int}.sh
elif [[ "$catagory" == *"$graph"* ]]; then elif [[ "$catagory" == *"$graph"* ]]; then
echo "$execCMD" >> /tmp/sysMENU/${graph}.sh echo "$execCMD" >> /tmp/sysMENU/${graph}.sh
elif [[ "$catagory" == *"$offce"* ]]; then elif [[ "$catagory" == *"$offce"* ]]; then
echo "$execCMD" >> /tmp/sysMENU/${offce}.sh echo "$execCMD" >> /tmp/sysMENU/${offce}.sh
elif [[ "$catagory" == *"$media*" ]] \ elif [[ "$catagory" == *"$media*" ]] \
|| [[ "$catagory" == *"$vid"* ]] \ || [[ "$catagory" == *"$vid"* ]] \
|| [[ "$catagory" == *"$audio"* ]]; then || [[ "$catagory" == *"$audio"* ]]; then
echo "$execCMD" >> /tmp/sysMENU/${media}.sh echo "$execCMD" >> /tmp/sysMENU/${media}.sh
elif [[ "$catagory" == *"$sys"* ]]; then elif [[ "$catagory" == *"$sys"* ]]; then
echo "$execCMD" >> /tmp/sysMENU/${sys}.sh echo "$execCMD" >> /tmp/sysMENU/${sys}.sh
elif [[ "$catagory" == *"$settngs"* ]]; then elif [[ "$catagory" == *"$settngs"* ]]; then
echo "$execCMD" >> /tmp/sysMENU/${settngs}.sh echo "$execCMD" >> /tmp/sysMENU/${settngs}.sh
elif [[ "$catagory" == *"$wine"* ]]; then elif [[ "$catagory" == *"$wine"* ]]; then
echo "$execCMD" >> /tmp/sysMENU/${wine}.sh echo "$execCMD" >> /tmp/sysMENU/${wine}.sh
fi fi
i=$[$i++1]; i=$[$i++1];
done done
echo "esac" >> /tmp/sysMENU/${accss}.sh echo "esac" >> /tmp/sysMENU/${accss}.sh