Skip to content

Commit

Permalink
installer: fix bugs in services menu
Browse files Browse the repository at this point in the history
- all services were being removed because ignored services were only
  ignored in the menu
- tr cannot take a file directly

fixes: #393
  • Loading branch information
classabbyamp committed Jan 10, 2025
1 parent 0b61788 commit ec6c8a4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,10 @@ install_packages() {

menu_services() {
local sv _status _checklist=""
find $TARGETDIR/etc/runit/runsvdir/default -mindepth 1 -maxdepth 1 -xtype d -printf '%f\n' | sort -u > "$TARGET_SERVICES"
# filter out services that probably shouldn't be messed with
local sv_ignore='^(agetty-(tty[1-9]|generic|serial|console)|udevd|sulogin)$'
find $TARGETDIR/etc/runit/runsvdir/default -mindepth 1 -maxdepth 1 -xtype d -printf '%f\n' | \
grep -Ev "$sv_ignore" | sort -u > "$TARGET_SERVICES"
while true; do
while read -r sv; do
if [ -n "$sv" ]; then
Expand All @@ -1275,16 +1278,13 @@ menu_services() {
fi
_checklist+=" ${sv} ${sv} ${_status}"
fi
done < <(find $TARGETDIR/etc/sv -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | \
# filter out services that probably shouldn't be messed with
grep -Ev '^(agetty-(tty[1-9]|generic|serial)|udevd|sulogin)$' | sort -u)
echo "$_checklist" 1>&2
done < <(find $TARGETDIR/etc/sv -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | grep -Ev "$sv_ignore" | sort -u)
DIALOG --no-tags --checklist "Select services to enable:" 20 60 18 ${_checklist}
if [ $? -eq 0 ]; then
comm -13 "$TARGET_SERVICES" <(tr ' ' '\n' "$ANSWER") | while read -r sv; do
comm -13 "$TARGET_SERVICES" <(cat "$ANSWER" | tr ' ' '\n') | while read -r sv; do
enable_service "$sv"
done
comm -23 "$TARGET_SERVICES" <(tr ' ' '\n' "$ANSWER") | while read -r sv; do
comm -23 "$TARGET_SERVICES" <(cat "$ANSWER" | tr ' ' '\n') | while read -r sv; do
disable_service "$sv"
done
break
Expand Down

0 comments on commit ec6c8a4

Please sign in to comment.