regenerate scripts, add gogs setup based off gitea setup
This commit is contained in:
parent
d53c3103b7
commit
f7c03fb1a7
@ -10,7 +10,9 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: zabbix_agent2
|
||||
|
@ -9,7 +9,9 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: zabbix_proxy
|
||||
|
@ -1,8 +1,12 @@
|
||||
#!/bin/ash
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -11,6 +15,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
|
@ -17,12 +17,18 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -31,6 +37,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
|
@ -17,12 +17,18 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -31,6 +37,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
|
@ -17,12 +17,18 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -31,6 +37,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
|
@ -17,12 +17,18 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -31,6 +37,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
@ -57,10 +64,10 @@ reboot_system() {
|
||||
}
|
||||
|
||||
repos edge
|
||||
pkgs "procps htop iftop net-tools tmux iptables mg syslog-ng haveged iproute2 coreutils logrotate shadow openssh gitea"
|
||||
pkgs "procps htop iftop net-tools tmux iptables mg syslog-ng haveged iproute2 coreutils logrotate shadow openssh gogs"
|
||||
crontab_base
|
||||
crontab_append "0 2 * * 5 /sbin/apk -U -a upgrade"
|
||||
apply_crontab
|
||||
enable_services boot "syslog-ng"
|
||||
enable_services default "crond iptables gitea sshd"
|
||||
enable_services default "crond iptables gogs sshd"
|
||||
reboot_system
|
||||
|
@ -21,12 +21,18 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -35,6 +41,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
|
@ -3,7 +3,13 @@ set -ex
|
||||
|
||||
#Usage: pkgs 'htop tmux emacs'
|
||||
pkgs() {
|
||||
DEBIAN_FRONTED=noninteractive apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -q -y install $1
|
||||
if [ "$2" == "update" ]; then
|
||||
DEBIAN_FRONTED=noninteractive apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -q -y update
|
||||
fi
|
||||
|
||||
if [ "$1" != "" ]; then
|
||||
DEBIAN_FRONTED=noninteractive apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -q -y install $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: create_group gns3
|
||||
|
@ -19,12 +19,18 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -33,6 +39,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
|
@ -21,12 +21,18 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -35,6 +41,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
|
@ -18,12 +18,18 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -32,6 +38,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
@ -150,7 +157,7 @@ enable_services() {
|
||||
}
|
||||
|
||||
repos edge
|
||||
pkgs "linux-lts-dev lxd-feature lxc lxc-lvm lxcfs bridge lxc-templates lxc-download xz gnupg rsync debootstrap grep zfs zfs-lts zfs-scripts zfs-libs zfs-udev eudev eudev-hwids hwdata dbus shadow util-linux util-linux-misc coreutils iproute2 findutils usbutils pciutils sysfsutils gawk procps grep binutils wget curl syslog-ng acpid awall haveged logrotate qemu qemu-img qemu-tools qemu-system-x86_64 qemu-ui-spice-core qemu-chardev-spice qemu-audio-spice qemu-ui-spice-app qemu-hw-usb-host qemu-hw-usb-redirect qemu-hw-display-virtio-gpu qemu-hw-display-virtio-vga libvirt ovmf swtpm distrobuilder distrobuilder-lxd make go git zram-init iptables ip6tables aufs-util e2fsprogs fennel lshw lua5.3-libs mosh openssl sudo tmux sysstat"
|
||||
pkgs "linux-lts-dev lxd-feature lxc lxc-lvm lxcfs bridge lxc-templates lxc-download xz gnupg rsync debootstrap grep zfs zfs-lts zfs-scripts zfs-libs zfs-udev eudev eudev-hwids hwdata dbus shadow util-linux util-linux-misc coreutils iproute2 findutils usbutils pciutils sysfsutils gawk procps grep binutils wget curl syslog-ng acpid awall haveged logrotate qemu qemu-img qemu-tools qemu-system-x86_64 qemu-ui-spice-core qemu-chardev-spice qemu-audio-spice qemu-ui-spice-app qemu-hw-usb-host qemu-hw-usb-redirect qemu-hw-display-virtio-gpu qemu-hw-display-virtio-vga libvirt libvirt-daemon libvirt-client libvirt-qemu libvirt-libs ovmf swtpm distrobuilder distrobuilder-lxd make go git zram-init iptables ip6tables aufs-util e2fsprogs fennel lshw lua5.3-libs mosh openssl sudo tmux sysstat"
|
||||
crontab_base
|
||||
crontab_append "*/10 * * * * /usr/lib/sa1 1 1"
|
||||
crontab_append "*/10 * * * * /usr/lib/sa1 600 6 &"
|
||||
@ -160,4 +167,4 @@ crontab_append "0 5 * * 5 /sbin/reboot"
|
||||
apply_crontab
|
||||
ssh_conf "22" "sysadmin"
|
||||
enable_services boot syslog-ng
|
||||
enable_services default "crond cgroups lxd lxc lxcfs dbus zram-init"
|
||||
enable_services default "crond cgroups lxd lxc lxcfs dbus zram-init libvirtd"
|
||||
|
@ -18,12 +18,18 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -32,6 +38,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
|
@ -358,11 +358,11 @@ promtail_base_conf() {
|
||||
mv /etc/loki/promtail-local-config.yaml /etc/loki/promtail-local-config.yaml.bak
|
||||
fi
|
||||
|
||||
if $(which systemctl > /dev/null); then
|
||||
if $(which systemctl > /dev/null); then
|
||||
usermod -a -G systemd-journal promtail
|
||||
usermod -a -G adm promtail
|
||||
fi
|
||||
|
||||
|
||||
cat > /etc/loki/promtail-local-config.yaml <<EOF
|
||||
server:
|
||||
http_listen_port: 9080
|
||||
@ -379,20 +379,21 @@ EOF
|
||||
#Variables: loki_addr
|
||||
promtail_job_conf() {
|
||||
os=$(grep '^ID=' /etc/os-release | awk -F'=' '{print $2}')
|
||||
|
||||
|
||||
if [ "$os" == "alpine" ]; then
|
||||
promtail_conf=/etc/loki/promtail-local-config.yaml
|
||||
elif [ "$os" == "debian" ]; then
|
||||
promtail_conf=/etc/promtail/config.yaml
|
||||
fi
|
||||
|
||||
cat >> $promtail_conf <<EOF
|
||||
|
||||
cat >> $promtail_conf <<EOF
|
||||
- job_name: $1
|
||||
static_configs:
|
||||
- targets:
|
||||
- 127.0.0.1
|
||||
labels:
|
||||
job: $2
|
||||
group: $1
|
||||
host: $(hostname)
|
||||
__path__: $3
|
||||
EOF
|
||||
@ -477,15 +478,19 @@ nginx_activate() {
|
||||
nginx_deactivate() {
|
||||
if [ -d /etc/nginx/sites-enabled ]; then
|
||||
if [ -f /etc/nginx/sites-enabled/$1.conf ]; then
|
||||
unlink /etc/nginx/sites-enabled/$1.conf
|
||||
elif [ -f /etc/nginx/sites-enabled/$1 ]; then
|
||||
unlink /etc/nginx/sites-enabled/$1
|
||||
if [ "$(file /etc/nginx/sites-enabled/$1.conf | awk -F':' '{print $2}' | grep -o "symbolic")" == "symbolic" ]; then
|
||||
unlink /etc/nginx/sites-enabled/$1.conf
|
||||
else
|
||||
rm /etc/nginx/sites-enabled/$1.conf
|
||||
fi
|
||||
fi
|
||||
elif [ -d /etc/nginx/http.d ]; then
|
||||
if [ -f /etc/nginx/sites-enabled/$1.conf ]; then
|
||||
unlink /etc/nginx/httpd./$1.conf
|
||||
elif [ -f /etc/nginx/sites-enabled/$1 ]; then
|
||||
unlink /etc/nginx/httpd./$1
|
||||
if [ -f /etc/nginx/http.d/$1.conf ]; then
|
||||
if [ "$(file /etc/nginx/http.d/$1.conf | awk -F':' '{print $2}' | grep -o "symbolic")" == "symbolic" ]; then
|
||||
unlink /etc/nginx/http.d/$1.conf
|
||||
else
|
||||
rm /etc/nginx/http.d/$1.conf
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -30,7 +30,12 @@ promtail_base_conf() {
|
||||
if [ -f /etc/loki/promtail-local-config.yaml ]; then
|
||||
mv /etc/loki/promtail-local-config.yaml /etc/loki/promtail-local-config.yaml.bak
|
||||
fi
|
||||
|
||||
|
||||
if $(which systemctl > /dev/null); then
|
||||
usermod -a -G systemd-journal promtail
|
||||
usermod -a -G adm promtail
|
||||
fi
|
||||
|
||||
cat > /etc/loki/promtail-local-config.yaml <<EOF
|
||||
server:
|
||||
http_listen_port: 9080
|
||||
@ -46,13 +51,22 @@ EOF
|
||||
#Usage: promtail_job_conf job_name job_label log_path
|
||||
#Variables: loki_addr
|
||||
promtail_job_conf() {
|
||||
cat >> /etc/loki/promtail-local-config.yaml <<EOF
|
||||
os=$(grep '^ID=' /etc/os-release | awk -F'=' '{print $2}')
|
||||
|
||||
if [ "$os" == "alpine" ]; then
|
||||
promtail_conf=/etc/loki/promtail-local-config.yaml
|
||||
elif [ "$os" == "debian" ]; then
|
||||
promtail_conf=/etc/promtail/config.yaml
|
||||
fi
|
||||
|
||||
cat >> $promtail_conf <<EOF
|
||||
- job_name: $1
|
||||
static_configs:
|
||||
- targets:
|
||||
- 127.0.0.1
|
||||
labels:
|
||||
job: $2
|
||||
group: $1
|
||||
host: $(hostname)
|
||||
__path__: $3
|
||||
EOF
|
||||
|
@ -26,12 +26,18 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -40,6 +46,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
|
@ -18,12 +18,18 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -32,6 +38,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
|
@ -7,7 +7,9 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage:
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/bin/ash
|
||||
set -ex
|
||||
URL=https://$(ip addr show dev eth0 | grep 'inet ' | awk '{print $2}' | sed 's|/24||'):443
|
||||
|
||||
#Usage: repos
|
||||
@ -19,12 +18,18 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -33,6 +38,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
|
@ -19,12 +19,18 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -33,6 +39,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
|
@ -137,11 +137,11 @@ promtail_base_conf() {
|
||||
mv /etc/loki/promtail-local-config.yaml /etc/loki/promtail-local-config.yaml.bak
|
||||
fi
|
||||
|
||||
if $(which systemctl > /dev/null); then
|
||||
if $(which systemctl > /dev/null); then
|
||||
usermod -a -G systemd-journal promtail
|
||||
usermod -a -G adm promtail
|
||||
fi
|
||||
|
||||
|
||||
cat > /etc/loki/promtail-local-config.yaml <<EOF
|
||||
server:
|
||||
http_listen_port: 9080
|
||||
@ -158,20 +158,21 @@ EOF
|
||||
#Variables: loki_addr
|
||||
promtail_job_conf() {
|
||||
os=$(grep '^ID=' /etc/os-release | awk -F'=' '{print $2}')
|
||||
|
||||
|
||||
if [ "$os" == "alpine" ]; then
|
||||
promtail_conf=/etc/loki/promtail-local-config.yaml
|
||||
elif [ "$os" == "debian" ]; then
|
||||
promtail_conf=/etc/promtail/config.yaml
|
||||
fi
|
||||
|
||||
cat >> $promtail_conf <<EOF
|
||||
|
||||
cat >> $promtail_conf <<EOF
|
||||
- job_name: $1
|
||||
static_configs:
|
||||
- targets:
|
||||
- 127.0.0.1
|
||||
labels:
|
||||
job: $2
|
||||
group: $1
|
||||
host: $(hostname)
|
||||
__path__: $3
|
||||
EOF
|
||||
@ -256,15 +257,19 @@ nginx_activate() {
|
||||
nginx_deactivate() {
|
||||
if [ -d /etc/nginx/sites-enabled ]; then
|
||||
if [ -f /etc/nginx/sites-enabled/$1.conf ]; then
|
||||
unlink /etc/nginx/sites-enabled/$1.conf
|
||||
elif [ -f /etc/nginx/sites-enabled/$1 ]; then
|
||||
unlink /etc/nginx/sites-enabled/$1
|
||||
if [ "$(file /etc/nginx/sites-enabled/$1.conf | awk -F':' '{print $2}' | grep -o "symbolic")" == "symbolic" ]; then
|
||||
unlink /etc/nginx/sites-enabled/$1.conf
|
||||
else
|
||||
rm /etc/nginx/sites-enabled/$1.conf
|
||||
fi
|
||||
fi
|
||||
elif [ -d /etc/nginx/http.d ]; then
|
||||
if [ -f /etc/nginx/sites-enabled/$1.conf ]; then
|
||||
unlink /etc/nginx/httpd./$1.conf
|
||||
elif [ -f /etc/nginx/sites-enabled/$1 ]; then
|
||||
unlink /etc/nginx/httpd./$1
|
||||
if [ -f /etc/nginx/http.d/$1.conf ]; then
|
||||
if [ "$(file /etc/nginx/http.d/$1.conf | awk -F':' '{print $2}' | grep -o "symbolic")" == "symbolic" ]; then
|
||||
unlink /etc/nginx/http.d/$1.conf
|
||||
else
|
||||
rm /etc/nginx/http.d/$1.conf
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -21,12 +21,18 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -35,6 +41,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
|
@ -18,12 +18,18 @@ pkgs() {
|
||||
apk update
|
||||
fi
|
||||
|
||||
apk add $1
|
||||
if [ "$1" != "" ]; then
|
||||
apk add $1
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -32,6 +38,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
|
@ -1,8 +1,12 @@
|
||||
#!/bin/ash
|
||||
|
||||
#Usage: crontab_base
|
||||
#Usage: crontab_base [blank]
|
||||
crontab_base() {
|
||||
cat > /tmp/new.cron <<EOF
|
||||
if [ "$2" == "blank" ]; then
|
||||
cat > /tmp/new.cron >>EOF
|
||||
EOF
|
||||
else
|
||||
cat > /tmp/new.cron <<EOF
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
@ -11,6 +15,7 @@ crontab_base() {
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#Usage: crontab_append '*/15 * * * * /usr/local/bin/atentu -m > /etc/motd'
|
||||
|
29
Templates/setup-gogs-server.yaml
Normal file
29
Templates/setup-gogs-server.yaml
Normal file
@ -0,0 +1,29 @@
|
||||
Shell: '#!/bin/ash'
|
||||
Script: Generated/setup-gitea-server.sh
|
||||
Debug: false
|
||||
Variables:
|
||||
- Name:
|
||||
Value:
|
||||
Tasks:
|
||||
- Path: Tasks/stable_apk_repos
|
||||
Invo:
|
||||
- 'repos edge'
|
||||
- Path: Tasks/apk_pkgs
|
||||
Invo:
|
||||
- 'pkgs "procps htop iftop net-tools tmux iptables mg syslog-ng haveged iproute2 coreutils logrotate shadow openssh gogs"'
|
||||
- Path: Tasks/crontab_base
|
||||
Invo:
|
||||
- 'crontab_base'
|
||||
- Path: Tasks/crontab_append
|
||||
Invo:
|
||||
- 'crontab_append "0 2 * * 5 /sbin/apk -U -a upgrade"'
|
||||
- Path: Tasks/apply_crontab
|
||||
Invo:
|
||||
- 'apply_crontab'
|
||||
- Path: Tasks/enable_services
|
||||
Invo:
|
||||
- 'enable_services boot "syslog-ng"'
|
||||
- 'enable_services default "crond iptables gogs sshd"'
|
||||
- Path: Tasks/reboot_system
|
||||
Invo:
|
||||
- 'reboot_system'
|
Loading…
Reference in New Issue
Block a user