134 lines
3.6 KiB
Bash
134 lines
3.6 KiB
Bash
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
apt-get install -y git wget ctorrent debconf
|
|
cd /srv
|
|
wget http://ftp.debian.org/debian/dists/stable/main/installer-amd64/current/images/hd-media/gtk/initrd.gz http://ftp.debian.org/debian/dists/stable/main/installer-amd64/current/images/hd-media/gtk/vmlinuz http://ftp.debian.org/debian/pool/main/u/util-linux/fdisk-udeb_2.33.1-0.1_amd64.udeb
|
|
mkdir initrd_with_fdisk
|
|
cd initrd_with_fdisk
|
|
gunzip -c ../initrd.gz | cpio -id
|
|
dpkg-deb -x ../fdisk-udeb_2.33.1-0.1_amd64.udeb .
|
|
find . | cpio --create --format='newc' | gzip -9 > ../initrd.gz
|
|
cd ..
|
|
rm -rf initrd_with_fdisk fdisk-udeb_2.33.1-0.1_amd64.udeb
|
|
|
|
cat <<EOT >> /srv/download.sh
|
|
#!/bin/bash
|
|
wget https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.10.0-amd64-netinst.iso
|
|
#wget https://cdimage.debian.org/debian-cd/current/amd64/bt-dvd/debian-12.10.0-amd64-DVD-1.iso.torrent
|
|
#ctorrent debian-12.10.0-amd64-DVD-1.iso.torrent
|
|
|
|
EOT
|
|
|
|
chmod 755 download.sh
|
|
|
|
git clone https://salsa.debian.org/installer-team/babelbox.git
|
|
cd babelbox
|
|
|
|
echo "" > preseed_early
|
|
cat <<EOT >> preseed_early
|
|
#!/bin/sh
|
|
|
|
# Script run at the beginning of the installation (as set in preseed.cfg).
|
|
|
|
set -e
|
|
|
|
. /usr/share/debconf/confmodule
|
|
db_subst babelbox/info LANGNAME "German" || true
|
|
db_info babelbox/info || true
|
|
|
|
mkdir -p /lib/partman/init.d
|
|
cp /hd-media/srv/babelbox/00del_partition /lib/partman/init.d/
|
|
|
|
apt-install alsa-base || true
|
|
apt-install alsa-utils || true
|
|
|
|
exit 0
|
|
|
|
EOT
|
|
|
|
echo "" > langlist
|
|
cat <<EOT >> langlist
|
|
de_DE::German
|
|
EOT
|
|
|
|
echo "" > babelbox-grub
|
|
cat <<EOT >> babelbox-grub
|
|
menuentry 'BabelBox install' --class debian --class gnu-linux --class gnu --class os {
|
|
insmod part_msdos
|
|
insmod ext2
|
|
set root='(hd0,1)'
|
|
echo 'Loading Linux ...'
|
|
gfxpayload=800x600x16,800x600
|
|
linux /srv/vmlinuz video=vesa:ywrap,mtrr priority=critical console-keymaps-at/keymap=de keyboard-configuration/xkb-keymap=de file=/hd-media/srv/babelbox/preseed.cfg debian-installer/locale=de_DE
|
|
echo 'Loading initial ramdisk ...'
|
|
initrd /srv/initrd.gz
|
|
}
|
|
|
|
menuentry 'BabelBox demo' --class debian --class gnu-linux --class gnu --class os {
|
|
insmod part_msdos
|
|
insmod ext2
|
|
set root='(hd0,5)'
|
|
echo 'Loading Linux ...'
|
|
gfxpayload=800x600x16,800x600
|
|
linux /vmlinuz root=/dev/sda5 ro quiet
|
|
echo 'Loading initial ramdisk ...'
|
|
initrd /initrd.img
|
|
}
|
|
EOT
|
|
|
|
echo "" > cronscript
|
|
cat <<EOT >> cronscript
|
|
#! /bin/bash
|
|
|
|
# Script to prepare babelbox for the next install: switch language to the
|
|
# next in the list. Normally run from installed system, but can also be run
|
|
# from the base system that controls the babelbox runs.
|
|
# It takes the top line from langlist as the next language and moves that
|
|
# line to the bottom of the list.
|
|
|
|
set -e
|
|
|
|
ROOT=""
|
|
|
|
if [ -f /BABELBOX ] ; then
|
|
ROOT="/mnt"
|
|
sleep 30
|
|
|
|
mount /dev/sda1 $ROOT
|
|
fi
|
|
|
|
cd $ROOT/srv/babelbox
|
|
|
|
LANG="de_DE::German"
|
|
#NEXTLANG="de_DE:x:German"
|
|
|
|
LOCALE=$(echo "$LANG" | cut -d: -f1)
|
|
LANGNAME=$(echo "$LANG" | cut -d: -f3)
|
|
GRUBLINE=$(echo "$LANG" | cut -d: -f4)
|
|
|
|
sed -i "s/LANGNAME \".*\"/LANGNAME \"$LANGNAME\"/" preseed_early
|
|
|
|
sed -i "s/locale=.*$/locale=$LOCALE $GRUBLINE/
|
|
s/^\([[:space:]]*\)set default=\"[[:digit:]]*\"$/\1set default=\"2\"/" $ROOT/boot/grub/grub.cfg
|
|
|
|
# Comment out the next three lines if you don't want the language to change
|
|
#N_LOCALE=$(echo "$NEXTLANG" | cut -d: -f1)
|
|
#sed -i "s/:x:/::/;s/^$N_LOCALE::/$N_LOCALE:x:/" langlist
|
|
|
|
if [ -z "$ROOT" ]; then
|
|
echo "Next language: $LANGNAME"
|
|
fi
|
|
|
|
exit 0
|
|
|
|
EOT
|
|
|
|
|
|
|
|
cat babelbox-grub >> /etc/grub.d/40_custom
|
|
update-grub
|
|
./cronscript
|
|
|
|
echo "You need to download a Debian amd64 DVD ISO into /srv"
|