-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-basic-postinstal
executable file
·100 lines (85 loc) · 3.97 KB
/
setup-basic-postinstal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
UUID=$(id -u)
UUID=$(( UUID + 0 ))
I_OK="✔"
I_KO="✖️"
URLgithub="https://raw.githubusercontent.com/afimpel/alpine-linux/master"
URLgithubUpgrade="https://raw.githubusercontent.com/afimpel/upgrade-system-alpine/main"
NC='\e[0m'
if [ $UUID != 0 ]; then
echo "${I_KO} Start the Script as 'root' for it to work properly ${I_KO}";
exit 1;
else
users=$(getent passwd 1000 | cut -d: -f1)
echo "${I_OK} USER: ${users} ( 1000 )"
echo "${I_OK} BACKUP: Repositories"
cp /etc/apk/repositories /etc/apk/repositories_old
mv /etc/profile.d/color_prompt.sh.disabled /etc/profile.d/color_prompt.sh
echo "${I_OK} SSH: ROOT Login"
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
echo "${I_OK} BASH: Alias"
echo "
#!/bin/bash
export LS_OPTIONS='--color=auto';
alias tailf='tail --follow'
alias ls='ls $LS_OPTIONS'
alias dir='lsd'
alias ll='lsd -lh'
alias la='lsd -lhA'
" > /etc/profile.d/alias-completion.sh
echo "${I_OK} BASH: Completion"
echo 'if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a "x${BASH_COMPLETION_VERSINFO-}" = x ]; then
# Check for recent enough version of bash.
if [ "${BASH_VERSINFO[0]}" -gt 4 ] ||
[ "${BASH_VERSINFO[0]}" -eq 4 -a "${BASH_VERSINFO[1]}" -ge 2 ]; then
[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] &&
. "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
if shopt -q progcomp && [ -r /usr/share/bash-completion/bash_completion ]; then
# Source completion code.
. /usr/share/bash-completion/bash_completion
fi
fi
fi' > /etc/profile.d/bash-completion.sh
url=$(more /etc/apk/repositories | grep http | grep -v '^#' | head -n 1)
repositories_url="${url%/*/*}"
echo "${I_OK} Repositories: ${repositories_url}/edge | { main, community & testing }"
echo "${repositories_url}/edge/main" > /etc/apk/repositories
echo "${repositories_url}/edge/community" >> /etc/apk/repositories
echo "${repositories_url}/edge/testing" >> /etc/apk/repositories
apk update
apk add --no-cache nano lsd git mc bash zsh htop curl btop sudo lsblk bash-completion lsb-release-minimal\
openssl jq fastfetch musl-locales-lang chrony sshpass
echo "${I_OK} POOL: NTP"
echo 'server 0.south-america.pool.ntp.org iburst' > /etc/chronyd.conf
echo 'server 1.south-america.pool.ntp.org iburst' >> /etc/chronyd.conf
echo 'server 2.south-america.pool.ntp.org iburst' >> /etc/chronyd.conf
echo 'server 3.south-america.pool.ntp.org iburst' >> /etc/chronyd.conf
rc-update add crond default
service crond restart
echo "${I_OK} CHANGE: ASH to BASH"
sed -i 's/\/bin\/ash/\/bin\/bash/g' /etc/passwd
echo "${I_OK} CHANGE: SH to BASH"
sed -i 's/\/bin\/sh/\/bin\/bash/g' /etc/passwd
echo "${I_OK} SET: fastfetch"
mkdir -p ~/.config/fastfetch
wget --no-cache -O ~/.config/fastfetch/config.jsonc ${URLgithub}/global/fastfetch.jsonc
wget --no-cache -O /tmp/locate.json 'https://ipapi.co/json/'
languages=$(jq .languages /tmp/locate.json -r | cut -d, -f1)
echo "${I_OK} SET: Language: ${languages/-/_}";
echo "export LANG='${languages/-/_}.utf8'" >> /etc/profile
echo "${I_OK} ADD: Toolkit"
wget --no-cache -O - ${URLgithubUpgrade}/installer.sh | bash
wget --no-cache -O /usr/bin/get-ip-address ${URLgithub}/global/get-ip-address
wget --no-cache -O /usr/bin/update-time ${URLgithub}/global/update-time
wget --no-cache -O /usr/bin/login-info ${URLgithub}/global/login-info
chmod 777 -Rv /usr/bin/login-info
chmod 777 -Rv /usr/bin/get-ip-address
chmod 777 -Rv /usr/bin/update-t*
chmod 777 -Rv /etc/profile.d/*.sh
wget --no-cache -O /etc/motd ${URLgithub}/global/motd
echo "Language: ${languages/-/_}" >> /etc/motd
echo "Install Date: $(date)" >> /etc/motd
echo "${I_OK} END: $(date)"
package-update
upgrade-system-reboot
fi