OSDN Git Service

Updating info
[rebornos/cnchi-gnome-osdn.git] / airootfs / root / .automated_script.sh
1 #!/bin/bash
2
3 script_cmdline ()
4 {
5     local param
6     for param in $(< /proc/cmdline); do
7         case "${param}" in
8             script=*) echo "${param#*=}" ; return 0 ;;
9         esac
10     done
11 }
12
13 automated_script ()
14 {
15     local script rt
16     script="$(script_cmdline)"
17     if [[ -n "${script}" && ! -x /tmp/startup_script ]]; then
18         if [[ "${script}" =~ ^http:// || "${script}" =~ ^ftp:// ]]; then
19             wget "${script}" --retry-connrefused -q -O /tmp/startup_script >/dev/null
20             rt=$?
21         else
22             cp "${script}" /tmp/startup_script
23             rt=$?
24         fi
25         if [[ ${rt} -eq 0 ]]; then
26             chmod +x /tmp/startup_script
27             /tmp/startup_script
28         fi
29     fi
30 }
31
32 if [[ $(tty) == "/dev/tty1" ]]; then
33     automated_script
34 fi