-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrockylinux-desktop-postinstall.sh
More file actions
executable file
·121 lines (98 loc) · 3.58 KB
/
rockylinux-desktop-postinstall.sh
File metadata and controls
executable file
·121 lines (98 loc) · 3.58 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/env bash
# 0/1 : enable cockpit
cockpit=0
# List of additional software to install
addsoftwares=(vim tar git tmux ncdu htop)
# List of additional development software to install
adddev=(rbenv)
# 0/1 : Désactiver le parefeu firewalld
disablefirewalld=0
# enforcing/permissive/disabled : Statut de SELinux à activer
selinux=enforcing
arch=$(uname -m)
# check root
if [[ $EUID -ne 0 ]]
then
sudo chmod +x "$(dirname "$0")/$0"
sudo "$(dirname "$0")/$0"
exit;
fi
# SELinux
sed -e "s/SELINUX=.*/SELINUX=$selinux/" -i /etc/sysconfig/selinux
# Upgrade
dnf -y --nogpgcheck --refresh upgrade
# Turn on EPEL repo
yum -y install epel-release && yum repolist
# Tools
if [[ -n ${addsoftwares[*]} ]]
then
dnf install --nogpgcheck -y "${addsoftwares[@]}"
fi
type -p tmux >/dev/null && curl -JLO https://raw.githubusercontent.com/imomaliev/tmux-bash-completion/master/completions/tmux && mv tmux /usr/share/bash-completion/completions/tmux
# Development
if [[ -n ${adddev[*]} ]]
then
dnf install --nogpgcheck -y "${adddev[@]}"
eval "$(rbenv init -)"
fi
# Cockpit
if [[ "$cockpit" -eq "1" ]]
then
dnf install --nogpgcheck -y cockpit
dnf install --nogpgcheck -y cockpit-networkmanager cockpit-selinux cockpit-dashboard cockpit-system cockpit-storaged
systemctl enable cockpit.socket
systemctl start cockpit.socket
firewall-cmd --add-service=cockpit --permanent
firewall-cmd --reload
fi
# Disable firewalld
if [[ "$disablefirewalld" -eq "1" ]]
then
systemctl stop firewalld
systemctl disable firewalld
fi
# install or update starship
curl -fsS https://starship.rs/install.sh | bash -s -- -y
# install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# install go
case $arch in
aarch64)
curl -JLO https://golang.org/dl/go1.17.2.linux-arm64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.2.linux-arm64.tar.gz
rm go1.17.2.linux-arm64.tar.gz
;;
x86_64)
curl -JLO https://golang.org/dl/go1.17.2.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.2.linux-amd64.tar.gz
rm go1.17.2.linux-amd64.tar.gz
;;
*);;
esac
echo "Add /usr/local/go/bin to the PATH environment variable"
# add gems
#gem install timetrap
if [ ! "vm.swappiness = 1" = "$(sudo sysctl vm.swappiness)" ]; then
echo "vm.swappiness = 1" >>/etc/sysctl.d/01-swapp.conf
sysctl --load /etc/sysctl.d/01-swapp.conf
fi
if [ ! "net.ipv6.conf.all.disable_ipv6 = 1" = "$(sudo sysctl net.ipv6.conf.all.disable_ipv6)" ]; then
# désactivation de ipv6 pour toutes les interfaces
# désactivation de l’auto configuration pour toutes les interfaces
echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.d/02-ipv6-disable.conf
echo "net.ipv6.conf.all.autoconf = 0" >>/etc/sysctl.d/02-ipv6-disable.conf
sysctl --load /etc/sysctl.d/02-ipv6-disable.conf
fi
if [ ! "net.ipv6.conf.default.disable_ipv6 = 1" = "$(sudo net.ipv6.conf.default.disable_ipv6)" ]; then
# désactivation de ipv6 pour les nouvelles interfaces (ex:si ajout de carte réseau)
# désactivation de l’auto configuration pour les nouvelles interfaces
echo "net.ipv6.conf.default.disable_ipv6 = 1" >>/etc/sysctl.d/02-ipv6-disable.conf
echo "net.ipv6.conf.default.autoconf = 0" >>/etc/sysctl.d/02-ipv6-disable.conf
sysctl --load /etc/sysctl.d/02-ipv6-disable.conf
fi
if [ ! "net.ipv6.conf.lo.disable_ipv6 = 1" = "$(sudo sysctl net.ipv6.conf.lo.disable_ipv6)" ]; then
echo "net.ipv6.conf.lo.disable_ipv6 = 1" >>/etc/sysctl.d/02-ipv6-disable.conf
echo "net.ipv6.conf.lo.autoconf = 0" >>/etc/sysctl.d/02-ipv6-disable.conf
sysctl --load /etc/sysctl.d/02-ipv6-disable.conf
fi
echo "Preparation completed, it is recommended to restart!"