commit 14fe8e1bc232d26f8ea76f6bc98295b6e9585e1d
parent 4a18283705a164594813f8c4cfc383fa9489e05e
Author: Jan Pobrislo <ccx@webprojekty.cz>
Date: Tue, 19 Jul 2022 12:00:58 +0200
Move away files to symlink.
Diffstat:
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/install b/install
@@ -18,7 +18,7 @@ die() {
die100() { # 100: wrong usage
die_ret 100 "$@"
}
-die111() { # 111: system call failed
+die111() { # 111: system call failed
die_ret 111 "$@"
}
diff --git a/postinstall b/postinstall
@@ -5,6 +5,23 @@ zmodload -m -F zsh/files b:zf_\* || exit $?
#zmodload zsh/zutil || exit $? # for zparseopts
zmodload zsh/datetime || exit $? # for $EPOCHREALTIME
+die_ret() {
+ local ret
+ ret=$1
+ shift
+ printf >&2 '%s\n' "$@"
+ exit $ret
+}
+die() {
+ die_ret 1 "$@"
+}
+die100() { # 100: wrong usage
+ die_ret 100 "$@"
+}
+die111() { # 111: system call failed
+ die_ret 111 "$@"
+}
+
ensure_symlink() {
local target
if ! [[ -e $1 ]]; then
@@ -38,8 +55,14 @@ postinstall() {
local diff_ret
cd $ALL_DIR || exit $?
ensure_symlink /command current/command || return $?
+ if [[ -f /etc/hostname ]]; then
+ mv /etc/hostname{,.orig.$EPOCHSECONDS} || exit $?
+ fi
ensure_symlink /etc/hostname ../current/conf/static/etc/hostname || return $?
ensure_symlink /etc/profile.d/slashcommand.sh ../../current/conf/static/etc/profile.d/slashcommand.sh || return $?
+ if [[ -f /etc/mkinitfs/mkinitfs.conf ]]; then
+ mv /etc/mkinitfs/mkinitfs.conf{,.orig.$EPOCHSECONDS} || exit $?
+ fi
ensure_symlink /etc/mkinitfs/mkinitfs.conf ../../current/conf/static/etc/mkinitfs/mkinitfs.conf || return $?
if [[ -d /run/s6-rc/ ]]; then