Commit 039138e6 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼 Committed by Lu Xu

Remove obsolete racks

parent 4cf44b88
#!/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=10.0.45.1
DHCP_RANGE=10.0.45.100,static,255.255.255.0
ROUTER_ADDR=10.0.45.1
DNS_SERVER=1.2.4.8
#This is to make linux output visible in IPMI SOL. Remove if you are using a graphical card.
common=console=ttyS1,57600
mac='
b8:59:9f:07:7d:f3
b8:59:9f:07:7f:c3
b8:59:9f:07:7f:bb
b8:59:9f:07:81:cb
b8:59:9f:07:7e:03
b8:59:9f:07:80:6b
b8:59:9f:07:89:b3
'
i=2
hostname_prefix=xinzhou-tiogapass-
(
#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.cfg language=C country=CN keymap=us hostname=${hostname_prefix}\$i domain= --- 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 ens9f1
iface ens9f1 inet static
address 10.0.45.$(( 50 + $i ))/24
gateway 10.0.45.1
dns-nameservers 1.2.4.8 223.5.5.5 223.6.6.6
#allow-hotplug ens9f0
##iface ens9f0 inet dhcp
#iface ens9f0 inet static
# address 113.24.192.26/30
# gateway 113.24.192.25
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=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.cn.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string http://10.0.45.51:3142
d-i partman/early_command string set -e; x=`grep -l 468862128 /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 : 1024 1 1024 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 10.0.45.51; \
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 10.0.45.51; \
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
#!/bin/bash
# To install CentOS apache must be installed and server CentOS base
# root@raspberrypi:/ apt install apache2 -y
# root@raspberrypi:/ systemctl start httpd
# root@raspberrypi:/var/www/html# cp -a /root/rapidspace-autoinstall-os/centos-installer/ .
# root@raspberrypi:/var/www/html# chown pi: -R centos-installer/
# root@raspberrypi:/var/www/html# wget http://192.168.46.2/centos-installer/media.repo # just check
set -e
SCRIPT_DIR=$(realpath `dirname "$0"`)
. $SCRIPT_DIR/download_boot_systems.sh
download_debian_10_if_needed
download_sysrescuecd_if_needed
download_centos_8_if_needed
#UPDATE THOSE VARIABLES DEPENDING ON YOUR SITE
MY_IF_NAME=ens9f1
MY_IP_ADDR=124.163.255.99
DHCP_RANGE=124.163.255.99,static,255.255.255.0
ROUTER_ADDR=124.163.255.97
DNS_SERVER=1.2.4.8
#This is to make linux output visible in IPMI SOL. Remove if you are using a graphical card.
common=console=ttyS1,57600
mac='
b8:59:9f:07:84:bb
b8:59:9f:07:81:db
b8:59:9f:07:80:53
b8:59:9f:07:89:4b
b8:59:9f:07:81:f3
b8:59:9f:07:80:4b
b8:59:9f:07:82:ab
b8:59:9f:07:7e:23
b8:59:9f:07:80:73
b8:59:9f:07:7e:13
b8:59:9f:07:80:63
'
i=1
hostname_prefix=xinzhou-unicom-tiogapass-
(
#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 10' {
linux /debian-installer/amd64/linux vga=788 url=tftp://\$pxe_default_server/preseed.cfg language=C country=CN keymap=us hostname=${hostname_prefix}\$i domain= --- mitigations=off $common
initrd /debian-installer/amd64/initrd.gz
}
menuentry 'Install CentOS' {
linux /centos-installer/images/pxeboot/vmlinuz checksum ip=dhcp inst.text inst.repo=http://\$pxe_default_server/centos-installer/ $common
initrd /centos-installer/images/pxeboot/initrd.img
}
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 ens9f1
iface ens9f1 inet static
address 124.163.255.$(( 98 + $i ))/27
gateway 124.163.255.97
dns-nameservers 1.2.4.8 223.5.5.5 223.6.6.6
#allow-hotplug ens9f0
##iface ens9f0 inet dhcp
#iface ens9f0 inet static
# address 113.24.192.26/30
# gateway 113.24.192.25
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=b8:59:9f:07:84:bb,124.163.255.99,1h \
--dhcp-host=b8:59:9f:07:81:db,124.163.255.100,1h \
--dhcp-host=b8:59:9f:07:80:53,124.163.255.101,1h \
--dhcp-host=b8:59:9f:07:89:4b,124.163.255.102,1h \
--dhcp-host=b8:59:9f:07:81:f3,124.163.255.103,1h \
--dhcp-host=b8:59:9f:07:80:4b,124.163.255.104,1h \
--dhcp-host=b8:59:9f:07:82:ab,124.163.255.105,1h \
--dhcp-host=b8:59:9f:07:7e:23,124.163.255.106,1h \
--dhcp-host=b8:59:9f:07:80:73,124.163.255.107,1h \
--dhcp-host=b8:59:9f:07:7e:13,124.163.255.108,1h \
--dhcp-host=b8:59:9f:07:80:63,124.163.255.109,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.cn.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string http://124.163.255.99:3142
d-i partman/early_command string set -e; x=`grep -l 468862128 /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 : 1024 1 1024 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 124.163.255.99; \
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 124.163.255.99; \
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