summaryrefslogtreecommitdiff
path: root/configs/releng/root-image/etc/rc.d/functions.d/automated_script
blob: 7a35acb42522e9dcafb69ff9ea5d7d386d02a84d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
automated_script ()
{
    script="$(kernel_cmdline script)"
    if [[ -n "$script" ]]; then
        stat_busy "Configuring $script"
        if [[ "$script" =~ ^http:// || "$script" =~ ^ftp:// ]]; then
            wget "$script" -q -O /tmp/startup_script >/dev/null
            rt=$?
        else
            cp "$script" /tmp/startup_script
            rt=$?
        fi
        if [ $rt -eq 0 ]; then
            chmod +x /tmp/startup_script
            echo -e '\nif [ $(tty) = "/dev/tty1" ]; then\n    /tmp/startup_script\nfi\n' >> /root/.bash_profile
            stat_done
        else
            stat_fail
        fi
    fi
}

add_hook multi_end automated_script