aboutsummaryrefslogtreecommitdiffstats
path: root/freedom-maker/source/etc/init.d/first-run
blob: 07a0db669a3777043b4bfd37ce6638182e4e28d5 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
#
# Script to complete the post-install process on first torouter boot.

### BEGIN INIT INFO
# Provides:          first-run
# Default-Start:     1 2
# Required-Start:    2
# Required-Stop:
# Default-Stop:
# Short-Description: Finish torouter install on DreamPlug
### END INIT INFO

function tweak-kernel {
    # Update the kernel unless requested otherwise.

    if [ -e /var/freedombox/dont-tweak-kernel ]
    then
        rm /var/freedombox/dont-tweak-kernel
    else
        kernel_version="$(/bin/ls $mountpoint/boot/vmlinuz-*-kirkwood | sort -rn | head -n1 | sed s#$mountpoint/boot/vmlinuz-##)"

        mount -t proc proc /proc
        flash-kernel $kernel_version
        umount /proc
    fi
}

function create-keys {
    echo "Creating Keys."

    echo "(re)creating SSH keys."
    rm -f /etc/ssh/ssh_host_*
    dpkg-reconfigure openssh-server

    #echo "Need to create other keys."
    # gpg --batch --gen-key
    # see http://lists.gnupg.org/pipermail/gnupg-users/2003-March/017376.html
}

function final-configure {
    echo "Catching up on any dpkg configurations..."
    dpkg -a --configure
}

function remove-self {
    rm -f /etc/init.d/first-run
    rm -f /etc/rc1.d/S01first-run
    rm -f /etc/rc2.d/S01first-run
    rm /etc/init.d/first-run
    rm /etc/rc1.d/S01first-run
    rm /etc/rc2.d/S01first-run
}

create-keys
final-configure

# the last things we do before quitting.
#tweak-kernel
remove-self

#echo "Kernel flashed.  Rebooting."
#reboot