Compare commits
4
Commits
78599ffff5
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d295a72a9 | ||
|
|
5381c20411 | ||
|
|
ada2de1f24 | ||
|
|
96c5c2e65d |
+11
-3
@@ -26,9 +26,17 @@ system("curl -s https://ohmyposh.dev/install.sh | bash -s -- -d /db/bin");
|
|||||||
system("mkdir -p /db/etc");
|
system("mkdir -p /db/etc");
|
||||||
system("cp extra/omp.json /db/etc/");
|
system("cp extra/omp.json /db/etc/");
|
||||||
|
|
||||||
system("git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf");
|
if (-d "$HOME/.fzf") {
|
||||||
system("~/.fzf/install");
|
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
|
########################################################################################################### END
|
||||||
|
|||||||
+10
-10
@@ -13,7 +13,7 @@
|
|||||||
"darker": "#444455"
|
"darker": "#444455"
|
||||||
},
|
},
|
||||||
"var": {
|
"var": {
|
||||||
"sep": "<#ffffff>・</>"
|
"sep": "・"
|
||||||
},
|
},
|
||||||
"blocks": [
|
"blocks": [
|
||||||
{
|
{
|
||||||
@@ -23,19 +23,19 @@
|
|||||||
{
|
{
|
||||||
"foreground_templates": ["{{if .SSHSession }}p:violet{{else}}p:green{{ end }}"],
|
"foreground_templates": ["{{if .SSHSession }}p:violet{{else}}p:green{{ end }}"],
|
||||||
"style": "diamond",
|
"style": "diamond",
|
||||||
"template": "<b>{{.HostName}}</b>{{.Var.sep}}{{.OS}}{{.Var.sep}}{{.Shell}}",
|
"template": "<b>{{.HostName}}</b><#ffffff>{{.Var.sep}}</>{{.OS}}<#ffffff>{{.Var.sep}}</>{{.Shell}}",
|
||||||
"type": "session"
|
"type": "session"
|
||||||
},{
|
},{
|
||||||
"foreground": "p:orange",
|
"foreground": "p:orange",
|
||||||
"style": "diamond",
|
"style": "diamond",
|
||||||
"template": "{{.Var.sep}}{{.SHLVL}}/{{.PromptCount}}",
|
"template": "<#ffffff>{{.Var.sep}}</>{{.SHLVL}}/{{.PromptCount}}",
|
||||||
"type": "session"
|
"type": "session"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"foreground_templates": ["{{if .Root }}p:red{{else}}p:green{{ end }}"],
|
"foreground_templates": ["{{if .Root }}p:red{{else}}p:green{{ end }}"],
|
||||||
"leading_diamond": "",
|
"leading_diamond": "",
|
||||||
"style": "diamond",
|
"style": "diamond",
|
||||||
"template": "{{.Var.sep}}{{.UserName}}",
|
"template": "<#ffffff>{{.Var.sep}}</>{{.UserName}}",
|
||||||
"type": "session"
|
"type": "session"
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
"foreground_templates": ["{{ if gt .Code 0 }}p:red{{ end }}"],
|
"foreground_templates": ["{{ if gt .Code 0 }}p:red{{ end }}"],
|
||||||
"leading_diamond": "",
|
"leading_diamond": "",
|
||||||
"style": "diamond",
|
"style": "diamond",
|
||||||
"template": "{{.Var.sep}}{{.Code}}",
|
"template": "<#ffffff>{{.Var.sep}}</>{{.Code}}",
|
||||||
"type": "session"
|
"type": "session"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
"fetch_worktree_count": true
|
"fetch_worktree_count": true
|
||||||
},
|
},
|
||||||
"style": "diamond",
|
"style": "diamond",
|
||||||
"template": "{{.Var.sep}}{{ .HEAD }} {{ .StashCount }}",
|
"template": "<#ffffff>{{.Var.sep}}</>{{ .HEAD }} {{ .StashCount }}",
|
||||||
"trailing_diamond": "",
|
"trailing_diamond": "",
|
||||||
"type": "git"
|
"type": "git"
|
||||||
},
|
},
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
"type": "go",
|
"type": "go",
|
||||||
"style": "plain",
|
"style": "plain",
|
||||||
"foreground": "p:blue",
|
"foreground": "p:blue",
|
||||||
"template": "{{.Var.sep}}GO {{ .Full }} "
|
"template": "<#ffffff>{{.Var.sep}}</>GO {{ .Full }} "
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"type": "prompt"
|
"type": "prompt"
|
||||||
@@ -79,13 +79,13 @@
|
|||||||
"time_format": "Mon, 15:04"
|
"time_format": "Mon, 15:04"
|
||||||
},
|
},
|
||||||
"style": "diamond",
|
"style": "diamond",
|
||||||
"template": "{{ .CurrentDate | date .Format }}{{.Var.sep}}",
|
"template": "{{ .CurrentDate | date .Format }}<#ffffff>{{.Var.sep}}</>",
|
||||||
"type": "time"
|
"type": "time"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"foreground": "#94ffa2",
|
"foreground": "#94ffa2",
|
||||||
"style": "diamond",
|
"style": "diamond",
|
||||||
"template": "{{ round .PhysicalPercentUsed .Precision }}%{{.Var.sep}}{{ round .Load15 .Precision }}",
|
"template": "{{ round .PhysicalPercentUsed .Precision }}%<#ffffff>{{.Var.sep}}</>{{ round .Load15 .Precision }}",
|
||||||
"properties": {
|
"properties": {
|
||||||
"precision": 1
|
"precision": 1
|
||||||
},
|
},
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
"{{ if lt .Percentage 50 }}p:yellow{{ end }}",
|
"{{ if lt .Percentage 50 }}p:yellow{{ end }}",
|
||||||
"p:blue"
|
"p:blue"
|
||||||
],
|
],
|
||||||
"template": "{{if not .Error}}{{.Var.sep}}{{.Percentage}}%{{end}} "
|
"template": "{{if not .Error}}<#ffffff>{{.Var.sep}}</>{{.Percentage}}%{{end}} "
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|||||||
+20
-6
@@ -1,11 +1,20 @@
|
|||||||
#!/usr/bin/perl
|
#!/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 ppb; rm -rf /home/ppb") if (-d "/home/ppb");
|
||||||
system("userdel mike; rm -rf /home/mike") if (-d "/home/mike");
|
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',
|
&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');
|
'libjson-perl','jq','unzip','7zip');
|
||||||
|
|
||||||
if ($opt_z) {
|
if ($opt_z) {
|
||||||
@@ -76,16 +85,21 @@ system("chmod 700 /root/.ssh");
|
|||||||
system("chmod 600 /root/.ssh/authorized_keys");
|
system("chmod 600 /root/.ssh/authorized_keys");
|
||||||
|
|
||||||
if (!$opt_x) {
|
if (!$opt_x) {
|
||||||
system("/usr/bin/apt-get update");
|
system("/usr/bin/apt-get -y upgrade");
|
||||||
system("/usr/bin/apt-get upgrade");
|
|
||||||
|
|
||||||
if (is_debian_13_or_later()) {
|
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("cp ./files/timesyncd.conf /etc/systemd/");
|
||||||
|
system("systemctl restart systemd-timesyncd");
|
||||||
|
|
||||||
} else {
|
} 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("/usr/sbin/ntpd -gq");
|
||||||
system("service ntp start");
|
system("service $svc start");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ while(<IN>) {
|
|||||||
if (/^\s*\#*\s*PermitRootLogin/) {
|
if (/^\s*\#*\s*PermitRootLogin/) {
|
||||||
$out.="PermitRootLogin yes\n" ;
|
$out.="PermitRootLogin yes\n" ;
|
||||||
} elsif (/(^\s*AcceptEnv.*$)/) {
|
} elsif (/(^\s*AcceptEnv.*$)/) {
|
||||||
$out.="#$1";
|
$out.="#$1\n";
|
||||||
} else {
|
} else {
|
||||||
$out.=$_;
|
$out.=$_;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user