From 2eb4773913c31c02699aef3aecf69218ebf035bb Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Tue, 23 Dec 2025 16:26:54 +0300 Subject: [PATCH] Feat(debian/init-system): Init debian system with or w/o SystemD --- playbooks/debian/init-system.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/playbooks/debian/init-system.sh b/playbooks/debian/init-system.sh index 3a3ef1b..702c9f3 100755 --- a/playbooks/debian/init-system.sh +++ b/playbooks/debian/init-system.sh @@ -1,14 +1,27 @@ #! /bin/sh -if [ -z "$1" ]; then - echo "Usage: $0 host [...params...]" >&2 +usage() { + echo "Usage: $0 -d|-D host [...params...]" >&2 exit 1 +} + +if [ "$1" = '-d' ]; then + remove_systemd="$1" +elif [ "$1" = '-D' ]; then + remove_systemd="$1" +else + usage +fi +shift + +if [ -z "$1" ]; then + usage fi host="$1" shift -ssh root@$host exec adduser phd +ssh root@$host exec adduser phd # Ignore error: may already be created # Passwordless access isn't configured yet; use `ssh` connection sharing. ssh phd@$host exit && @@ -17,5 +30,7 @@ cd "`dirname \"$0\"`" && # `sudo` isn't configured yet too; use `su` and ask for root password. ansible-playbook ../init-system.yaml "$@" -e hosts="$host" \ --become-method=su -K && -../run-roles debian/remove-systemd "$@" -e hosts="$host" && +if [ "$remove_systemd" = '-D' ]; then + ../run-roles debian/remove-systemd "$@" -e hosts="$host" +fi && exec ansible-playbook ../init-system2.yaml "$@" -e hosts="$host" -- 2.47.3