Update shellMen
Cleaned up code, tried to match bash standards, cleared useless comments.
This commit is contained in:
parent
58b354afa4
commit
3e921cfe9f
76
shellMen
76
shellMen
|
@ -48,10 +48,10 @@ case $menuitem in
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
commandInsert(){
|
commandInsert(){
|
||||||
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 ;
|
||||||
i="1"
|
i="1"
|
||||||
while [ $i -le $x ]; do
|
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
|
line1=$(sed -n "${i}p" /tmp/sysMENU/menu.list);
|
||||||
filename="${line1%.*}"
|
filename="${line1%.*}"
|
||||||
execMethod=$(grep -A 0 "Exec=" /usr/share/applications/"$line1")
|
execMethod=$(grep -A 0 "Exec=" /usr/share/applications/"$line1")
|
||||||
catagory=$(grep -A 0 "Categories=" /usr/share/applications/"$line1")
|
catagory=$(grep -A 0 "Categories=" /usr/share/applications/"$line1")
|
||||||
|
@ -59,34 +59,25 @@ preComment=$(grep -A 0 "Comment=" /usr/share/applications/"$line1")
|
||||||
execCMD=$(echo "${filename}) exec ${filename} ;;")
|
execCMD=$(echo "${filename}) exec ${filename} ;;")
|
||||||
if [[ "$catagory" == *"$accss"* ]] || [[ "$catagory" == *"$util"* ]]; then
|
if [[ "$catagory" == *"$accss"* ]] || [[ "$catagory" == *"$util"* ]]; then
|
||||||
echo "$execCMD" >> /tmp/sysMENU/${accss}.sh
|
echo "$execCMD" >> /tmp/sysMENU/${accss}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$dev"* ]]; then
|
||||||
if [[ "$catagory" == *"$dev"* ]]; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/${dev}.sh
|
echo "$execCMD" >> /tmp/sysMENU/${dev}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$gme"* ]]; then
|
||||||
if [[ "$catagory" == *"$gme"* ]]; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/${gme}.sh
|
echo "$execCMD" >> /tmp/sysMENU/${gme}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$int"* ]] || [[ "$catagory" == *"$net"* ]] ; then
|
||||||
if [[ "$catagory" == *"$int"* ]] || [[ "$catagory" == *"$net"* ]] ; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/${int}.sh
|
echo "$execCMD" >> /tmp/sysMENU/${int}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$graph"* ]]; then
|
||||||
if [[ "$catagory" == *"$graph"* ]]; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/${graph}.sh
|
echo "$execCMD" >> /tmp/sysMENU/${graph}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$offce"* ]]; then
|
||||||
if [[ "$catagory" == *"$offce"* ]]; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/${offce}.sh
|
echo "$execCMD" >> /tmp/sysMENU/${offce}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$media*" ]] \
|
||||||
if [[ "$catagory" == *"$media*" ]] \
|
|
||||||
|| [[ "$catagory" == *"$vid"* ]] \
|
|| [[ "$catagory" == *"$vid"* ]] \
|
||||||
|| [[ "$catagory" == *"$audio"* ]]; then
|
|| [[ "$catagory" == *"$audio"* ]]; then
|
||||||
echo "$execCMD" >> /tmp/sysMENU/${media}.sh
|
echo "$execCMD" >> /tmp/sysMENU/${media}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$sys"* ]]; then
|
||||||
if [[ "$catagory" == *"$sys"* ]]; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/${sys}.sh
|
echo "$execCMD" >> /tmp/sysMENU/${sys}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$settngs"* ]]; then
|
||||||
if [[ "$catagory" == *"$settngs"* ]]; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/${settngs}.sh
|
echo "$execCMD" >> /tmp/sysMENU/${settngs}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$wine"* ]]; then
|
||||||
if [[ "$catagory" == *"$wine"* ]]; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/${wine}.sh
|
echo "$execCMD" >> /tmp/sysMENU/${wine}.sh
|
||||||
fi
|
fi
|
||||||
i=$[$i++1];
|
i=$[$i++1];
|
||||||
|
@ -102,7 +93,7 @@ echo "esac" >> /tmp/sysMENU/${sys}.sh
|
||||||
echo "esac" >> /tmp/sysMENU/${settngs}.sh
|
echo "esac" >> /tmp/sysMENU/${settngs}.sh
|
||||||
echo "esac" >> /tmp/sysMENU/${wine}.sh
|
echo "esac" >> /tmp/sysMENU/${wine}.sh
|
||||||
chmod +x /tmp/sysMENU/*.sh
|
chmod +x /tmp/sysMENU/*.sh
|
||||||
mainMENU
|
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
|
||||||
|
@ -117,34 +108,25 @@ comment=$(sed s/"Comment="//g <<< ${preComment})
|
||||||
inputer=$(echo "$filename "\"$comment"\" \\")
|
inputer=$(echo "$filename "\"$comment"\" \\")
|
||||||
if [[ "$catagory" == *"$accss"* ]] || [[ "$catagory" == *"$util"* ]]; then
|
if [[ "$catagory" == *"$accss"* ]] || [[ "$catagory" == *"$util"* ]]; then
|
||||||
echo "$inputer" >> /tmp/sysMENU/${accss}.sh
|
echo "$inputer" >> /tmp/sysMENU/${accss}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$dev"* ]]; then
|
||||||
if [[ "$catagory" == *"$dev"* ]]; then
|
|
||||||
echo "$inputer" >> /tmp/sysMENU/${dev}.sh
|
echo "$inputer" >> /tmp/sysMENU/${dev}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$gme"* ]]; then
|
||||||
if [[ "$catagory" == *"$gme"* ]]; then
|
|
||||||
echo "$inputer" >> /tmp/sysMENU/${gme}.sh
|
echo "$inputer" >> /tmp/sysMENU/${gme}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$int"* ]] || [[ "$catagory" == *"$net"* ]] ; then
|
||||||
if [[ "$catagory" == *"$int"* ]] || [[ "$catagory" == *"$net"* ]] ; then
|
|
||||||
echo "$inputer" >> /tmp/sysMENU/${int}.sh
|
echo "$inputer" >> /tmp/sysMENU/${int}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$graph"* ]]; then
|
||||||
if [[ "$catagory" == *"$graph"* ]]; then
|
|
||||||
echo "$inputer" >> /tmp/sysMENU/${graph}.sh
|
echo "$inputer" >> /tmp/sysMENU/${graph}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$offce"* ]]; then
|
||||||
if [[ "$catagory" == *"$offce"* ]]; then
|
|
||||||
echo "$inputer" >> /tmp/sysMENU/${offce}.sh
|
echo "$inputer" >> /tmp/sysMENU/${offce}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$media*" ]] \
|
||||||
if [[ "$catagory" == *"$media*" ]] \
|
|
||||||
|| [[ "$catagory" == *"$vid"* ]] \
|
|| [[ "$catagory" == *"$vid"* ]] \
|
||||||
|| [[ "$catagory" == *"$audio"* ]]; then
|
|| [[ "$catagory" == *"$audio"* ]]; then
|
||||||
echo "$inputer" >> /tmp/sysMENU/${media}.sh
|
echo "$inputer" >> /tmp/sysMENU/${media}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$sys"* ]]; then
|
||||||
if [[ "$catagory" == *"$sys"* ]]; then
|
|
||||||
echo "$inputer" >> /tmp/sysMENU/${sys}.sh
|
echo "$inputer" >> /tmp/sysMENU/${sys}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$settngs"* ]]; then
|
||||||
if [[ "$catagory" == *"$settngs"* ]]; then
|
|
||||||
echo "$inputer" >> /tmp/sysMENU/${settngs}.sh
|
echo "$inputer" >> /tmp/sysMENU/${settngs}.sh
|
||||||
fi
|
elif [[ "$catagory" == *"$wine"* ]]; then
|
||||||
if [[ "$catagory" == *"$wine"* ]]; then
|
|
||||||
echo "$inputer" >> /tmp/sysMENU/${wine}.sh
|
echo "$inputer" >> /tmp/sysMENU/${wine}.sh
|
||||||
fi
|
fi
|
||||||
i=$[$i++1];
|
i=$[$i++1];
|
||||||
|
@ -193,7 +175,7 @@ echo "$endMenuInsert" >> /tmp/sysMENU/${wine}.sh
|
||||||
echo "$menuitmVar" >> /tmp/sysMENU/${wine}.sh
|
echo "$menuitmVar" >> /tmp/sysMENU/${wine}.sh
|
||||||
echo "$preCMD" >> /tmp/sysMENU/${wine}.sh
|
echo "$preCMD" >> /tmp/sysMENU/${wine}.sh
|
||||||
echo "$menuCall" >> /tmp/sysMENU/${wine}.sh
|
echo "$menuCall" >> /tmp/sysMENU/${wine}.sh
|
||||||
commandInsert
|
commandInsert;
|
||||||
}
|
}
|
||||||
startScan() {
|
startScan() {
|
||||||
clear
|
clear
|
||||||
|
@ -212,9 +194,9 @@ sys="System"
|
||||||
settngs="Settings"
|
settngs="Settings"
|
||||||
wine="Wine"
|
wine="Wine"
|
||||||
mkdir /tmp/sysMENU
|
mkdir /tmp/sysMENU
|
||||||
touch /tmp/sysMENU/menu.list ; # Creates a temp txt file called menu.list in the temp folder of root
|
touch /tmp/sysMENU/menu.list ;
|
||||||
sed -i "d" /tmp/sysMENU/menu.list ; # Clears the file menu.list to rcv new info
|
sed -i "d" /tmp/sysMENU/menu.list ;
|
||||||
ls /usr/share/applications/ >> /tmp/sysMENU/menu.list ; # lists current dir files to 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"\" \\
|
||||||
|
@ -231,13 +213,13 @@ 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;
|
||||||
}
|
}
|
||||||
pre(){
|
pre(){
|
||||||
if [ -d /tmp/sysMENU/ ]; then
|
if [ -d /tmp/sysMENU/ ]; then
|
||||||
mainMENU
|
mainMENU;
|
||||||
else
|
else
|
||||||
startScan
|
startScan;
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
pre
|
pre;
|
||||||
|
|
Loading…
Reference in New Issue