File: linuxlogoconfig

package info (click to toggle)
linuxlogo 2.07-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 296 kB
  • ctags: 73
  • sloc: ansic: 982; sh: 125; makefile: 60
file content (72 lines) | stat: -rw-r--r-- 1,976 bytes parent folder | download
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
#!/bin/bash
# name: /usr/sbin/linuxlogoconfig
# purpose: Configures the linuxlogo package.
# by: Steve Kostecke <steve@debian.o

# Make sure that /etc/issue exists...
restore_issue() {
if [ ! -f /etc/issue ]; then
 echo -n "Restoring the original /etc/issue..."
 echo "Debian GNU/\s `cat /etc/debian_version`  \n \l" > /etc/issue
 echo "done."
fi
}

# Check to see if /etc/issue has been diverted
DIVERT=`/usr/sbin/dpkg-divert --list linuxlogo | cut -b 1-9`

case "$DIVERT" in
  diversion)
    echo "linuxlogo is configured to display at the login prompt."
    [ `whoami` = "root" ] && [ `which dpkg-divert` ] || exit 0
    read -p "Change linuxlogo to display at system boot time? [yN]: " AKEY
    case "$AKEY" in
      y|Y)
	echo -n "Configuring linuxlogo to display at system boot time..."
	rm -f /etc/issue && /usr/sbin/dpkg-divert --package linuxlogo \
	 --remove --rename --divert /etc/issue.linuxlogo /etc/issue 1> /dev/null
	echo "done."
	restore_issue
	;;
      *)
	;;
    esac
    ;;
  *)
    echo "linuxlogo is configured to display at system boot time."
    [ `whoami` = "root" ]  && [ `which dpkg-divert` ] || exit 0
    
    # Paranoia check...
    if [ -f /etc/issue.linuxlogo ]; then
      echo "Unable to continue. Please rename or delete /etc/issue.linuxlogo."
      exit 1
    fi

    cat << EOM

Displaying the linuxlogo at the login prompt uses /etc/issue. The system's
current /etc/issue will be diverted (and renamed) to /etc/issue.linuxlogo.
It will be restored when linuxlogo is removed, purged, or changed to display
at system boot time.

EOM
    read -p "Change linuxlogo to display at the login prompt? [yN]: " AKEY
    case "$AKEY" in
      y|Y)
	restore_issue
        echo "Configuring linuxlogo to display at the login prompt..."
	/usr/sbin/dpkg-divert --package linuxlogo \
	 --add --rename --divert /etc/issue.linuxlogo /etc/issue 1> /dev/null
	/etc/init.d/linuxlogo restart
        ;;
      *)
        ;;
    esac
    ;;
esac
    
exit 0