Compare commits

...
3 Commits
Author SHA1 Message Date
mikeandClaude Opus 5 5381c20411 extra.setup: make the fzf install repeatable and keep an existing zshrc
git clone failed on every run after the first, and ~/.fzf/install asks
three questions - both stop an unattended run. The rc file is not touched
because extra/zshrc sources ~/.fzf.zsh itself.

~/.zshrc was overwritten without a copy; the first one seen is kept as
~/.zshrc.bak.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 10:55:20 +02:00
mikeandClaude Opus 5 ada2de1f24 setup.debian1x: fix -x, apt ordering and time sync
-x was never declared in getopts, so !$opt_x was always true and the
block it guards always ran. It now exists and covers both network steps.

apt-get update ran after the installs; on an image with empty package
lists every install failed. It now runs first.

apt-get upgrade had no -y and stopped an unattended run at the prompt.
DEBIAN_FRONTEND=noninteractive for the same reason.

On 13 the timesyncd.conf was copied but the service never restarted, so
it took effect at the next reboot at the earliest - and the ntp package
from the install list competed with timesyncd for port 123. ntp is now
installed only on the older releases, where the service is called ntpsec
since 12.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 10:55:20 +02:00
mikeandClaude Opus 5 96c5c2e65d setup.ssh: keep the newline when commenting out AcceptEnv
The $ in /(^\s*AcceptEnv.*$)/ matches before the newline, so $1 did not
contain it and the following line was appended to the comment - which
commented out the Subsystem sftp line on a stock Debian sshd_config.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 10:55:10 +02:00
3 changed files with 32 additions and 10 deletions
+11 -3
View File
@@ -26,9 +26,17 @@ system("curl -s https://ohmyposh.dev/install.sh | bash -s -- -d /db/bin");
system("mkdir -p /db/etc");
system("cp extra/omp.json /db/etc/");
system("git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf");
system("~/.fzf/install");
if (-d "$HOME/.fzf") {
system("cd $HOME/.fzf && git pull --ff-only");
} else {
system("git clone --depth 1 https://github.com/junegunn/fzf.git $HOME/.fzf");
}
# The flags are what makes it run without asking. No --update-rc: the zshrc
# below sources ~/.fzf.zsh itself.
system("$HOME/.fzf/install --key-bindings --completion --no-update-rc");
system("cp -r extra/zshrc $HOME/.zshrc");
# Whatever zshrc is already there belongs to someone - keep the first one.
system("cp $HOME/.zshrc $HOME/.zshrc.bak") if (-f "$HOME/.zshrc" && !-f "$HOME/.zshrc.bak");
system("cp extra/zshrc $HOME/.zshrc");
########################################################################################################### END
+20 -6
View File
@@ -1,11 +1,20 @@
#!/usr/bin/perl
use Getopt::Std;getopts('z');
use Getopt::Std;getopts('xz');
# -x skips everything that talks to the network: apt and the time sync.
# -z makes zsh root's login shell.
$ENV{DEBIAN_FRONTEND}='noninteractive';
system("userdel ppb; rm -rf /home/ppb") if (-d "/home/ppb");
system("userdel mike; rm -rf /home/mike") if (-d "/home/mike");
# Before the installs, not after them: on a fresh image the package lists are
# empty and every install below fails.
system("/usr/bin/apt-get update") if (!$opt_x);
&ai('dnsutils','net-tools','zsh','joe','rsync','curl','fuse','libwww-perl',
'libterm-readline-perl-perl','libterm-readpassword-perl','libdbd-mysql-perl','ntp',
'libterm-readline-perl-perl','libterm-readpassword-perl','libdbd-mysql-perl',
'libjson-perl','jq','unzip','7zip');
if ($opt_z) {
@@ -76,16 +85,21 @@ system("chmod 700 /root/.ssh");
system("chmod 600 /root/.ssh/authorized_keys");
if (!$opt_x) {
system("/usr/bin/apt-get update");
system("/usr/bin/apt-get upgrade");
system("/usr/bin/apt-get -y upgrade");
if (is_debian_13_or_later()) {
# timesyncd is what 13 runs; ntpd would only fight it over port 123.
system("cp ./files/timesyncd.conf /etc/systemd/");
system("systemctl restart systemd-timesyncd");
} else {
system("service ntp stop");
&ai('ntp');
# Since 12 the package is ntpsec and so is the service name.
my $svc = (-e "/lib/systemd/system/ntpsec.service"
|| -e "/usr/lib/systemd/system/ntpsec.service") ? "ntpsec" : "ntp";
system("service $svc stop");
system("/usr/sbin/ntpd -gq");
system("service ntp start");
system("service $svc start");
}
}
+1 -1
View File
@@ -9,7 +9,7 @@ while(<IN>) {
if (/^\s*\#*\s*PermitRootLogin/) {
$out.="PermitRootLogin yes\n" ;
} elsif (/(^\s*AcceptEnv.*$)/) {
$out.="#$1";
$out.="#$1\n";
} else {
$out.=$_;
}