summaryrefslogtreecommitdiff
path: root/src/initrd/patchroot.sh
blob: 738beac240bf0c85d01b5ad84ae29bccdc799def (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh

pkgs='avahi-daemon git tmux btrfs-tools/jessie-backports sshfs eject'
pkgs="$pkgs $(cat initrd-dependencies.txt)"
pkgs="$pkgs linux-image-$(uname -r)/jessie-backports"

default_sources_list()
{
    cat <<'END'
deb      http://httpredir.debian.org/debian  jessie            main contrib non-free
deb      http://security.debian.org          jessie/updates    main contrib non-free
deb      http://httpredir.debian.org/debian  jessie-backports  main contrib non-free
deb-src  http://httpredir.debian.org/debian  jessie            main contrib non-free
deb-src  http://security.debian.org          jessie/updates    main contrib non-free
deb-src  http://httpredir.debian.org/debian  jessie-backports  main contrib non-free
END
}

network_devs()
{
    ip -oneline link |
        while read _ dev _; do
            echo ${dev%:}
        done
}

if [ -e /root/sources.list ]; then
    cp /root/sources.list /etc/apt/sources.list
else
    default_sources_list > /etc/apt/sources.list
fi

if [ -e /sys/module/hid_apple/parameters/fnmode ]; then
    echo 2 > /sys/module/hid_apple/parameters/fnmode
fi
echo options hid_apple fnmode=2 > /etc/modprobe.d/apple.conf

if [ "$(ifquery -a --list)" = lo ]; then
    # No configured interfaces.  Do something!
    dhclient $(network_devs)
fi
apt-get update
apt-get -y install --no-upgrade $pkgs