Commit f61f10f3 authored by root's avatar root

Add scripts for Greendata in Paris

parent 668ba452
#!/bin/sh
set -e
SCRIPT_DIR=$(realpath `dirname "$0"`)
. $SCRIPT_DIR/download_boot_systems.sh
download_debian_10_if_needed
#download_sysrescuecd_if_needed
#UPDATE THOSE VARIABLES DEPENDING ON YOUR SITE
MY_IF_NAME=VLAN100
MY_IP_ADDR=178.255.101.196
DHCP_RANGE=178.255.101.196,static,255.255.255.0
ROUTER_ADDR=178.255.101.195
DNS_SERVER=8.8.8.8
common=console=ttyS1,57600
mac='
00:02:c9:27:ba:be
00:02:c9:27:8c:44
00:02:c9:9f:1e:8c
f4:52:14:c8:93:06
f4:52:14:b7:df:da
00:02:c9:27:d7:4a
f4:52:14:c7:ff:d0
f4:52:14:c9:02:64
00:02:c9:27:73:a8
f4:52:14:c8:8a:96
f4:52:14:ba:8c:ba
f4:52:14:ba:af:9a
f4:52:14:ba:af:52
f4:52:14:c7:f1:9c
f4:52:14:b9:7b:f4
00:02:c9:27:b1:64
f4:52:14:c7:e5:f0
f4:52:14:b7:cf:66
00:02:c9:9e:96:36
00:02:c9:9e:e7:90
00:02:c9:9e:64:5c
f4:52:14:d8:55:ca
f4:52:14:d7:f3:24
f4:52:14:d8:d1:86
f4:52:14:d8:e8:4e
f4:52:14:d7:a4:be
00:02:c9:9e:f4:a4
00:02:c9:9e:e9:9a
00:02:c9:9e:4e:c6
f4:52:14:d7:4b:2a
00:02:c9:9e:95:4c
00:02:c9:9e:8d:90
'
i=1
hostname_prefix=paris-winterfell-
(
#echo set timeout=0
echo if false
echo then true
for mac in $mac; do
echo "elif [ \$net_default_mac = $mac ]"
echo then set i=`printf %03u $i`
i=`expr $i + 1`
done
cat <<EOF
else unset timeout
fi
menuentry 'Install Debian' {
linux /debian-installer/amd64/linux vga=788 url=tftp://\$pxe_default_server/preseed_paris.cfg language=C country=FR keymap=fr hostname=${hostname_prefix}\$i domain= interface=ens9 --- mitigations=off $common
initrd /debian-installer/amd64/initrd.gz
}
menuentry 'SystemRescueCd' {
linux /sysresccd/sysresccd/boot/x86_64/vmlinuz archisobasedir=sysresccd archiso_http_srv=http://\$pxe_default_server:69/sysresccd/ checksum ip=dhcp $common
initrd /sysresccd/sysresccd/boot/intel_ucode.img /sysresccd/sysresccd/boot/amd_ucode.img /sysresccd/sysresccd/boot/x86_64/sysresccd.img
}
menuentry 'Exit' {
exit
}
EOF
) >debian-installer/amd64/grub/grub.cfg
for mac in $mac
do
hostname=${hostname_prefix}$(printf %03u $i)
mkdir -p $hostname
cat > $hostname/interfaces <<EOF
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eno1
#iface eno1 inet dhcp
iface eno1 inet static
address 192.168.46.$(( 50 + $i ))/24
allow-hotplug ens9
iface ens9 inet static
address 178.255.101.$(( 196 + $i ))/24
gateway 178.255.101.195
dns-nameservers 8.8.8.8
EOF
i=`expr $i + 1`
done
exec dnsmasq -d --port=0 --log-dhcp \
--interface=$MY_IF_NAME \
--bind-interfaces \
--except-interface=lo \
--listen-address=$MY_IP_ADDR \
--dhcp-range=$DHCP_RANGE \
--dhcp-option=option:router,$ROUTER_ADDR \
--dhcp-option=option:dns-server,$DNS_SERVER \
--dhcp-boot=debian-installer/amd64/grubx64.efi \
--enable-tftp --tftp-root=$(realpath `dirname "$0"`) \
--conf-file=/dev/null \
--dhcp-host=00:02:c9:27:ba:be,178.255.101.197,1h \
--dhcp-host=00:02:c9:27:8c:44,178.255.101.198,1h \
--dhcp-host=00:02:c9:9f:1e:8c,178.255.101.199,1h \
--dhcp-host=f4:52:14:c8:93:06,178.255.101.200,1h \
--dhcp-host=f4:52:14:b7:df:da,178.255.101.201,1h \
--dhcp-host=00:02:c9:27:d7:4a,178.255.101.202,1h \
--dhcp-host=f4:52:14:c7:ff:d0,178.255.101.203,1h \
--dhcp-host=f4:52:14:c9:02:64,178.255.101.204,1h \
--dhcp-host=00:02:c9:27:73:a8,178.255.101.205,1h \
--dhcp-host=f4:52:14:c8:8a:96,178.255.101.206,1h \
--dhcp-host=f4:52:14:ba:8c:ba,178.255.101.207,1h \
--dhcp-host=f4:52:14:ba:af:9a,178.255.101.208,1h \
--dhcp-host=f4:52:14:ba:af:52,178.255.101.209,1h \
--dhcp-host=f4:52:14:c7:f1:9c,178.255.101.210,1h \
--dhcp-host=f4:52:14:b9:7b:f4,178.255.101.211,1h \
--dhcp-host=00:02:c9:27:b1:64,178.255.101.212,1h \
--dhcp-host=f4:52:14:c7:e5:f0,178.255.101.213,1h \
--dhcp-host=f4:52:14:b7:cf:66,178.255.101.214,1h \
--dhcp-host=00:02:c9:9e:96:36,178.255.101.215,1h \
--dhcp-host=00:02:c9:9e:e7:90,178.255.101.216,1h \
--dhcp-host=00:02:c9:9e:64:5c,178.255.101.217,1h \
--dhcp-host=f4:52:14:d8:55:ca,178.255.101.218,1h \
--dhcp-host=f4:52:14:d7:f3:24,178.255.101.219,1h \
--dhcp-host=f4:52:14:d8:d1:86,178.255.101.220,1h \
--dhcp-host=f4:52:14:d8:e8:4e,178.255.101.221,1h \
--dhcp-host=f4:52:14:d7:a4:be,178.255.101.222,1h \
--dhcp-host=00:02:c9:9e:f4:a4,178.255.101.223,1h \
--dhcp-host=00:02:c9:9e:e9:9a,178.255.101.224,1h \
--dhcp-host=00:02:c9:9e:4e:c6,178.255.101.225,1h \
--dhcp-host=f4:52:14:d7:4b:2a,178.255.101.226,1h \
--dhcp-host=00:02:c9:9e:95:4c,178.255.101.227,1h \
--dhcp-host=00:02:c9:9e:8d:90,178.255.101.228,1h \
#d-i anna/choose_modules string network-console
#d-i network-console/password password jsdlhhil
#d-i network-console/password-again password jsdlhhil
d-i apt-setup/enable-source-repositories string false
d-i auto-install/enable string true
d-i base-installer/install-recommends string false
d-i debconf/priority string critical
#d-i finish-install/reboot_in_progress string note
d-i grub-installer/force-efi-extra-removable string true
d-i mirror/country string manual
d-i mirror/http/hostname string ftp.fr.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
d-i partman/early_command string set -e; x=`grep -l 488397168 /sys/block/*/size`; x=${x%/*}; x=/dev/${x##*/}; debconf-set partman-auto/disk $x; debconf-set grub-installer/bootdev $x
d-i partman-auto/expert_recipe string : 36 1 36 free method{ efi } format{ } . 1 1 -1 xfs method{ format } format{ } use_filesystem{ } filesystem{ xfs } mountpoint{ / } options/noatime{ } .
d-i partman-auto/method string regular
d-i partman-basicfilesystems/no_swap string false
d-i partman/choose_partition string finish
d-i partman/confirm string true
d-i partman/confirm_nooverwrite string true
d-i partman-efi/non_efi_system boolean true
d-i passwd/make-user string false
d-i passwd/root-login string true
d-i passwd/root-password string willbedeleted
d-i passwd/root-password-again string willbedeleted
d-i pkgsel/include string ssh aptitude bwm-ng ca-certificates dbus-user-session debian-goodies dnsutils eatmydata efibootmgr gdb git gnupg host htop iotop linux-cpupower linux-perf lm-sensors lsof lsb-release man-db ndisc6 netcat-openbsd python resolvconf rsync screen smartmontools socat strace systemd-coredump vim wget xz-utils
# - fix UTF-8 (C.UTF-8 globally, no C override for root)
# - only login with a ssh-key
# - restore network settings
# - ignore other OS (in particular if there are VM using whole physical drives)
# - I don't like 'quiet' on servers (https://bugs.launchpad.net/bugs/581796)
# - enable page up/down to search the history
d-i preseed/late_command string set -e; \
cd /target/root; sed -i /^mesg/q .profile; \
mkdir -m 0700 .ssh; cd .ssh; tftp -g -r authorized_keys 178.255.101.196; \
cd ../../etc; rm -f grub.d/30_otheros; echo LANG=C.UTF-8 >default/locale; \
sed -i '/history-search-/s/# //' inputrc; \
cd network; tftp -g -r `hostname`/interfaces 178.255.101.196; \
in-target sh -ec 'passwd -ld root; sed -i /^GRUB_CMDLINE_LINUX_DEFAULT=/s/quiet// /etc/default/grub; update-grub'
d-i time/zone string UTC
tasksel tasksel/first string
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment