summaryrefslogtreecommitdiff
path: root/app-misc/linux-logo/files/linux-logo.init.d
blob: 68a6700aec1e2642af92a523849294eca53bf2c1 (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
#!/sbin/openrc-run

ISSUE_BACKUP_FILE="/etc/issue.linux-logo.backup"
ISSUE_NET_BACKUP_FILE="/etc/issue.net.linux-logo.backup"

start() {
	ebegin "Starting linux_logo"

	if [ ! -x /usr/bin/linux_logo ]
	then
		eerror "ERROR:  linux_logo not found !"
		return 1
	fi

	ebegin "  Creating /etc/issue"
	cp /etc/issue ${ISSUE_BACKUP_FILE} 2> /dev/null
	/usr/bin/linux_logo ${LOGO} ${OPTIONS} -F "${FORMAT}" > /etc/issue
	eend $? "  Failed to create /etc/issue"

	if [ -f /etc/issue.net ]
	then
		ebegin "  Creating /etc/issue.net"
		cp /etc/issue.net ${ISSUE_NET_BACKUP_FILE} 2> /dev/null
		/usr/bin/linux_logo ${LOGO} ${OPTIONS} -F "${FORMATNET}" > \
			/etc/issue.net
		eend $? "  Failed to create /etc/issue.net"
	fi
}

stop() {
	ebegin "Stopping linux_logo"
	[ -f ${ISSUE_NET_BACKUP_FILE} ] && \
		mv ${ISSUE_NET_BACKUP_FILE} /etc/issue.net 2> /dev/null
	[ -f ${ISSUE_BACKUP_FILE} ] && \
		mv ${ISSUE_BACKUP_FILE} /etc/issue 2> /dev/null
}