mirror of https://github.com/01-edu/public.git
Xavier Petit
4 years ago
committed by
xpetit
14 changed files with 267 additions and 350 deletions
@ -1,68 +0,0 @@ |
|||||||
#!/usr/bin/env bash |
|
||||||
|
|
||||||
# Configure Terminal |
|
||||||
|
|
||||||
script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" |
|
||||||
cd $script_dir |
|
||||||
. set.sh |
|
||||||
|
|
||||||
# Makes bash case-insensitive |
|
||||||
cat <<EOF>> /etc/inputrc |
|
||||||
set completion-ignore-case |
|
||||||
set show-all-if-ambiguous On |
|
||||||
set show-all-if-unmodified On |
|
||||||
EOF |
|
||||||
|
|
||||||
# Enhance Linux prompt |
|
||||||
cat <<EOF> /etc/issue |
|
||||||
Kernel build: \v |
|
||||||
Kernel package: \r |
|
||||||
Date: \d \t |
|
||||||
IP address: \4 |
|
||||||
Terminal: \l@\n.\O |
|
||||||
|
|
||||||
EOF |
|
||||||
|
|
||||||
# Enable Bash completion |
|
||||||
apt-get -y install bash-completion |
|
||||||
|
|
||||||
cat <<EOF>> /etc/bash.bashrc |
|
||||||
if ! shopt -oq posix; then |
|
||||||
if [ -f /usr/share/bash-completion/bash_completion ]; then |
|
||||||
. /usr/share/bash-completion/bash_completion |
|
||||||
elif [ -f /etc/bash_completion ]; then |
|
||||||
. /etc/bash_completion |
|
||||||
fi |
|
||||||
fi |
|
||||||
EOF |
|
||||||
|
|
||||||
# Set-up all users |
|
||||||
for dir in $(ls -1d /root /home/* 2>/dev/null ||:) |
|
||||||
do |
|
||||||
# Hide login informations |
|
||||||
touch $dir/.hushlogin |
|
||||||
|
|
||||||
# Add convenient aliases & behaviors |
|
||||||
cat <<-'EOF'>> $dir/.bashrc |
|
||||||
export LS_OPTIONS="--color=auto" |
|
||||||
eval "`dircolors`" |
|
||||||
|
|
||||||
alias df="df --si" |
|
||||||
alias du="du -cs --si" |
|
||||||
alias free="free -h --si" |
|
||||||
alias l="ls $LS_OPTIONS -al --si" |
|
||||||
alias less="less -i" |
|
||||||
alias nano="nano -clDOST4" |
|
||||||
alias pstree="pstree -palU" |
|
||||||
|
|
||||||
GOPATH=$HOME/go |
|
||||||
HISTCONTROL=ignoreboth |
|
||||||
HISTFILESIZE= |
|
||||||
HISTSIZE= |
|
||||||
HISTTIMEFORMAT="%F %T " |
|
||||||
EOF |
|
||||||
|
|
||||||
# Fix rights |
|
||||||
usr=$(echo "$dir" | rev | cut -d/ -f1 | rev) |
|
||||||
chown -R $usr:$usr $dir ||: |
|
||||||
done |
|
@ -1,55 +0,0 @@ |
|||||||
#!/usr/bin/env bash |
|
||||||
|
|
||||||
# Clean system |
|
||||||
|
|
||||||
script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" |
|
||||||
cd $script_dir |
|
||||||
. set.sh |
|
||||||
|
|
||||||
# Purge useless packages |
|
||||||
apt-get -y autoremove --purge |
|
||||||
apt-get autoclean |
|
||||||
apt-get clean |
|
||||||
apt-get install |
|
||||||
|
|
||||||
rm -rf /root/.local |
|
||||||
|
|
||||||
# Remove connection logs |
|
||||||
> /var/log/lastlog |
|
||||||
> /var/log/wtmp |
|
||||||
> /var/log/btmp |
|
||||||
|
|
||||||
# Remove machine ID |
|
||||||
> /etc/machine-id |
|
||||||
|
|
||||||
# Remove logs |
|
||||||
cd /var/log |
|
||||||
rm -rf alternatives.log* |
|
||||||
rm -rf apt/* |
|
||||||
rm -rf auth.log |
|
||||||
rm -rf dpkg.log* |
|
||||||
rm -rf gpu-manager.log |
|
||||||
rm -rf installer |
|
||||||
rm -rf journal/d6e982aa8c9d4c1dbcbdcff195642300 |
|
||||||
rm -rf kern.log |
|
||||||
rm -rf syslog |
|
||||||
rm -rf sysstat |
|
||||||
|
|
||||||
# Remove random seeds |
|
||||||
rm -rf /var/lib/systemd/random-seed |
|
||||||
rm -rf /var/lib/NetworkManager/secret_key |
|
||||||
|
|
||||||
# Remove network configs |
|
||||||
rm -rf /etc/NetworkManager/system-connections/* |
|
||||||
rm -rf /var/lib/bluetooth/* |
|
||||||
rm -rf /var/lib/NetworkManager/* |
|
||||||
|
|
||||||
# Remove caches |
|
||||||
rm -rf /var/lib/gdm3/.cache/* |
|
||||||
rm -rf /root/.cache |
|
||||||
rm -rf /home/student/.cache |
|
||||||
|
|
||||||
rm -rf /home/student/.sudo_as_admin_successful /home/student/.bash_logout |
|
||||||
|
|
||||||
rm -rf /tmp/* |
|
||||||
rm -rf /tmp/.* ||: |
|
@ -1,14 +0,0 @@ |
|||||||
#!/usr/bin/env bash |
|
||||||
|
|
||||||
# Install Docker |
|
||||||
|
|
||||||
script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" |
|
||||||
cd $script_dir |
|
||||||
. set.sh |
|
||||||
|
|
||||||
apt-get -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common |
|
||||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - |
|
||||||
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu disco stable" |
|
||||||
apt-get update |
|
||||||
apt-get -y install docker-ce docker-ce-cli containerd.io |
|
||||||
adduser student docker |
|
@ -1,32 +0,0 @@ |
|||||||
#!/usr/bin/env bash |
|
||||||
|
|
||||||
# Install Exam app |
|
||||||
|
|
||||||
script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" |
|
||||||
cd $script_dir |
|
||||||
. set.sh |
|
||||||
|
|
||||||
wget https://01.alem.school/assets/files/exam.AppImage -O /usr/local/bin/exam.AppImage |
|
||||||
chmod +x /usr/local/bin/exam.AppImage |
|
||||||
|
|
||||||
cat <<EOF> /home/student/.local/share/applications/appimagekit-exam.desktop |
|
||||||
[Desktop Entry] |
|
||||||
Name=exam |
|
||||||
Comment=the exam client |
|
||||||
Exec="/usr/local/bin/exam.AppImage" %U |
|
||||||
Terminal=false |
|
||||||
Type=Application |
|
||||||
Icon=appimagekit-exam |
|
||||||
StartupWMClass=exam |
|
||||||
X-AppImage-Version=1.0.0 |
|
||||||
MimeType=x-scheme-handler/exam; |
|
||||||
Categories=Utility; |
|
||||||
X-AppImage-BuildId=1RHp8aPhkSgD1PXGL1NW5QDsbFF |
|
||||||
X-Desktop-File-Install-Version=0.23 |
|
||||||
X-AppImage-Comment=Generated by /tmp/.mount_exam.1PqfsDP/AppRun |
|
||||||
TryExec=/usr/local/bin/exam.AppImage |
|
||||||
EOF |
|
||||||
chown student:student /home/student/.local/share/applications/appimagekit-exam.desktop |
|
||||||
|
|
||||||
sudo -iu student xdg-mime default appimagekit-exam.desktop x-scheme-handler/exam |
|
||||||
sudo -iu student go get github.com/01-edu/z01 |
|
@ -1,17 +0,0 @@ |
|||||||
#!/usr/bin/env bash |
|
||||||
|
|
||||||
# Install firewall |
|
||||||
|
|
||||||
script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" |
|
||||||
cd $script_dir |
|
||||||
. set.sh |
|
||||||
|
|
||||||
ssh_port=${1:-521} |
|
||||||
|
|
||||||
apt-get -y install ufw |
|
||||||
|
|
||||||
ufw logging off |
|
||||||
ufw allow in "$ssh_port"/tcp |
|
||||||
ufw allow in 27960:27969/tcp |
|
||||||
ufw allow in 27960:27969/udp |
|
||||||
ufw --force enable |
|
@ -1,9 +0,0 @@ |
|||||||
#!/usr/bin/env bash |
|
||||||
|
|
||||||
# Install FX: command-line JSON processing tool (https://github.com/antonmedv/fx) |
|
||||||
|
|
||||||
script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" |
|
||||||
cd $script_dir |
|
||||||
. set.sh |
|
||||||
|
|
||||||
npm install -g fx |
|
@ -1,28 +0,0 @@ |
|||||||
#!/usr/bin/env bash |
|
||||||
|
|
||||||
# Install Go |
|
||||||
|
|
||||||
script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" |
|
||||||
cd $script_dir |
|
||||||
. set.sh |
|
||||||
|
|
||||||
wget https://dl.google.com/go/go1.14.1.linux-amd64.tar.gz |
|
||||||
tar -C /usr/local -xzf go1.14.1.linux-amd64.tar.gz |
|
||||||
rm go1.14.1.linux-amd64.tar.gz |
|
||||||
echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile |
|
||||||
|
|
||||||
# Set-up all users |
|
||||||
for dir in $(ls -1d /root /home/* 2>/dev/null ||:) |
|
||||||
do |
|
||||||
# Add convenient aliases & behaviors |
|
||||||
cat <<-'EOF'>> $dir/.bashrc |
|
||||||
GOPATH=$HOME/go |
|
||||||
PATH=$PATH:$GOPATH/bin |
|
||||||
alias gobuild='CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w"' |
|
||||||
EOF |
|
||||||
echo 'GOPATH=$HOME/go' >> $dir/.profile |
|
||||||
|
|
||||||
# Fix rights |
|
||||||
usr=$(echo "$dir" | rev | cut -d/ -f1 | rev) |
|
||||||
chown -R $usr:$usr $dir ||: |
|
||||||
done |
|
@ -1,23 +0,0 @@ |
|||||||
#!/usr/bin/env bash |
|
||||||
|
|
||||||
# Install Grub |
|
||||||
|
|
||||||
script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" |
|
||||||
cd $script_dir |
|
||||||
. set.sh |
|
||||||
|
|
||||||
disk=$1 |
|
||||||
|
|
||||||
sed -i -e 's/message=/message_null=/g' /etc/grub.d/10_linux |
|
||||||
|
|
||||||
cat <<EOF>> /etc/default/grub |
|
||||||
GRUB_TIMEOUT=0 |
|
||||||
GRUB_RECORDFAIL_TIMEOUT=0 |
|
||||||
GRUB_TERMINAL=console |
|
||||||
GRUB_DISTRIBUTOR=`` |
|
||||||
GRUB_DISABLE_OS_PROBER=true |
|
||||||
GRUB_DISABLE_SUBMENU=y |
|
||||||
EOF |
|
||||||
|
|
||||||
update-grub |
|
||||||
grub-install $disk |
|
@ -1,9 +0,0 @@ |
|||||||
#!/usr/bin/env bash |
|
||||||
|
|
||||||
# Install VSCode |
|
||||||
|
|
||||||
script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" |
|
||||||
cd $script_dir |
|
||||||
. set.sh |
|
||||||
|
|
||||||
apt-get -y install libreoffice |
|
@ -1,10 +0,0 @@ |
|||||||
#!/usr/bin/env bash |
|
||||||
|
|
||||||
# Install Node.js |
|
||||||
|
|
||||||
script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" |
|
||||||
cd $script_dir |
|
||||||
. set.sh |
|
||||||
|
|
||||||
curl -sL https://deb.nodesource.com/setup_12.x | bash - |
|
||||||
apt-get -y install nodejs |
|
@ -1,18 +0,0 @@ |
|||||||
#!/usr/bin/env bash |
|
||||||
|
|
||||||
# Install OpenSSH |
|
||||||
|
|
||||||
script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" |
|
||||||
cd $script_dir |
|
||||||
. set.sh |
|
||||||
|
|
||||||
ssh_port=${1:-521} |
|
||||||
|
|
||||||
# Install dependencies |
|
||||||
apt-get -y install ssh |
|
||||||
|
|
||||||
cat <<EOF>> /etc/ssh/sshd_config |
|
||||||
Port $ssh_port |
|
||||||
PasswordAuthentication no |
|
||||||
AllowUsers root |
|
||||||
EOF |
|
@ -1,17 +0,0 @@ |
|||||||
#!/usr/bin/env bash |
|
||||||
|
|
||||||
# Install Sublime Text & Sublime Merge |
|
||||||
|
|
||||||
script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" |
|
||||||
cd $script_dir |
|
||||||
. set.sh |
|
||||||
|
|
||||||
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | apt-key add - |
|
||||||
apt-get install -y apt-transport-https |
|
||||||
|
|
||||||
cat <<EOF> /etc/apt/sources.list.d/sublime-text.list |
|
||||||
deb https://download.sublimetext.com/ apt/stable/ |
|
||||||
EOF |
|
||||||
|
|
||||||
apt-get update |
|
||||||
apt-get install -y sublime-text sublime-merge libgtk2.0-0 |
|
@ -1,37 +0,0 @@ |
|||||||
#!/usr/bin/env bash |
|
||||||
|
|
||||||
# Install VSCode |
|
||||||
|
|
||||||
script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" |
|
||||||
cd $script_dir |
|
||||||
. set.sh |
|
||||||
|
|
||||||
wget https://github.com/VSCodium/vscodium/releases/download/1.41.1/codium_1.41.1-1576787344_amd64.deb |
|
||||||
dpkg -i codium_1.41.1-1576787344_amd64.deb |
|
||||||
rm codium_1.41.1-1576787344_amd64.deb |
|
||||||
|
|
||||||
ln -s /usr/bin/codium /usr/local/bin/code |
|
||||||
|
|
||||||
# Set-up all users |
|
||||||
for dir in $(ls -1d /home/* 2>/dev/null ||:) |
|
||||||
do |
|
||||||
# Disable most of the telemetry and auto-updates |
|
||||||
mkdir -p $dir/.config/VSCodium/User |
|
||||||
cat <<-'EOF'> $dir/.config/VSCodium/User/settings.json |
|
||||||
{ |
|
||||||
"telemetry.enableCrashReporter": false, |
|
||||||
"update.enableWindowsBackgroundUpdates": false, |
|
||||||
"update.mode": "none", |
|
||||||
"update.showReleaseNotes": false, |
|
||||||
"extensions.autoCheckUpdates": false, |
|
||||||
"extensions.autoUpdate": false, |
|
||||||
"workbench.enableExperiments": false, |
|
||||||
"workbench.settings.enableNaturalLanguageSearch": false, |
|
||||||
"npm.fetchOnlinePackageInfo": false |
|
||||||
} |
|
||||||
EOF |
|
||||||
|
|
||||||
# Fix rights |
|
||||||
usr=$(echo "$dir" | rev | cut -d/ -f1 | rev) |
|
||||||
chown -R $usr:$usr $dir ||: |
|
||||||
done |
|
Loading…
Reference in new issue