summaryrefslogtreecommitdiff
path: root/patchroot.sh
blob: e211377eadee16c1178e89f1fba100111a027a2a (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
#!/bin/sh

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

default_sources_list()
{
    cat <<'END'
deb      http://httpredir.debian.org/debian  jessie            main  non-free
deb      http://security.debian.org          jessie/updates    main  non-free
deb      http://httpredir.debian.org/debian  jessie-backports  main  non-free
deb-src  http://httpredir.debian.org/debian  jessie            main  non-free
deb-src  http://security.debian.org          jessie/updates    main  non-free
deb-src  http://httpredir.debian.org/debian  jessie-backports  main  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 [ "$(ifquery -a --list)" = lo ]; then
    # No configured interfaces.  Do something!
    dhclient $(network_devs)
fi
apt-get update
apt-get -y install --no-upgrade $pkgs