Compare commits

...

3 Commits

Author SHA1 Message Date
9484fff9f8 buildiso: handle s6 DM in proper lib (#154)
All checks were successful
Artools shellcheck / lint (push) Successful in 1m14s
Reviewed-on: #154
Co-authored-by: Artoo <artoo@artixlinux.org>
Co-committed-by: Artoo <artoo@artixlinux.org>
2025-08-26 17:11:44 +02:00
1e2e5f44e1 buildiso: add s6 service error handling
All checks were successful
Artools shellcheck / lint (push) Successful in 41s
2025-08-22 15:42:18 +02:00
764d47ad8f buildiso: add service error handling
All checks were successful
Artools shellcheck / lint (push) Successful in 1m37s
2025-08-22 15:11:38 +02:00
3 changed files with 34 additions and 27 deletions

View File

@@ -21,8 +21,4 @@ rootfs:
# optional
# livefs:
# packages: []
# packages-init:
# dinit: []
# openrc: []
# runit: []
# s6: []

View File

@@ -57,7 +57,6 @@ load_pkgs(){
local packages_root
local packages_live
local packages_root_init
local packages_live_init
local common_key_init=".packages-init.${INITSYS}[]"
local root_key_init=".rootfs.packages-init.${INITSYS}[]"
@@ -70,12 +69,12 @@ load_pkgs(){
msg2 "Loading Packages: [%s] ..." "common.packages-base"
mapfile -t common_base < <(yq -P '.packages-base[]' "$common_yaml")
msg2 "Loading Packages: [%s] ..." "common.packages-apps"
mapfile -t common_apps < <(yq -P '.packages-apps[]' "$common_yaml")
msg2 "Loading Packages: [%s] ..." "common.packages-init.${INITSYS}"
mapfile -t common_init < <(common_key_init="$common_key_init" yq -P 'eval(strenv(common_key_init))' "$common_yaml")
msg2 "Loading Packages: [%s] ..." "common.packages-apps"
mapfile -t common_apps < <(yq -P '.packages-apps[]' "$common_yaml")
if "${HAS_LIVE}"; then
if ${USE_XLIBRE}; then
msg2 "Loading Packages: [%s] ..." "common.packages-xlibre"
@@ -94,8 +93,8 @@ load_pkgs(){
packages+=(
"${common_base[@]}"
"${common_apps[@]}"
"${common_init[@]}"
"${common_apps[@]}"
"${packages_root[@]}"
"${packages_root_init[@]}"
)
@@ -105,25 +104,13 @@ load_pkgs(){
"${common_xorg}"
)
fi
for svc in "${SERVICES[@]}"; do
case "$svc" in
sddm|gdm|lightdm|mdm|greetd|lxdm|xdm)
display_manager="$svc"
;;
esac
done
;;
livefs)
msg2 "Loading Packages: [%s] ..." "livefs.packages"
mapfile -t packages_live < <(yq -P '.livefs.packages[]' "$profile_yaml")
msg2 "Loading Packages: [%s] ..." "livefs.packages-init.${INITSYS}"
mapfile -t packages_live_init < <(live_key_init="$live_key_init" yq -P 'eval(strenv(live_key_init))' "$profile_yaml")
packages+=(
"${packages_live[@]}"
"${packages_live_init[@]}"
)
;;
bootfs)

View File

@@ -10,6 +10,8 @@ add_svc_openrc(){
if [[ -f $mnt/etc/init.d/$svc ]];then
msg2 "Setting %s: [%s]" "${INITSYS}" "$svc"
chroot "$mnt" rc-update add "$svc" "$rlvl" &>/dev/null
else
warning "Service %s not found. Skipping." "$svc"
fi
done
}
@@ -23,6 +25,8 @@ add_user_svc_openrc(){
chroot "$mnt" mkdir -p /home/"${LIVEUSER}/$rc"
chroot "$mnt" ln -s /etc/user/init.d/"$svc" /home/"${LIVEUSER}/$rc/$svc"
chroot "$mnt" chown -R "${LIVEUSER}:${LIVEUSER}" /home/"${LIVEUSER}"/.config/rc
else
warning "Service %s not found. Skipping." "$svc"
fi
done
}
@@ -33,20 +37,36 @@ add_svc_runit(){
if [[ -d $mnt/etc/runit/sv/$svc ]]; then
msg2 "Setting %s: [%s]" "${INITSYS}" "$svc"
chroot "$mnt" ln -s /etc/runit/sv/"$svc" /etc/runit/runsvdir/"$rlvl" &>/dev/null
else
warning "Service %s not found. Skipping." "$svc"
fi
done
}
add_svc_s6(){
local mnt="$1" rlvl="${2:-default}" dep
local display_manager
local supported_dms=(sddm gdm lightdm mdm greetd lxdm xdm)
for dm in "${supported_dms[@]}"; do
if in_array "$dm" "${SERVICES[@]}"; then
display_manager="$dm"
fi
done
dep="$mnt"/etc/s6/sv/"$display_manager"-srv/dependencies.d
for svc in "${SERVICES[@]}"; do
msg2 "Setting %s: [%s]" "${INITSYS}" "$svc"
chroot "$mnt" s6-service add "$rlvl" "$svc"
if [[ "$svc" == "$display_manager" ]]; then
if [[ -d "$dep" ]]; then
touch "$dep"/artix-live
if [[ -d "$mnt"/etc/s6/sv/"$svc" ]] || [[ -d "$mnt"/etc/s6/sv/"$svc"-srv ]]; then
chroot "$mnt" s6-service add "$rlvl" "$svc"
if [[ "$svc" == "$display_manager" ]]; then
if [[ -d "$dep" ]]; then
touch "$dep"/artix-live
fi
fi
else
warning "Service %s not found. Skipping." "$svc"
fi
done
@@ -63,9 +83,11 @@ add_svc_s6(){
add_svc_dinit(){
local mnt="$1"
for svc in "${SERVICES[@]}"; do
if [[ -d $mnt/etc/dinit.d/boot.d ]]; then
if [[ -f "$mnt"/etc/dinit.d/"$svc" ]]; then
msg2 "Setting %s: [%s]" "${INITSYS}" "$svc"
chroot "$mnt" dinitctl enable -o "$svc" &>/dev/null
else
warning "Service %s not found. Skipping." "$svc"
fi
done
}
@@ -79,6 +101,8 @@ add_user_svc_dinit(){
chroot "$mnt" mkdir -p "$usr_sv"/boot.d
chroot "$mnt" ln -s /etc/dinit.d/user/"$svc" "$usr_sv"/boot.d/"$svc"
chroot "$mnt" chown -R "${LIVEUSER}:${LIVEUSER}" "$usr_sv"
else
warning "Service %s not found. Skipping." "$svc"
fi
done
}