settings: fix hidden options. grep -v -> grep -vx

pull/569/head
Botspot 5 years ago
parent 434ecea824
commit 9e80d92b54

@ -6,18 +6,16 @@ function error {
exit 1
}
exitloop=''
while [ -z $exitloop ];do
#ensure settings dir exists
if [ ! -d "${DIRECTORY}/data/settings" ];then
#ensure settings dir exists
if [ ! -d "${DIRECTORY}/data/settings" ];then
echo "creating settings directory"
mkdir -p "${DIRECTORY}/data/settings"
#create default files inside
echo '' > "${DIRECTORY}/data/settings/reinstall-after-update"
fi
fi
#$1 is usually left blank. If it equals 'refresh', then empty settings will be created and then the script will exit.
if [ "$1" == 'refresh' ];then
#$1 is usually left blank. If it equals 'refresh', then empty settings will be created and then the script will exit.
if [ "$1" == 'refresh' ];then
#set default settings, if they don't exist
settings="$(ls "${DIRECTORY}/etc/setting-params" | tr '\n' '|')"
PREIFS="$IFS"
@ -30,10 +28,10 @@ while [ -z $exitloop ];do
done
IFS="$PREIFS"
exit 0
fi
fi
#$1 is usually left blank. If it equals 'revert', then overwrite all settings with the defaults and then the script will exit.
if [ "$1" == 'revert' ];then
#$1 is usually left blank. If it equals 'revert', then overwrite all settings with the defaults and then the script will exit.
if [ "$1" == 'revert' ];then
#overwrite all settings with the defaults
settings="$(ls "${DIRECTORY}/etc/setting-params" | tr '\n' '|')"
PREIFS="$IFS"
@ -44,20 +42,23 @@ while [ -z $exitloop ];do
done
IFS="$PREIFS"
exit 0
fi
fi
if [ ! -f ~/.local/share/applications/pi-apps-settings.desktop ];then
if [ ! -f ~/.local/share/applications/pi-apps-settings.desktop ];then
echo "Creating Settings menu button"
echo "[Desktop Entry]
Name=Pi Apps Settings
Comment=Configure Pi-Apps or create an App
Exec=${DIRECTORY}/settings
Icon=${DIRECTORY}/icons/logo.png
Terminal=false
Type=Application
Categories=Settings;" > ~/.local/share/applications/pi-apps-settings.desktop
Name=Pi Apps Settings
Comment=Configure Pi-Apps or create an App
Exec=${DIRECTORY}/settings
Icon=${DIRECTORY}/icons/logo.png
Terminal=false
Type=Application
Categories=Settings;" > ~/.local/share/applications/pi-apps-settings.desktop
fi
fi
exitloop=''
while [ -z $exitloop ];do
settings="$(ls "${DIRECTORY}/etc/setting-params" | tr '\n' '|')"
yadparams=''
@ -77,7 +78,7 @@ while [ -z $exitloop ];do
#order params, with selected option first
params="$(echo "$params" | grep -x "$curval")
$(echo "$params" | grep -v "$curval")"
$(echo "$params" | grep -vx "$curval")"
params="$(echo "$params" | tr '\n' '!')"
params="${params::-1}"

Loading…
Cancel
Save