Prepare installer for ISO-owned finalization
This commit is contained in:
@@ -5,6 +5,7 @@ systemctl enable cups-browsed.service
|
||||
systemctl enable avahi-daemon.service
|
||||
systemctl enable linux-modules-cleanup.service
|
||||
systemctl enable docker.socket
|
||||
systemctl enable systemd-resolved.service
|
||||
systemctl enable NetworkManager.service
|
||||
systemctl enable power-profiles-daemon.service
|
||||
systemctl enable sddm.service
|
||||
|
||||
@@ -10,8 +10,43 @@ ufw allow 53317/tcp
|
||||
ufw allow in proto udp from 172.16.0.0/12 to 172.17.0.1 port 53 comment 'allow-docker-dns'
|
||||
ufw allow in proto udp from 192.168.0.0/16 to 172.17.0.1 port 53 comment 'allow-docker-dns'
|
||||
|
||||
# Turn on Docker protections.
|
||||
ufw-docker install
|
||||
# Turn on Docker protections. ufw-docker refuses to install its after.rules
|
||||
# block unless UFW is already active, but during ISO finalization the target
|
||||
# chroot shares the live installer's kernel firewall. Keep the live firewall
|
||||
# untouched: for this config-file-only install action, satisfy ufw-docker's
|
||||
# status preflight without activating UFW.
|
||||
install_ufw_docker_rules() {
|
||||
local shim_dir status ufw_docker_bin
|
||||
|
||||
ufw_docker_bin=$(command -v ufw-docker)
|
||||
shim_dir=$(mktemp -d)
|
||||
cat >"$shim_dir/ufw" <<'EOF'
|
||||
#!/bin/bash
|
||||
if [[ ${1:-} == "status" ]]; then
|
||||
echo "Status: active"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exec /usr/bin/ufw "$@"
|
||||
EOF
|
||||
|
||||
# The packaged ufw-docker pins PATH internally, so run a temporary copy whose
|
||||
# PATH can see the status shim above.
|
||||
sed "0,/^PATH=/s#^PATH=.*#PATH=\"$shim_dir:/bin:/usr/bin:/sbin:/usr/sbin:/snap/bin/\"#" \
|
||||
"$ufw_docker_bin" >"$shim_dir/ufw-docker"
|
||||
chmod 755 "$shim_dir/ufw" "$shim_dir/ufw-docker"
|
||||
|
||||
if "$shim_dir/ufw-docker" install; then
|
||||
status=0
|
||||
else
|
||||
status=$?
|
||||
fi
|
||||
|
||||
rm -rf "$shim_dir"
|
||||
return "$status"
|
||||
}
|
||||
|
||||
install_ufw_docker_rules
|
||||
|
||||
# Installs are followed by reboot, so configure UFW to start on the installed
|
||||
# system instead of mutating the live install session's firewall.
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# Installs are followed by reboot, so enable units without starting/reloading
|
||||
# running services during the install.
|
||||
chrootable_systemctl_enable() {
|
||||
sudo systemctl enable $1
|
||||
}
|
||||
|
||||
chrootable_systemctl_enable_only() {
|
||||
sudo systemctl enable $1
|
||||
}
|
||||
|
||||
export -f chrootable_systemctl_enable
|
||||
export -f chrootable_systemctl_enable_only
|
||||
+46
-20
@@ -1,53 +1,79 @@
|
||||
omarchy_log_to_stdout() {
|
||||
[[ ${OMARCHY_LOG_TO_STDOUT:-} == "1" || -z ${OMARCHY_INSTALL_LOG_FILE:-} ]]
|
||||
}
|
||||
|
||||
omarchy_log_line() {
|
||||
if omarchy_log_to_stdout; then
|
||||
echo "$1"
|
||||
else
|
||||
echo "$1" >>"$OMARCHY_INSTALL_LOG_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
start_install_log() {
|
||||
mkdir -p "$(dirname "$OMARCHY_INSTALL_LOG_FILE")"
|
||||
touch "$OMARCHY_INSTALL_LOG_FILE"
|
||||
chmod 666 "$OMARCHY_INSTALL_LOG_FILE" 2>/dev/null || true
|
||||
if ! omarchy_log_to_stdout; then
|
||||
mkdir -p "$(dirname "$OMARCHY_INSTALL_LOG_FILE")"
|
||||
touch "$OMARCHY_INSTALL_LOG_FILE"
|
||||
chmod 666 "$OMARCHY_INSTALL_LOG_FILE" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
export OMARCHY_START_TIME="${OMARCHY_START_TIME:-$(date '+%Y-%m-%d %H:%M:%S')}"
|
||||
export OMARCHY_START_EPOCH="${OMARCHY_START_EPOCH:-$(date +%s)}"
|
||||
|
||||
echo "=== Omarchy Setup Started: $OMARCHY_START_TIME ===" >>"$OMARCHY_INSTALL_LOG_FILE"
|
||||
omarchy_log_line "=== Omarchy Setup Started: $OMARCHY_START_TIME ==="
|
||||
}
|
||||
|
||||
stop_install_log() {
|
||||
[[ -n ${OMARCHY_INSTALL_LOG_FILE:-} ]] || return 0
|
||||
|
||||
local end_time end_epoch duration mins secs
|
||||
end_time=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
end_epoch=$(date +%s)
|
||||
|
||||
echo "=== Omarchy Setup Completed: $end_time ===" >>"$OMARCHY_INSTALL_LOG_FILE"
|
||||
omarchy_log_line "=== Omarchy Setup Completed: $end_time ==="
|
||||
|
||||
if [[ -n ${OMARCHY_START_EPOCH:-} ]]; then
|
||||
duration=$((end_epoch - OMARCHY_START_EPOCH))
|
||||
mins=$((duration / 60))
|
||||
secs=$((duration % 60))
|
||||
echo "Omarchy setup: ${mins}m ${secs}s" >>"$OMARCHY_INSTALL_LOG_FILE"
|
||||
omarchy_log_line "Omarchy setup: ${mins}m ${secs}s"
|
||||
fi
|
||||
}
|
||||
|
||||
run_logged() {
|
||||
local script="$1"
|
||||
local exit_code errexit_was_set=0
|
||||
|
||||
if [[ -z ${OMARCHY_INSTALL_LOG_FILE:-} ]]; then
|
||||
bash -eE -c 'source "$1"' bash "$script"
|
||||
return
|
||||
fi
|
||||
omarchy_log_line "[$(date '+%Y-%m-%d %H:%M:%S')] Starting: $script"
|
||||
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting: $script" >>"$OMARCHY_INSTALL_LOG_FILE"
|
||||
case $- in
|
||||
*e*)
|
||||
errexit_was_set=1
|
||||
set +e
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ ${OMARCHY_INSTALL_DEBUG:-} == "1" ]]; then
|
||||
PS4='+ ${BASH_SOURCE[0]##*/}:${LINENO}:${FUNCNAME[0]:-main}: ' \
|
||||
bash -x -eE -c 'source "$1"' bash "$script" </dev/null >>"$OMARCHY_INSTALL_LOG_FILE" 2>&1
|
||||
if omarchy_log_to_stdout; then
|
||||
if [[ ${OMARCHY_INSTALL_DEBUG:-} == "1" ]]; then
|
||||
PS4='+ ${BASH_SOURCE[0]##*/}:${LINENO}:${FUNCNAME[0]:-main}: ' \
|
||||
bash -x -eE -c 'source "$1"' bash "$script" </dev/null 2>&1
|
||||
else
|
||||
bash -eE -c 'source "$1"' bash "$script" </dev/null 2>&1
|
||||
fi
|
||||
else
|
||||
bash -eE -c 'source "$1"' bash "$script" </dev/null >>"$OMARCHY_INSTALL_LOG_FILE" 2>&1
|
||||
if [[ ${OMARCHY_INSTALL_DEBUG:-} == "1" ]]; then
|
||||
PS4='+ ${BASH_SOURCE[0]##*/}:${LINENO}:${FUNCNAME[0]:-main}: ' \
|
||||
bash -x -eE -c 'source "$1"' bash "$script" </dev/null >>"$OMARCHY_INSTALL_LOG_FILE" 2>&1
|
||||
else
|
||||
bash -eE -c 'source "$1"' bash "$script" </dev/null >>"$OMARCHY_INSTALL_LOG_FILE" 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
local exit_code=$?
|
||||
exit_code=$?
|
||||
(( errexit_was_set )) && set -e
|
||||
|
||||
if (( exit_code == 0 )); then
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Completed: $script" >>"$OMARCHY_INSTALL_LOG_FILE"
|
||||
omarchy_log_line "[$(date '+%Y-%m-%d %H:%M:%S')] Completed: $script"
|
||||
else
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Failed: $script (exit code: $exit_code)" >>"$OMARCHY_INSTALL_LOG_FILE"
|
||||
omarchy_log_line "[$(date '+%Y-%m-%d %H:%M:%S')] Failed: $script (exit code: $exit_code)"
|
||||
fi
|
||||
|
||||
return $exit_code
|
||||
|
||||
@@ -57,6 +57,7 @@ hyprsunset
|
||||
imagemagick
|
||||
imv
|
||||
inetutils
|
||||
inotify-tools
|
||||
inxi
|
||||
networkmanager
|
||||
jq
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# https://wiki.archlinux.org/title/Systemd-resolved
|
||||
# The target does not need the stub file to exist yet; systemd-resolved creates
|
||||
# it at boot.
|
||||
echo "Symlinking resolved stub-resolv to /etc/resolv.conf"
|
||||
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
||||
@@ -1,4 +1,3 @@
|
||||
run_logged "$OMARCHY_INSTALL/post-install/dns-resolver.sh"
|
||||
run_logged "$OMARCHY_INSTALL/post-install/pacman.sh"
|
||||
run_logged "$OMARCHY_INSTALL/post-install/udev.sh"
|
||||
run_logged "$OMARCHY_INSTALL/post-install/localdb.sh"
|
||||
|
||||
Reference in New Issue
Block a user