Commit 2aa5caa7 authored by Xiaowu Zhang's avatar Xiaowu Zhang

Add script for lille edu

parent f61f10f3
...@@ -2,3 +2,4 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5MAMmMmojqNRoOnGc7xGoJWWAzYo2f2zO2K4elsZh ...@@ -2,3 +2,4 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5MAMmMmojqNRoOnGc7xGoJWWAzYo2f2zO2K4elsZh
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5qVcd6gclQmxL9i0Vsasy6vMiVaIjKHHNAwVBRjx0Ie+sDxaCZRJHrRGJmbDMMJBSV2vO08DgureHdDkXoLpR4M7LjgjPW/gAP3nQ9w0b8L1VixXvXiIDWIdgeD+beHrMJyZM0cbEWN1nGL0eMP8C9PWIZDvxPvAGDwW1uSDKdBtfQuLTcByWQa0IP9I/tJaC5gov8IOdWS6x7pqZW29SYoRd0HOQJfODoq8lFhtCrpMbzgXEaXTglSTXPI92URqSAqY2WXW1Aqm3baZSU5eM9HfU7a6OYC8RQ0Lywxw276uHRribLSPZelWO+HiIEu7jQ3VUIe0bXu5tgcMsuswd luke@nexedi.com-chronos ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5qVcd6gclQmxL9i0Vsasy6vMiVaIjKHHNAwVBRjx0Ie+sDxaCZRJHrRGJmbDMMJBSV2vO08DgureHdDkXoLpR4M7LjgjPW/gAP3nQ9w0b8L1VixXvXiIDWIdgeD+beHrMJyZM0cbEWN1nGL0eMP8C9PWIZDvxPvAGDwW1uSDKdBtfQuLTcByWQa0IP9I/tJaC5gov8IOdWS6x7pqZW29SYoRd0HOQJfODoq8lFhtCrpMbzgXEaXTglSTXPI92URqSAqY2WXW1Aqm3baZSU5eM9HfU7a6OYC8RQ0Lywxw276uHRribLSPZelWO+HiIEu7jQ3VUIe0bXu5tgcMsuswd luke@nexedi.com-chronos
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABA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xXOD/d1YtwkAMRQ== ivan@thinkpad ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA7WOChMVI7f6YBd9cNvbJWvDRZWxoKIhC0S10tHcG2Iod8Fge5WXrQb9XwkwI/LtpZh6NASzIvIBg0mJ0r4b8JniH2IJ96rXC6bcPAvVHU6ULAgCSoFXtkLG3leXJNshVuganCYHpu4rhgZ8ZR5Esq2V/DED7FBkoq4R7dlEpegb1r1HR8JWOVVlJbUO2+3wEDAo0gKfm900vwzqHZJJbLOXWXPmGFqMgWwV4sRx3MkOEr4dTXYvMtdZsy7vc+NftpebV+rV6CcZO6lkXDgR6EpPIVmlVeoWXfc/KnTtAz81GmazXaMpRgDb8A1KIm4fzmvVpYGkxXOD/d1YtwkAMRQ== ivan@thinkpad
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCgN3SmHx8XFUih6jCKXH4TqGrMDq0v3dIBI3GyulAbRFqPYcknwzfa7eSUbq1p0rCUZ2XbHkvXIHMCMvygOWb7gqMXXVBvqamLmZaZ/r879u/uPN63qUlRYCJ6SIRM3TZW720/09NsSuAYHVYySuZhqtLYT5AfovkhltKjjtbk8pBC72zqBQC2mDu3sWXEvHHWxnrPN/yp7Jx6ATR+08xdHYLOMtcSOgbP0HClBKkbDio/yOn4HxO02RR5Q6kA6rF0VLc00lJ1WO1wHxT3GpQUbERqPMZy7i1nEcEIfTRIS30Hfl4Qn8Q/QMYDazLwIK7LXPKshivJIIfLw/hF2UBD slapuser47@rapidspace-hosting-001
\ No newline at end of file
#!/bin/sh
set -e
SCRIPT_DIR=$(realpath `dirname "$0"`)
. $SCRIPT_DIR/download_boot_systems.sh
download_debian_10_if_needed
#UPDATE THOSE VARIABLES DEPENDING ON YOUR SITE
MY_IF_NAME=eth0
MY_IP_ADDR=192.168.46.2
DHCP_RANGE=192.168.46.100,192.168.46.200,255.255.255.0
ROUTER_ADDR=192.168.46.2
DNS_SERVER=8.8.8.8
common=console=ttyS1,57600
mac='
00:22:4d:da:ca:a8
00:22:4d:d9:0a:ab
'
i=0
hostname_list=(lille-edu-capri-002 lille-edu-tiogapass-001)
(
#echo set timeout=0
echo if false
echo then true
for mac in $mac; do
echo "elif [ \$net_default_mac = $mac ]"
echo then set hostname=${hostname_list[$i]}
i=`expr $i + 1`
done
cat <<EOF
else unset timeout
fi
menuentry 'Install Debian 10' {
linux /debian-installer/amd64/linux vga=788 url=tftp://\$pxe_default_server/preseed_lille_edu.cfg language=C country=SE keymap=us hostname=\$hostname domain= --- mitigations=off $common
initrd /debian-installer/amd64/initrd.gz
}
menuentry 'Exit' {
exit
}
EOF
) >debian-installer/amd64/grub/grub.cfg
for mac in $mac
do
hostname=${hostname_list[$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 ens1
iface ens1 inet dhcp
EOF
else
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 RJ45 interface
allow-hotplug eno1
#iface eno1 inet dhcp
iface eno1 inet static
address 192.168.46.$(( 50 + $i ))/24
# The SFP+ interface on the left
allow-hotplug ens9f1
iface ens9f1 inet dhcp
dns-nameservers 8.8.8.8
EOF
fi
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=98:03:9b:9b:8a:47,10.0.45.101,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 '468862128\|234441648' /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 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 192.168.46.2; \
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 192.168.46.2; \
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