2015-04-09 21:30:24 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# By Maxim F. Stewart
|
|
|
|
# Contact: [maxim2131@gmail.com] OR [gamer1119@gmail.com]
|
|
|
|
#
|
|
|
|
# Copyright 2013 Maxim F. Stewart
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#---------------------------------------------------------------------------------------#
|
2015-07-26 02:55:27 +00:00
|
|
|
|
|
|
|
pre()
|
|
|
|
{
|
2015-12-10 05:56:29 +00:00
|
|
|
if [ -d /tmp/sysMENU/ ]; then
|
|
|
|
mainMENU;
|
|
|
|
else
|
|
|
|
startScan;
|
|
|
|
fi
|
2015-07-26 02:55:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mainMENU()
|
|
|
|
{
|
2015-04-09 21:40:36 +00:00
|
|
|
INPUT=/tmp/menu.txt
|
2015-07-26 03:03:49 +00:00
|
|
|
dialog --clear --backtitle "Shellmen" \
|
|
|
|
--title "[ M A I N - M E N U ]" \
|
|
|
|
--menu "Please Select An Option" 16 50 15 \
|
|
|
|
Accessories "General Programs" \
|
|
|
|
System "Main System Programs" \
|
|
|
|
Settings "Main System Settings" \
|
|
|
|
Multimedia "Audio & Video Programs" \
|
|
|
|
Graphics "Image Programs" \
|
|
|
|
Games "Gaming Programs" \
|
|
|
|
Office "Wordprocess & Documents Programs" \
|
|
|
|
Development "Programing Programs" \
|
|
|
|
Internet "Various Internet Related Programs" \
|
|
|
|
Wine "Windows Exe & Program Support" 2>"${INPUT}"
|
|
|
|
menuitem=$(<"${INPUT}")
|
|
|
|
case $menuitem in
|
|
|
|
Accessories) bash /tmp/sysMENU/Accessories.sh ;;
|
|
|
|
System) bash /tmp/sysMENU/System.sh ;;
|
|
|
|
Settings) bash /tmp/sysMENU/Settings.sh ;;
|
|
|
|
Multimedia) bash /tmp/sysMENU/Multimedia.sh ;;
|
|
|
|
Graphics) bash /tmp/sysMENU/Graphics.sh ;;
|
|
|
|
Games) bash /tmp/sysMENU/Game.sh ;;
|
|
|
|
Office) bash /tmp/sysMENU/Office.sh ;;
|
|
|
|
Development) bash /tmp/sysMENU/Development.sh ;;
|
|
|
|
Internet) bash /tmp/sysMENU/Internet.sh ;;
|
|
|
|
Wine) bash /tmp/sysMENU/Wine.sh ;;
|
|
|
|
Exit) echo "Bye!"; break ;;
|
|
|
|
esac
|
2015-04-09 21:30:24 +00:00
|
|
|
}
|
2015-07-26 02:55:27 +00:00
|
|
|
|
|
|
|
startScan()
|
|
|
|
{
|
|
|
|
clear
|
|
|
|
accss="Accessories"
|
|
|
|
util="Utility"
|
|
|
|
media="Multimedia"
|
2015-12-10 05:56:29 +00:00
|
|
|
vid="Video"
|
2015-07-26 02:55:27 +00:00
|
|
|
audio="Audio"
|
|
|
|
dev="Development"
|
|
|
|
gme="Game"
|
|
|
|
net="Network"
|
|
|
|
int="Internet"
|
|
|
|
graph="Graphics"
|
|
|
|
offce="Office"
|
|
|
|
sys="System"
|
|
|
|
settngs="Settings"
|
|
|
|
wine="Wine"
|
|
|
|
mkdir /tmp/sysMENU
|
|
|
|
touch /tmp/sysMENU/menu.list ;
|
|
|
|
sed -i "d" /tmp/sysMENU/menu.list ;
|
|
|
|
ls /usr/share/applications/ >> /tmp/sysMENU/menu.list ;
|
2015-07-26 03:03:49 +00:00
|
|
|
|
2015-07-26 02:55:27 +00:00
|
|
|
header=$(echo "#!/bin/bash
|
|
|
|
INPUT=/tmp/menu.txt
|
|
|
|
dialog --clear --backtitle "\"Shellmen"\" \\
|
|
|
|
--title "\"[ S U B - M E N U ]"\" \\
|
|
|
|
--menu "\"Please Select An Option"\" 15 50 10 \\
|
|
|
|
Main_Menu "\"Goes To Main Menu"\" \\")
|
2015-07-26 03:03:49 +00:00
|
|
|
echo "$header" > /tmp/sysMENU/${accss}.sh
|
|
|
|
echo "$header" > /tmp/sysMENU/${dev}.sh
|
|
|
|
echo "$header" > /tmp/sysMENU/${gme}.sh
|
|
|
|
echo "$header" > /tmp/sysMENU/${int}.sh
|
|
|
|
echo "$header" > /tmp/sysMENU/${graph}.sh
|
|
|
|
echo "$header" > /tmp/sysMENU/${offce}.sh
|
|
|
|
echo "$header" > /tmp/sysMENU/${media}.sh
|
|
|
|
echo "$header" > /tmp/sysMENU/${sys}.sh
|
|
|
|
echo "$header" > /tmp/sysMENU/${settngs}.sh
|
|
|
|
echo "$header" > /tmp/sysMENU/${wine}.sh
|
2015-07-26 02:55:27 +00:00
|
|
|
menuHeaderInsert;
|
2015-04-09 21:30:24 +00:00
|
|
|
}
|
2015-07-26 02:55:27 +00:00
|
|
|
|
|
|
|
menuHeaderInsert()
|
|
|
|
{
|
2015-12-10 05:56:29 +00:00
|
|
|
x=$(cat /tmp/sysMENU/menu.list | wc -l) >> /dev/null ;
|
2015-04-09 21:30:24 +00:00
|
|
|
i="1"
|
2015-07-26 03:03:49 +00:00
|
|
|
|
|
|
|
while [ $i -le $x ]; do
|
2015-12-10 05:56:29 +00:00
|
|
|
# Reads the number of lines in list.txt then sets as a variable counting up to variable x
|
2015-07-26 03:03:49 +00:00
|
|
|
line1=$(sed -n "${i}p" /tmp/sysMENU/menu.list);
|
|
|
|
filename="${line1%.*}"
|
|
|
|
execMethod=$(grep -A 0 "Exec=" /usr/share/applications/"$line1")
|
|
|
|
catagory=$(grep -A 0 "Categories=" /usr/share/applications/"$line1")
|
|
|
|
preComment=$(grep -A 0 "Comment=" /usr/share/applications/"$line1")
|
|
|
|
comment=$(sed s/"Comment="//g <<< ${preComment})
|
|
|
|
inputer=$(echo "$filename "\"$comment"\" \\")
|
|
|
|
if [[ "$catagory" == *"$accss"* ]] || [[ "$catagory" == *"$util"* ]]; then
|
2015-12-10 05:56:29 +00:00
|
|
|
echo "$inputer" >> /tmp/sysMENU/${accss}.sh
|
|
|
|
elif [[ "$catagory" == *"$dev"* ]]; then
|
|
|
|
echo "$inputer" >> /tmp/sysMENU/${dev}.sh
|
|
|
|
elif [[ "$catagory" == *"$gme"* ]]; then
|
|
|
|
echo "$inputer" >> /tmp/sysMENU/${gme}.sh
|
|
|
|
elif [[ "$catagory" == *"$int"* ]] || [[ "$catagory" == *"$net"* ]] ; then
|
|
|
|
echo "$inputer" >> /tmp/sysMENU/${int}.sh
|
|
|
|
elif [[ "$catagory" == *"$graph"* ]]; then
|
|
|
|
echo "$inputer" >> /tmp/sysMENU/${graph}.sh
|
|
|
|
elif [[ "$catagory" == *"$offce"* ]]; then
|
|
|
|
echo "$inputer" >> /tmp/sysMENU/${offce}.sh
|
|
|
|
elif [[ "$catagory" == *"$media*" ]] \
|
|
|
|
|| [[ "$catagory" == *"$vid"* ]] \
|
|
|
|
|| [[ "$catagory" == *"$audio"* ]]; then
|
|
|
|
echo "$inputer" >> /tmp/sysMENU/${media}.sh
|
|
|
|
elif [[ "$catagory" == *"$sys"* ]]; then
|
|
|
|
echo "$inputer" >> /tmp/sysMENU/${sys}.sh
|
|
|
|
elif [[ "$catagory" == *"$settngs"* ]]; then
|
|
|
|
echo "$inputer" >> /tmp/sysMENU/${settngs}.sh
|
|
|
|
elif [[ "$catagory" == *"$wine"* ]]; then
|
|
|
|
echo "$inputer" >> /tmp/sysMENU/${wine}.sh
|
2015-07-26 03:03:49 +00:00
|
|
|
fi
|
2015-12-10 05:56:29 +00:00
|
|
|
i=$[$i++1];
|
2015-04-09 21:30:24 +00:00
|
|
|
done
|
2015-12-10 05:56:29 +00:00
|
|
|
|
|
|
|
echo "2>"\"'${INPUT}'"\"" | tee -a /tmp/sysMENU/*.sh
|
|
|
|
echo 'menuitem=$(<"${INPUT}")' | tee -a /tmp/sysMENU/*.sh
|
|
|
|
echo "case \$menuitem in" | tee -a /tmp/sysMENU/*.sh
|
|
|
|
echo "Main_Menu) bash /bin/shellMen ;;" | tee -a /tmp/sysMENU/*.sh
|
|
|
|
|
|
|
|
commandInsert;
|
2015-04-09 21:30:24 +00:00
|
|
|
}
|
2015-07-26 02:55:27 +00:00
|
|
|
|
|
|
|
commandInsert()
|
|
|
|
{
|
|
|
|
x=$(cat /tmp/sysMENU/menu.list | wc -l) >> /dev/null ;
|
|
|
|
i="1"
|
2015-07-26 03:03:49 +00:00
|
|
|
|
|
|
|
while [ $i -le $x ]; do
|
|
|
|
line1=$(sed -n "${i}p" /tmp/sysMENU/menu.list);
|
|
|
|
filename="${line1%.*}"
|
|
|
|
execMethod=$(grep -A 0 "Exec=" /usr/share/applications/"$line1")
|
|
|
|
catagory=$(grep -A 0 "Categories=" /usr/share/applications/"$line1")
|
|
|
|
preComment=$(grep -A 0 "Comment=" /usr/share/applications/"$line1")
|
2015-12-10 05:56:29 +00:00
|
|
|
execCMD=$(echo "${filename}) exec ${filename} & ;;")
|
2015-07-26 03:03:49 +00:00
|
|
|
if [[ "$catagory" == *"$accss"* ]] || [[ "$catagory" == *"$util"* ]]; then
|
2015-12-10 05:56:29 +00:00
|
|
|
echo "$execCMD" >> /tmp/sysMENU/${accss}.sh
|
|
|
|
elif [[ "$catagory" == *"$dev"* ]]; then
|
|
|
|
echo "$execCMD" >> /tmp/sysMENU/${dev}.sh
|
|
|
|
elif [[ "$catagory" == *"$gme"* ]]; then
|
|
|
|
echo "$execCMD" >> /tmp/sysMENU/${gme}.sh
|
|
|
|
elif [[ "$catagory" == *"$int"* ]] || [[ "$catagory" == *"$net"* ]] ; then
|
|
|
|
echo "$execCMD" >> /tmp/sysMENU/${int}.sh
|
|
|
|
elif [[ "$catagory" == *"$graph"* ]]; then
|
|
|
|
echo "$execCMD" >> /tmp/sysMENU/${graph}.sh
|
|
|
|
elif [[ "$catagory" == *"$offce"* ]]; then
|
|
|
|
echo "$execCMD" >> /tmp/sysMENU/${offce}.sh
|
|
|
|
elif [[ "$catagory" == *"$media*" ]] \
|
|
|
|
|| [[ "$catagory" == *"$vid"* ]] \
|
|
|
|
|| [[ "$catagory" == *"$audio"* ]]; then
|
|
|
|
echo "$execCMD" >> /tmp/sysMENU/${media}.sh
|
|
|
|
elif [[ "$catagory" == *"$sys"* ]]; then
|
|
|
|
echo "$execCMD" >> /tmp/sysMENU/${sys}.sh
|
|
|
|
elif [[ "$catagory" == *"$settngs"* ]]; then
|
|
|
|
echo "$execCMD" >> /tmp/sysMENU/${settngs}.sh
|
2015-07-26 03:03:49 +00:00
|
|
|
elif [[ "$catagory" == *"$wine"* ]]; then
|
2015-12-10 05:56:29 +00:00
|
|
|
echo "$execCMD" >> /tmp/sysMENU/${wine}.sh
|
2015-07-26 03:03:49 +00:00
|
|
|
fi
|
2015-12-10 05:56:29 +00:00
|
|
|
i=$[$i++1];
|
|
|
|
done
|
|
|
|
echo "esac" | tee -a /tmp/sysMENU/*.sh
|
|
|
|
chmod +x /tmp/sysMENU/*.sh
|
|
|
|
mainMENU;
|
2015-04-09 21:30:24 +00:00
|
|
|
}
|
2015-04-16 04:39:00 +00:00
|
|
|
pre;
|