Update shellMen

set function order properly.
This commit is contained in:
Maxim 2015-07-25 21:55:27 -05:00
parent 3e921cfe9f
commit 60ac06cd8d
1 changed files with 102 additions and 92 deletions

194
shellMen
View File

@ -17,7 +17,18 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
#---------------------------------------------------------------------------------------# #---------------------------------------------------------------------------------------#
mainMENU(){
pre()
{
if [ -d /tmp/sysMENU/ ]; then
mainMENU;
else
startScan;
fi
}
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 ]" \
@ -47,55 +58,49 @@ case $menuitem in
Exit) echo "Bye!"; break ;; Exit) echo "Bye!"; break ;;
esac esac
} }
commandInsert(){
x=$(cat /tmp/sysMENU/menu.list | wc -l) >> /dev/null ; startScan()
i="1" {
while [ $i -le $x ]; do clear
line1=$(sed -n "${i}p" /tmp/sysMENU/menu.list); accss="Accessories"
filename="${line1%.*}" util="Utility"
execMethod=$(grep -A 0 "Exec=" /usr/share/applications/"$line1") media="Multimedia"
catagory=$(grep -A 0 "Categories=" /usr/share/applications/"$line1") vid="Video"
preComment=$(grep -A 0 "Comment=" /usr/share/applications/"$line1") audio="Audio"
execCMD=$(echo "${filename}) exec ${filename} ;;") dev="Development"
if [[ "$catagory" == *"$accss"* ]] || [[ "$catagory" == *"$util"* ]]; then gme="Game"
echo "$execCMD" >> /tmp/sysMENU/${accss}.sh net="Network"
elif [[ "$catagory" == *"$dev"* ]]; then int="Internet"
echo "$execCMD" >> /tmp/sysMENU/${dev}.sh graph="Graphics"
elif [[ "$catagory" == *"$gme"* ]]; then offce="Office"
echo "$execCMD" >> /tmp/sysMENU/${gme}.sh sys="System"
elif [[ "$catagory" == *"$int"* ]] || [[ "$catagory" == *"$net"* ]] ; then settngs="Settings"
echo "$execCMD" >> /tmp/sysMENU/${int}.sh wine="Wine"
elif [[ "$catagory" == *"$graph"* ]]; then mkdir /tmp/sysMENU
echo "$execCMD" >> /tmp/sysMENU/${graph}.sh touch /tmp/sysMENU/menu.list ;
elif [[ "$catagory" == *"$offce"* ]]; then sed -i "d" /tmp/sysMENU/menu.list ;
echo "$execCMD" >> /tmp/sysMENU/${offce}.sh ls /usr/share/applications/ >> /tmp/sysMENU/menu.list ;
elif [[ "$catagory" == *"$media*" ]] \ header=$(echo "#!/bin/bash
|| [[ "$catagory" == *"$vid"* ]] \ INPUT=/tmp/menu.txt
|| [[ "$catagory" == *"$audio"* ]]; then dialog --clear --backtitle "\"Shellmen"\" \\
echo "$execCMD" >> /tmp/sysMENU/${media}.sh --title "\"[ S U B - M E N U ]"\" \\
elif [[ "$catagory" == *"$sys"* ]]; then --menu "\"Please Select An Option"\" 15 50 10 \\
echo "$execCMD" >> /tmp/sysMENU/${sys}.sh Main_Menu "\"Goes To Main Menu"\" \\")
elif [[ "$catagory" == *"$settngs"* ]]; then echo "$header" > /tmp/sysMENU/${accss}.sh
echo "$execCMD" >> /tmp/sysMENU/${settngs}.sh echo "$header" > /tmp/sysMENU/${dev}.sh
elif [[ "$catagory" == *"$wine"* ]]; then echo "$header" > /tmp/sysMENU/${gme}.sh
echo "$execCMD" >> /tmp/sysMENU/${wine}.sh echo "$header" > /tmp/sysMENU/${int}.sh
fi echo "$header" > /tmp/sysMENU/${graph}.sh
i=$[$i++1]; echo "$header" > /tmp/sysMENU/${offce}.sh
done echo "$header" > /tmp/sysMENU/${media}.sh
echo "esac" >> /tmp/sysMENU/${accss}.sh echo "$header" > /tmp/sysMENU/${sys}.sh
echo "esac" >> /tmp/sysMENU/${dev}.sh echo "$header" > /tmp/sysMENU/${settngs}.sh
echo "esac" >> /tmp/sysMENU/${gme}.sh echo "$header" > /tmp/sysMENU/${wine}.sh
echo "esac" >> /tmp/sysMENU/${int}.sh menuHeaderInsert;
echo "esac" >> /tmp/sysMENU/${graph}.sh
echo "esac" >> /tmp/sysMENU/${offce}.sh
echo "esac" >> /tmp/sysMENU/${media}.sh
echo "esac" >> /tmp/sysMENU/${sys}.sh
echo "esac" >> /tmp/sysMENU/${settngs}.sh
echo "esac" >> /tmp/sysMENU/${wine}.sh
chmod +x /tmp/sysMENU/*.sh
mainMENU;
} }
menuHeaderInsert(){
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 while [ $i -le $x ]; do
@ -177,49 +182,54 @@ echo "$preCMD" >> /tmp/sysMENU/${wine}.sh
echo "$menuCall" >> /tmp/sysMENU/${wine}.sh echo "$menuCall" >> /tmp/sysMENU/${wine}.sh
commandInsert; commandInsert;
} }
startScan() {
clear commandInsert()
accss="Accessories" {
util="Utility" x=$(cat /tmp/sysMENU/menu.list | wc -l) >> /dev/null ;
media="Multimedia" i="1"
vid="Video" while [ $i -le $x ]; do
audio="Audio" line1=$(sed -n "${i}p" /tmp/sysMENU/menu.list);
dev="Development" filename="${line1%.*}"
gme="Game" execMethod=$(grep -A 0 "Exec=" /usr/share/applications/"$line1")
net="Network" catagory=$(grep -A 0 "Categories=" /usr/share/applications/"$line1")
int="Internet" preComment=$(grep -A 0 "Comment=" /usr/share/applications/"$line1")
graph="Graphics" execCMD=$(echo "${filename}) exec ${filename} ;;")
offce="Office" if [[ "$catagory" == *"$accss"* ]] || [[ "$catagory" == *"$util"* ]]; then
sys="System" echo "$execCMD" >> /tmp/sysMENU/${accss}.sh
settngs="Settings" elif [[ "$catagory" == *"$dev"* ]]; then
wine="Wine" echo "$execCMD" >> /tmp/sysMENU/${dev}.sh
mkdir /tmp/sysMENU elif [[ "$catagory" == *"$gme"* ]]; then
touch /tmp/sysMENU/menu.list ; echo "$execCMD" >> /tmp/sysMENU/${gme}.sh
sed -i "d" /tmp/sysMENU/menu.list ; elif [[ "$catagory" == *"$int"* ]] || [[ "$catagory" == *"$net"* ]] ; then
ls /usr/share/applications/ >> /tmp/sysMENU/menu.list ; echo "$execCMD" >> /tmp/sysMENU/${int}.sh
header=$(echo "#!/bin/bash elif [[ "$catagory" == *"$graph"* ]]; then
INPUT=/tmp/menu.txt echo "$execCMD" >> /tmp/sysMENU/${graph}.sh
dialog --clear --backtitle "\"Shellmen"\" \\ elif [[ "$catagory" == *"$offce"* ]]; then
--title "\"[ S U B - M E N U ]"\" \\ echo "$execCMD" >> /tmp/sysMENU/${offce}.sh
--menu "\"Please Select An Option"\" 15 50 10 \\ elif [[ "$catagory" == *"$media*" ]] \
Main_Menu "\"Goes To Main Menu"\" \\") || [[ "$catagory" == *"$vid"* ]] \
echo "$header" > /tmp/sysMENU/${accss}.sh || [[ "$catagory" == *"$audio"* ]]; then
echo "$header" > /tmp/sysMENU/${dev}.sh echo "$execCMD" >> /tmp/sysMENU/${media}.sh
echo "$header" > /tmp/sysMENU/${gme}.sh elif [[ "$catagory" == *"$sys"* ]]; then
echo "$header" > /tmp/sysMENU/${int}.sh echo "$execCMD" >> /tmp/sysMENU/${sys}.sh
echo "$header" > /tmp/sysMENU/${graph}.sh elif [[ "$catagory" == *"$settngs"* ]]; then
echo "$header" > /tmp/sysMENU/${offce}.sh echo "$execCMD" >> /tmp/sysMENU/${settngs}.sh
echo "$header" > /tmp/sysMENU/${media}.sh elif [[ "$catagory" == *"$wine"* ]]; then
echo "$header" > /tmp/sysMENU/${sys}.sh echo "$execCMD" >> /tmp/sysMENU/${wine}.sh
echo "$header" > /tmp/sysMENU/${settngs}.sh
echo "$header" > /tmp/sysMENU/${wine}.sh
menuHeaderInsert;
}
pre(){
if [ -d /tmp/sysMENU/ ]; then
mainMENU;
else
startScan;
fi fi
i=$[$i++1];
done
echo "esac" >> /tmp/sysMENU/${accss}.sh
echo "esac" >> /tmp/sysMENU/${dev}.sh
echo "esac" >> /tmp/sysMENU/${gme}.sh
echo "esac" >> /tmp/sysMENU/${int}.sh
echo "esac" >> /tmp/sysMENU/${graph}.sh
echo "esac" >> /tmp/sysMENU/${offce}.sh
echo "esac" >> /tmp/sysMENU/${media}.sh
echo "esac" >> /tmp/sysMENU/${sys}.sh
echo "esac" >> /tmp/sysMENU/${settngs}.sh
echo "esac" >> /tmp/sysMENU/${wine}.sh
chmod +x /tmp/sysMENU/*.sh
mainMENU;
} }
pre; pre;