Skip to content

Commit 35fe213

Browse files
committed
[fix] : Fixed cups service
1 parent a35b3b8 commit 35fe213

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

channels/share/airootfs.any/root/customize_airootfs.sh

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -282,20 +282,34 @@ sed -i -r "s/(GRUB_DISTRIBUTOR=).*/\1\"${grub_os_name}\"/g" "/etc/default/grub"
282282
run_additional_command "gtk-update-icon-cache" "gtk-update-icon-cache -f /usr/share/icons/hicolor"
283283

284284

285+
# systemctl helper
286+
# Execute the subcommand only when the specified unit is available.
287+
# Usage: _systemd_service <systemctl subcommand> <service1> <service2> ...
288+
_systemd_service(){
289+
local _service
290+
local _command="${1}"
291+
shift 1
292+
for _service in "${@}"; do
293+
if [[ -f "$(systemctl cat "${_service}" 2> "/dev/null" | head -n 1 | tail | sed 's|# ||g')" ]]; then
294+
systemctl ${_command} "${_service}"
295+
fi
296+
done
297+
}
298+
285299
# Enable graphical.
286-
systemctl set-default graphical.target
300+
_systemd_service set-default graphical.target
287301

288302

289303
# Enable services.
290-
systemctl enable pacman-init.service
291-
systemctl enable org.cups.cupsd.service
292-
systemctl enable NetworkManager.service
293-
systemctl enable alteriso-reflector.service
294-
systemctl disable reflector.service
304+
_systemd_service enable pacman-init.service
305+
_systemd_service enable cups.service
306+
_systemd_service enable NetworkManager.service
307+
_systemd_service enable alteriso-reflector.service
308+
_systemd_service disable reflector.service
295309

296310

297311
# TLP
298312
# See ArchWiki for details.
299-
systemctl enable tlp.service
300-
systemctl mask systemd-rfkill.service
301-
systemctl mask systemd-rfkill.socket
313+
_systemd_service enable tlp.service
314+
_systemd_service mask systemd-rfkill.service
315+
_systemd_service mask systemd-rfkill.socket

0 commit comments

Comments
 (0)