summaryrefslogtreecommitdiff
path: root/hooks-addons/95usplash_timeout
blob: b5e8e6d53ab94fe7222cc8243fc1530eba6af3e3 (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
64
65
66
67
68
69
70
71
72
73
74
# Add timeout on usplash startup script

if [ -e $DESTDIR/scripts/init-top/usplash -o -e /scripts/init-top/plymouth -o -e /scripts/init-top/00_splashy ]; then

  _echo "   * Applying usplash timeout patch"

cat << EOF > $DESTDIR/scripts/init-top/00_nosplash
#!/bin/sh

# new header not using prereqs
if [ "\$1" = "prereqs" ]; then
  echo ""
  exit 0
fi

. /scripts/functions
. /conf/tcos.conf
. /conf/tcos-run-functions

# kill usplash if cmdline have "nousplash" or "nosplash"
for x in \$(cat /proc/cmdline); do
        case \$x in
        nosplash)
		KILL_SPLASH=true
                ;;
        nousplash)
		KILL_SPLASH=true
                ;;
        esac
done

if [ "\$KILL_SPLASH" = "true" ] ; then
  echo -e "#!/bin/sh\nexit 0" > /scripts/init-top/framebuffer
  [ -e /scripts/init-top/usplash ] && echo -e "#!/bin/sh\nexit 0" > /scripts/init-top/usplash
  [ -e /scripts/init-top/plymouth ] && echo -e "#!/bin/sh\nexit 0" > /scripts/init-top/plymouth
  [ -e /scripts/init-top/00_splashy ] && echo -e "#!/bin/sh\nexit 0" > /scripts/init-top/00_splashy
fi


EOF
chmod +x $DESTDIR/scripts/init-top/00_nosplash

else 
  _verbose "(95usplash_timeout) Splash not found, timeout path not applied."
fi


# add fancy startup messages

cat << EOF >> $DESTDIR/scripts/functions

log_use_fancy_output () {
    TPUT=/bin/tput
    EXPR=/bin/expr
    if [ "x\$TERM" != "xdumb" ] && [ -x \$TPUT ] && [ -x \$EXPR ] && \$TPUT hpa 60 >/dev/null 2>&1 && \$TPUT setaf 1 >/dev/null 2>&1; then
        [ -z \$FANCYTTY ] && FANCYTTY=1 || true
    else
        FANCYTTY=0
    fi
    case "\$FANCYTTY" in
        1|Y|yes|true)   true;;
        *)              false;;
    esac
}

FANCYTTY=
[ -e /etc/lsb-base-logging.sh ] && . /etc/lsb-base-logging.sh || true

EOF

[ -e /etc/lsb-base-logging.sh ] && cpifexists /etc/lsb-base-logging.sh /etc
cpifexists /usr/bin/tput /bin
cpifexists /usr/bin/expr /bin