linuxinstall/scripts/sandbox-install

144 lines
5.0 KiB
Plaintext
Raw Normal View History

#!/bin/bash
# This script is used to install and setup a sandbox.
PACKAGES=(
2024-04-29 17:28:02 +02:00
"linux-lts" "linux-firmware" "base" "base-devel" "syslinux" "vi" "emacs" "vim" "nano"
2024-05-21 11:01:08 +02:00
"micro" "neovim" "bash-completion" "btop" "gdu" "git" "curl" "wget" "rsync"
"unzip" "zip" "gdb" "jdk-openjdk" "openjdk-doc" "tcpdump" "openssh" "bind" "inetutils"
"nmap" "firefox" "firefox-i18n-fr" "libreoffice" "libreoffice-fr" "rpcbind" "nfs-utils"
"xfce4" "xfce4-goodies" "yakuake" "gimp" "xorg" "xf86-video-vesa" "xf86-video-dummy"
"ttf-dejavu" "ttf-liberation" "ttf-bitstream-vera" "acpid" "sdl12-compat" "sdl_ttf"
"sdl_gfx" "sdl_image" "sdl_mixer" "sdl_net" "sdl_sound" "sdl2_gfx" "sdl2_image"
2024-05-21 10:59:54 +02:00
"sdl2_mixer" "sdl2_net" "sdl2_ttf" "dosfstools" "ntfs-3g" "ntp" "subversion" "cvs"
"breezy" "python" "wireshark-qt" "wireshark-cli" "evince" "dbus" "mlocate" "gvfs"
"strace" "net-tools" "postfix" "sudo" "gtksourceview3" "mplayer" "cronie" "optipng"
"lib32-glibc" "libvirt" "qt5" "xterm" "graphviz" "vlc" "pulseaudio" "pulseaudio-alsa"
2024-09-03 16:34:46 +02:00
"tmux" "sleuthkit" "tk" "tcl" "junit" "lightdm" "samba" "bind" "krb5" "tree"
"time" "noto-fonts" "noto-fonts-cjk" "noto-fonts-emoji" "noto-fonts-extra" "numlockx"
2024-04-30 00:49:09 +02:00
"lightdm-gtk-greeter" "tigervnc" "xfce4-pulseaudio-plugin" "docker" "docker-compose"
2024-04-30 18:18:23 +02:00
"android-tools" "opam" "jdk17-openjdk" "vde2" "shellcheck" "man-db" "man-pages"
2024-09-03 16:34:46 +02:00
"man-pages-fr" "duf" "eza" "bat" "clang" "socat" "iputils" "termshark"
2024-04-30 00:49:09 +02:00
)
PACKAGES_AUR=(
"imunes" "saxon6" "staruml" "xfce4-pulseaudio-plugin" "pa-applet-git" "sublime-text"
"android-studio" "android-sdk" "android-sdk-platform-tools" "android-sdk-build-tools"
"android-platform" "android-platform-21" "oracle-instantclient-basic"
"oracle-sqldeveloper" "oracle-instantclient-jdbc" "oracle-instantclient-odbc"
"oracle-instantclient-sdk" "oracle-instantclient-sqlplus" "oracle-instantclient-tools"
2024-04-30 18:18:23 +02:00
"ncurses5-compat-libs" "visual-studio-code-bin" "google-chrome" "brave-bin"
)
2024-04-30 01:47:47 +02:00
SERVICES=(
"systemd-networkd.service" "systemd-resolved.service" "systemd-timesyncd.service"
2024-09-03 16:34:46 +02:00
"docker.service" "ovs-vswitchd.service"
2024-04-30 01:47:47 +02:00
)
# Enable time synchronization
timedatectl set-ntp true
# Enable parallel downloads in pacman
sed -i "s/#ParallelDownloads = 5/ParallelDownloads = 16/" /etc/pacman.conf
# Update the keyring
pacman -Sy --noconfirm archlinux-keyring
# Install the base system
2024-09-03 16:34:46 +02:00
#pacstrap -K /mnt "${PACKAGES[@]}"
pacman -S "${PACKAGES[@]}"
# Generate the fstab file
2024-09-03 16:34:46 +02:00
#genfstab -U /mnt >>/mnt/etc/fstab
# Chroot into the new system
2024-09-03 16:34:46 +02:00
#arch-chroot /mnt /bin/bash <<EOF
# Disable history in the shell
2024-09-03 16:34:46 +02:00
#set +o history
# Set the timezone
ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime
# Set the hardware clock time standard
hwclock --systohc
# Generate the locales
sed -i "s/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/" /etc/locale.gen
sed -i "s/#fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/" /etc/locale.gen
locale-gen
# Set the default locale
echo "LANG=en_US.UTF-8" > /etc/locale.conf
# Set the keyboard layout
echo "KEYMAP=fr-latin1" > /etc/vconsole.conf
# Set the hostname
2024-09-02 11:45:03 +02:00
echo "salle222-" > /etc/hostname
# Install syslinux
2024-09-03 16:34:46 +02:00
#syslinux-install_update -iam
2024-05-21 10:41:53 +02:00
# Disable multicast DNS and LLMNR
sed -i 's/#LLMNR=no/LLMNR=no/g' /etc/systemd/resolved.conf
sed -i 's/#MulticastDNS=no/MulticastDNS=no/g' /etc/systemd/resolved.conf
# Configure the network for DHCP
echo "[Match]
Name=en*
[Network]
DHCP=yes
" > /etc/systemd/network/20-wired.network
2024-04-30 01:48:29 +02:00
# Enable case-insensitive completion
echo 'set completion-ignore-case On' >> /etc/inputrc
2024-04-30 01:47:47 +02:00
# Install AUR packages
useradd --no-user-group -g users --create-home --home-dir /tmp/aur-install aur-install
echo "aur-install ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/aur-install
su aur-install
cd /tmp/aur-install
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg --syncdeps --install --needed --noconfirm
yay -Syu --noconfirm "${PACKAGES_AUR[@]}"
exit
rm /etc/sudoers.d/aur-install
userdel --remove --force aur-install
2024-04-30 01:49:05 +02:00
# Android Studio config
echo "
# DRI video devices
SUBSYSTEM==\"drm\", KERNEL==\"card*|renderD*\", MODE=\"0666\"
# Enable access to virtualization device to all users
SUBSYSTEM==\"misc\", KERNEL==\"kvm\", MODE=\"0666\"
" >> /etc/udev/rules.d/65-kvm.rules
# ajouter le fichier /etc/X11/xorg.conf.d/20-radeon.conf
echo "Section \"DRI\"
Mode 0666
EndSection" >> /etc/X11/xorg.conf.d/20-radeon.conf
chmod 1755 /opt/android-sdk/platform-tools/adb
chmod 1755 /opt/android-sdk/tools/emulator
2024-04-30 01:49:55 +02:00
# Installation de la librairie graphique de Denis
cd /tmp
wget -O bibliotheque-graphique-iut-1.1.tar.gz https://grond.iut-fbleau.fr/IUT/bibliotheque-graphique/archive/1.1.tar.gz
tar xzvf bibliotheque-graphique-iut-1.1.tar.gz
cd bibliotheque-graphique
./configure
make
make install
# Fix Oracle SQL Developer
sed -i '/^#!\/bin\/bash/a export JAVA_HOME=\/usr\/lib\/jvm\/java-17-openjdk\nexport LD_LIBRARY_PATH=\/usr\/lib\/jvm\/java-17-openjdk\/lib\/server:\/usr\/lib\/jvm\/java-17-openjdk\/lib' /usr/bin/oracle-sqldeveloper
# Enable the services
2024-04-30 01:47:47 +02:00
systemctl enable "${SERVICES[@]}"
EOF
2024-05-21 11:04:29 +02:00
# DNS configuration
ln -sf ../run/systemd/resolve/stub-resolv.conf /mnt/etc/resolv.conf