#!/bin/sh
apk update
apk install wget curl bash-completion gnupg2 pciutils command-not-found screenfetch -y

update-command-not-found
apk update

cat > /root/.bashrc << "EOF"
# ~/.bashrc: executed by bash(1) for non-login shells.

# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto'
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
PS1='\[\033[01;31m\]\u\[\033[00m\]@\[\033[01;32m\]\h:\[\033[00m\]\w\$ '
# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias grep='grep --color=auto'
EOF

cat > /etc/motd << EOF
EOF


ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo 'Asia/Shanghai' >/etc/timezone


cat >> '/etc/profile' << "EOF"
ulimit -SHn 51200
EOF

cat > '/etc/sysctl.conf' << "EOF"
net.ipv4.tcp_slow_start_after_idle = 0
net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_tw_reuse = 1
net.ipv4.ip_forward = 1
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_mtu_probing = 1
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
#net.ipv6.conf.all.disable_ipv6 = 1
#net.ipv6.conf.default.disable_ipv6 = 1
#net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.all.forwarding = 1
net.ipv4.tcp_mtu_probing = 0
net.ipv4.tcp_fack = 1
net.ipv4.tcp_frto = 0
net.ipv4.tcp_ecn = 0
EOF


mkdir /root/.ssh
touch /root/.ssh/authorized_keys

curl nxtrace.org/nt | bash 

apk add speedtest-cli

cat > '.ssh/authorized_keys' << "EOF"
ssh-rsa [payload removed: 372 characters] 
EOF

sed -i 's/^.*PasswordAuthentication.*/PasswordAuthentication no/g' /etc/ssh/sshd_config
sed -i 's/^.*PubkeyAuthentication.*/PubkeyAuthentication yes/g' /etc/ssh/sshd_config
