-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure-initial-snapshot
executable file
·27 lines (24 loc) · 1.52 KB
/
configure-initial-snapshot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
set -e
set -x
export LC_ALL=C
if [ "$build_dir" = "" ]; then
build_dir="."
fi
echo unconfigured-ramroot | sudo tee $build_dir/fs/snapshot/0/etc/hostname
echo -e "auto lo\niface lo inet loopback\n\nauto eth0\niface eth0 inet dhcp" | sudo tee $build_dir/fs/snapshot/0/etc/network/interfaces
echo "#0 `date -u +"%Y-%m-%d %H:%M"` initial snapshot" | sudo tee $build_dir/fs/snapshot/0/etc/ramroot/grub-title
echo "net.ifnames=0 biosdevname=0" | sudo tee $build_dir/fs/snapshot/0/etc/ramroot/grub-extraopts
sudo mkdir -p $build_dir/fs/snapshot/0/root/.ssh
sudo cp ~/.ssh/id_rsa.pub $build_dir/fs/snapshot/0/root/.ssh/authorized_keys
echo "retry 3600;" | sudo tee -a $build_dir/fs/snapshot/0/etc/dhcp/dhclient.conf
echo "timeout 120;" | sudo tee -a $build_dir/fs/snapshot/0/etc/dhcp/dhclient.conf
echo "PasswordAuthentication no" | sudo tee -a $build_dir/fs/snapshot/0/etc/ssh/sshd_config
echo -e "ramroot\nramroot" | sudo chroot $build_dir/fs/snapshot/0 passwd
sudo cp scripts/modules $build_dir/fs/snapshot/0/etc/initramfs-tools
sudo install scripts/local-top $build_dir/fs/snapshot/0/etc/initramfs-tools/scripts/local-top/ramroot
sudo install scripts/local-premount $build_dir/fs/snapshot/0/etc/initramfs-tools/scripts/local-premount/ramroot
sudo install scripts/hooks $build_dir/fs/snapshot/0/etc/initramfs-tools/hooks/ramroot
sudo chroot $build_dir/fs/snapshot/0 update-initramfs -k all -c -t
sudo install scripts/ramroot $build_dir/fs/snapshot/0/usr/local/bin
sudo install scripts/ramroot-profile.sh $build_dir/fs/snapshot/0/etc/profile.d