#!/usr/bin/env bash set -eu DESC="Préparation du système pour compatibilité DIRECT, COW et TGZ." set +u [ -z "$GUEST_NAME" ] && GUEST_NAME=buster set -u updateUpgrade() { vdn-ssh root@$GUEST_NAME " [ -n "$http_proxy" ] && export http_proxy="$http_proxy" [ -n "$https_proxy" ] && export https_proxy="$https_proxy" apt-get update; apt-get -y upgrade " } # pb rpcbind : # - longueur (le service ne ne semble pas démarrer à l'INSTALLATION # mais le service rpcbind démarre au démarrage installNfs() { vdn-ssh root@$GUEST_NAME " [ -n "$http_proxy" ] && export http_proxy="$http_proxy" [ -n "$https_proxy" ] && export https_proxy="$https_proxy" export DEBIAN_FRONTEND=noninteractive; apt-get install -y nfs-common nfs-kernel-server " } installDocker() { set +u [ -z "$http_proxy" ] && http_proxy="" || : [ -z "$https_proxy" ] && https_proxy="" || : set -u # désactive le service docker, Voir les scripts de post-configuration # n'ajoute aucun utilisateur au groupe docker par défaut. Voir les scripts de post-configuration vdn-ssh -t root@$GUEST_NAME " export http_proxy=$http_proxy export https_proxy=$https_proxy apt-get update apt-get -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - apt-key fingerprint 0EBFCD88 add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/debian \$(lsb_release -cs) stable\" apt-get update apt-get -y install docker-ce docker-ce-cli containerd.io docker-compose curl -L https://raw.githubusercontent.com/docker/compose/1.24.1/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose systemctl mask containerd docker " } installQuaggaFrr() { case "$GUEST_SYS" in debian/buster) debs=quagga;; *) debs=bird2;; esac vdn-ssh root@$GUEST_NAME " [ -n "$http_proxy" ] && export http_proxy="$http_proxy" [ -n "$https_proxy" ] && export https_proxy="$https_proxy" export DEBIAN_FRONTEND=noninteractive; apt-get remove --purge -y frr " vdn-ssh root@$GUEST_NAME " [ -n "$http_proxy" ] && export http_proxy="$http_proxy" [ -n "$https_proxy" ] && export https_proxy="$https_proxy" export DEBIAN_FRONTEND=noninteractive; apt-get install -y $debs " } installModulesReseaux() { # paquets problématiques retirés : # rpcbind : le paramétrage lors de l'installation du paquet bloque 90s # nfs-common nfs-kernel-server # quagga # user-mode-linux ### pour bookworm # curlftpfs vim-gtk glib-2.0-dev DEBS="less ssh mingetty rsync net-tools haveged rng-tools dnsutils zerofree" DEBS="$DEBS vim slirp" DEBS="$DEBS sshfs psmisc bsdutils strace busybox-static" DEBS="$DEBS traceroute iptables tcpdump wireshark-gtk nmap" DEBS="$DEBS manpages" DEBS="$DEBS ftp curl dillo" DEBS="$DEBS libapache2-mod-php apache2-doc" DEBS="$DEBS xbase-clients" DEBS="$DEBS lynx psmisc file strace lsof telnet links links2" DEBS="$DEBS iputils-ping" DEBS="$DEBS rsync dialog" DEBS="$DEBS firefox-esr" DEBS="$DEBS nautilus" DEBS="$DEBS openvpn" DEBS="$DEBS proftpd isc-dhcp-server" DEBS="$DEBS busybox-static debootstrap" DEBS="$DEBS gedit" DEBS="$DEBS gpm vde2" DEBS="$DEBS spice-vdagent" DEBS="$DEBS gpm vde2" DEBS="$DEBS gcc make autoconf uidmap pkg-config \ glib-2.0 libglib2.0-dev dpkg-dev \ libcap-dev libcap2 libseccomp2 libseccomp-dev" # TP Pascal : DEBS="$DEBS john hashcat sqlmap php default-mysql-server" echo "apt-get..." vdn-ssh -t root@$GUEST_NAME " [ -n "$http_proxy" ] && export http_proxy="$http_proxy" [ -n "$https_proxy" ] && export https_proxy="$https_proxy" export DEBIAN_FRONTEND=noninteractive apt-get install -y $DEBS " # cas de lighttpd vdn-ssh -t root@$GUEST_NAME " [ -n "$http_proxy" ] && export http_proxy="$http_proxy" [ -n "$https_proxy" ] && export https_proxy="$https_proxy" export DEBIAN_FRONTEND=noninteractive; apt-get install -y lighttpd systemctl disable lighttpd " # disable services # remove : nfs-kernel-server nfs-blkmap nfs-server local l="ModemManager NetworkManager NetworkManager-dispatcher NetworkManager-wait-online anacron apparmor autovt@ bgpd dbus-fi.w1.wpa_supplicant1 dbus-org.freedesktop.Avahi dbus-org.freedesktop.ModemManager1 dbus-org.freedesktop.nm-dispatcher dbus-org.freedesktop.timesync1 getty@ hddtemp isisd lighttpd lm-sensors network-manager nmbd openbsd-inetd openvpn ospf6d ospfd pimd portmap pppd-dns ripd ripngd rpcbind rsync smbd speech-dispatcher syslog systemd-timesyncd udisks2 wpa_supplicant zebra uml-utilities apache2 proftpd isc-dhcp-server mariadb haveged nfs-server bird" vdn-ssh -t root@$GUEST_NAME "for i in $l; do echo \"Disable \$i\"; systemctl disable \$i; done" } installLocales() { vdn-ssh root@$GUEST_NAME " [ -n "$http_proxy" ] && export http_proxy="$http_proxy" [ -n "$https_proxy" ] && export https_proxy="$https_proxy" export DEBIAN_FRONTEND=noninteractive set -a; . /etc/vdn/config; set +a cat << END > /etc/default/locale # File generated by update-locale LANG="$DEFAULT_LANG" END sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen sed -i -e 's/# $DEFAULT_LANG UTF-8/$DEFAULT_LANG UTF-8/' /etc/locale.gen dpkg-reconfigure --frontend=noninteractive locales update-locale LANG=$DEFAULT_LANG " } installKeyboard() { vdn-ssh root@$GUEST_NAME " [ -n "$http_proxy" ] && export http_proxy="$http_proxy" [ -n "$https_proxy" ] && export https_proxy="$https_proxy" export DEBIAN_FRONTEND=noninteractive set -a; . /etc/vdn/config; set +a cat << END > /etc/default/keyboard # KEYBOARD CONFIGURATION FILE # Consult the keyboard(5) manual page. XKBMODEL="$XKBMODEL" XKBLAYOUT="$XKBLAYOUT" XKBVARIANT="$XKBVARIANT" XKBOPTIONS="$XKBOPTIONS" BACKSPACE="$BACKSPACE" END " } installTimezone() { ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime } installAll() { updateUpgrade installLocales installTimezone installKeyboard #installQuaggaFrr installModulesReseaux installDocker installNfs } run() { . $VDN_PATH/bin/functions-scripts.sh . $VDN_PATH/bin/functions-build.sh setErrorHandler echoStart set -a . $NETWORK_DIR/$GUEST_NAME.conf set +a GUEST_DIR=$VDN_PATH/distribs/guests/direct/$GUEST_SYS echo "HDA=$VDN_PATH/files/$HDA" [ ! -e $VDN_PATH/files/$HDA ] && \ debootstrap vdn-start $GUEST_NAME sleep 1 waitSsh $GUEST_NAME set +u [ -z "$http_proxy" ] && http_proxy="" || : [ -z "$https_proxy" ] && https_proxy="" || : set -u installAll cleanHistory $GUEST_NAME vdn-halt $GUEST_NAME unsetErrorHandler echoDone }