Skip to content

Instantly share code, notes, and snippets.

@cocus
Last active March 29, 2024 02:13
Show Gist options
  • Save cocus/4f236954ab5309171c4ca36cce723c3c to your computer and use it in GitHub Desktop.
Save cocus/4f236954ab5309171c4ca36cce723c3c to your computer and use it in GitHub Desktop.
#!/bin/bash
KDIR=staging
DEBIAN=$(pwd)/debian
MNT=mnt
REL=bookworm
MIRROR="http://deb.debian.org/debian"
echo "= 1. debootstrap"
sudo debootstrap --foreign --arch i386 ${REL} ${DEBIAN}/ ${MIRROR}
echo "= 2. debootstrap second stage"
sudo chroot ${DEBIAN}/ /debootstrap/debootstrap --second-stage
echo "= 3. add non-free to apt"
echo "deb ${MIRROR} ${REL} main non-free-firmware" | sudo tee -a >> ${DEBIAN}/etc/apt/sources.list > /dev/null
echo "= 4. install apps"
sudo chroot ${DEBIAN}/ /usr/bin/apt install -y network-manager nano openssh-server htop systemd-timesyncd firmware-atheros
echo "= 5. allow root login on ssh"
sudo sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config
echo "= 6. set root password"
sudo chroot ${DEBIAN}/ passwd root
echo "= 7. set hostname"
echo "modem" | sudo tee -a >> ${DEBIAN}/etc/hostname > /dev/null
echo "= 8. install kernel modules"
cd ${KDIR}
make modules_install INSTALL_MOD_PATH=${DEBIAN}/
cd -
#echo "= 9. load modules"
#echo -e "ath\nath9k_hw\nath9k_common\nath9k" | sudo tee -a >> ${DEBIAN}/etc/hostname > /dev/null
echo "= 9. fix date"
sudo ln -s /usr/share/zoneinfo/America/Argentina/Buenos_Aires ${DEBIAN}/etc/localtime
echo "= remember to copy caldata to /lib/firmware/ath10k/cal-pci-0000:03:00.0.bin"
echo "= LAST. copy to mountpoint"
sudo cp -a ${DEBIAN}/* ${MNT}/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment