Skip to content

Commit

Permalink
Remember user choice for frontail remove prompt (openhab#1980)
Browse files Browse the repository at this point in the history
* Remember user choice for frontail remove prompt

Fixes openhab#1963

* Remove extra if statement
* Add formal option to openhabian.conf for frontail
* Use variable to reference config file

---------

Signed-off-by: Ethan Dye <[email protected]>
  • Loading branch information
ecdye authored Feb 22, 2025
1 parent 736ee50 commit 38550c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions build-image/openhabian.conf
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ java_opt=17
# Valid arguments: raspios, raspbian, debian, ubuntu, stretch, buster, bullseye, bookworm, bionic, focal
# osrelease=

# Remember user frontail choice
# frontail_remove=true

# install zram per default, set to "disable" to skip installation
zraminstall=enable
zram_reset=done # remove when zram is no longer needed to auto update
Expand Down
6 changes: 5 additions & 1 deletion functions/nodejs-apps.bash
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ frontail_remove() {
local frontailBase
local frontailDir="/opt/frontail"
local removeText="Frontail is a log viewer that is not maintained and has security issues. As of openHAB 4.3 there is a built in log viewer which replaces it.\\n\\nWould you like to remove it from your system? If not, be aware that it is not recommended to use it and is no longer a supported feature of openHABian."
local rememberChoice="Would you like to remember this choice for future runs of openHABian?"

frontailBase="$(npm list -g | head -n 1)/node_modules/frontail"

if ! dpkg --compare-versions "$(sed -n 's/openhab-distro\s*: //p' /var/lib/openhab/etc/version.properties)" gt "4.3.0"; then return 0; fi
if [[ -z $INTERACTIVE ]]; then return 0; fi
if [[ -z $INTERACTIVE ]] || [[ -n $frontail_remove ]]; then return 0; fi


if [[ -d $frontailBase ]] || [[ -d $frontailDir ]]; then
Expand All @@ -100,6 +101,9 @@ frontail_remove() {
cond_redirect sed -i -e "/frontail-link/d" "/etc/openhab/services/runtime.cfg"
fi
if cond_redirect systemctl -q daemon-reload; then echo "OK"; else echo "FAILED (daemon-reload)"; return 1; fi
elif (whiptail --title "Frontail Removal" --yes-button "Don't show again" --no-button "Keep showing" --yesno "$rememberChoice" 10 84); then
# shellcheck source=/etc/openhabian.conf disable=SC2154
sed -i -e "s/^.*frontail_remove.*$/frontail_remove=true/g" "${configFile}"
fi
fi
}
Expand Down

0 comments on commit 38550c4

Please sign in to comment.