diff options
-rwxr-xr-x | initramfs-tools/hooks/samizdat | 4 | ||||
-rw-r--r-- | initramfs-tools/scripts/samizdat | 7 | ||||
-rwxr-xr-x | patchroot.sh | 38 |
3 files changed, 49 insertions, 0 deletions
diff --git a/initramfs-tools/hooks/samizdat b/initramfs-tools/hooks/samizdat index c71dada..d09c660 100755 --- a/initramfs-tools/hooks/samizdat +++ b/initramfs-tools/hooks/samizdat | |||
@@ -15,6 +15,10 @@ for c in $path_execs; do CopyExec "$(which $c)" /bin; done | |||
15 | CopyExec /bin/openvt /bin/OpenVT | 15 | CopyExec /bin/openvt /bin/OpenVT |
16 | CopyExec /sbin/losetup /bin/LoSetup | 16 | CopyExec /sbin/losetup /bin/LoSetup |
17 | 17 | ||
18 | CopyExec patchroot.sh /patchroot/patchroot.sh | ||
19 | CopyExec /etc/apt/sources.list /patchroot/sources.list | ||
20 | CopyExec initrd-dependencies.txt /patchroot/initrd-dependencies.txt | ||
21 | |||
18 | absolute_path_copies='/lib/terminfo/l/linux' | 22 | absolute_path_copies='/lib/terminfo/l/linux' |
19 | 23 | ||
20 | for f in $absolute_path_copies; do CopyExec "$f" "$f"; done | 24 | for f in $absolute_path_copies; do CopyExec "$f" "$f"; done |
diff --git a/initramfs-tools/scripts/samizdat b/initramfs-tools/scripts/samizdat index 2bc16f8..374d95d 100644 --- a/initramfs-tools/scripts/samizdat +++ b/initramfs-tools/scripts/samizdat | |||
@@ -9,8 +9,15 @@ mountroot() | |||
9 | bootmenu | 9 | bootmenu |
10 | bootwait root-mounted | 10 | bootwait root-mounted |
11 | chvt 1 | 11 | chvt 1 |
12 | patchroot | ||
13 | } | ||
12 | 14 | ||
15 | patchroot() | ||
16 | { | ||
17 | echo -n 'Patching root... ' >&2 | ||
13 | sed -i -e 's/^root:x:/root::/' /root/etc/passwd | 18 | sed -i -e 's/^root:x:/root::/' /root/etc/passwd |
19 | cp /patchroot/* /root/root/ | ||
20 | echo 'done.' >&2 | ||
14 | } | 21 | } |
15 | 22 | ||
16 | samizdat_install_udev_rules() | 23 | samizdat_install_udev_rules() |
diff --git a/patchroot.sh b/patchroot.sh new file mode 100755 index 0000000..e211377 --- /dev/null +++ b/patchroot.sh | |||
@@ -0,0 +1,38 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | pkgs='avahi-daemon git tmux btrfs-tools/jessie-backports sshfs' | ||
4 | pkgs="$pkgs $(cat initrd-dependencies.txt)" | ||
5 | pkgs="$pkgs linux-image-$(uname -r)" | ||
6 | |||
7 | default_sources_list() | ||
8 | { | ||
9 | cat <<'END' | ||
10 | deb http://httpredir.debian.org/debian jessie main non-free | ||
11 | deb http://security.debian.org jessie/updates main non-free | ||
12 | deb http://httpredir.debian.org/debian jessie-backports main non-free | ||
13 | deb-src http://httpredir.debian.org/debian jessie main non-free | ||
14 | deb-src http://security.debian.org jessie/updates main non-free | ||
15 | deb-src http://httpredir.debian.org/debian jessie-backports main non-free | ||
16 | END | ||
17 | } | ||
18 | |||
19 | network_devs() | ||
20 | { | ||
21 | ip -oneline link | | ||
22 | while read _ dev _; do | ||
23 | echo ${dev%:} | ||
24 | done | ||
25 | } | ||
26 | |||
27 | if [ -e /root/sources.list ]; then | ||
28 | cp /root/sources.list /etc/apt/sources.list | ||
29 | else | ||
30 | default_sources_list > /etc/apt/sources.list | ||
31 | fi | ||
32 | |||
33 | if [ "$(ifquery -a --list)" = lo ]; then | ||
34 | # No configured interfaces. Do something! | ||
35 | dhclient $(network_devs) | ||
36 | fi | ||
37 | apt-get update | ||
38 | apt-get -y install --no-upgrade $pkgs | ||