summaryrefslogtreecommitdiff
path: root/emulators/suse91_vmware/INSTALL
blob: c0ef7aa3968f28777f05a872a8c112d7e030a958 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# $NetBSD: INSTALL,v 1.3 2007/08/22 02:19:15 jlam Exp $

# Generate a +ROOT_ACTIONS script that runs certain actions that require
# superuser privileges.
#
case "${STAGE},$1" in
UNPACK,|UNPACK,+ROOT_ACTIONS)
	${CAT} > ./+ROOT_ACTIONS << 'EOF'
#!@SH@
#
# +ROOT_ACTIONS - run actions requiring superuser privileges
#
# Usage: ./+ROOT_ACTIONS ADD|REMOVE [metadatadir]
#
# This script runs certain actions that require superuser privileges.
# If such privileges are not available, then simply output a message
# asking the user to run this script with the appropriate elevated
# privileges.
#
# Lines starting with "# SYMLINK: " are data read by this script that
# name the source paths and corresponding symlink that is managed by
# this script.  If the symlink path is relative, then it is taken to be
# relative to ${PKG_PREFIX}.  The source path is always unchanged.
#
#	# SYMLINK: /dev/rcd0a ${EMULSUBDIR}/dev/cdrom
#

CAT="@CAT@"
CHMOD="@CHMOD@"
ECHO="@ECHO@"
ID="@ID@"
LN="@LN@"
PWD_CMD="@PWD_CMD@"
RM="@RM@"
SED="@SED@"
TEST="@TEST@"

SELF=$0
ACTION=$1

CURDIR=`${PWD_CMD}`
PKG_METADATA_DIR="${2-${CURDIR}}"
: ${PKGNAME=${PKG_METADATA_DIR##*/}}
: ${PKG_PREFIX=@PREFIX@}

ROOT_ACTIONS_COOKIE="./+ROOT_ACTIONS_done"
EUID=`${ID} -u`

exitcode=0
case $ACTION,$EUID in
ADD,0)
	${ECHO} "" > ${ROOT_ACTIONS_COOKIE}
	${CHMOD} g+w ${ROOT_ACTIONS_COOKIE}
	${SED} -n "/^\# SYMLINK: /{s/^\# SYMLINK: //;p;}" ${SELF} |
	while read src dst; do
		case $src in
		"")	continue ;;
		esac
		case $dst in
		"")	continue ;;
		[!/]*)	dst="${PKG_PREFIX}/$dst" ;;
		esac

		if ${TEST} ! -e "$dst"; then
			${ECHO} "${PKGNAME}: linking $dst -> $src"
			${LN} -fs "$src" "$dst"
		else
			${ECHO} "${PKGNAME}: $dst already exists"
		fi
	done
	;;

REMOVE,0)
	${SED} -n "/^\# SYMLINK: /{s/^\# SYMLINK: //;p;}" ${SELF} |
	while read src dst; do
		case $src in
		"")	continue ;;
		esac
		case $dst in
		"")	continue ;;
		[!/]*)	dst="${PKG_PREFIX}/$dst" ;;
		esac

		if ${TEST} -h "$dst"; then
			${ECHO} "${PKGNAME}: removing $dst"
			${RM} -f "$dst"
		fi
	done
	${RM} -f ${ROOT_ACTIONS_COOKIE}
	;;

ADD,*)
	if ${TEST} ! -f ${ROOT_ACTIONS_COOKIE}; then
		${CAT} << EOM
==============================================================================
Please run the following command with superuser privileges to complete
the installation of ${PKGNAME}:

    cd ${PKG_METADATA_DIR} && ${SELF} ADD

==============================================================================
EOM
	fi
	;;

REMOVE,*)
	if ${TEST} -f ${ROOT_ACTIONS_COOKIE}; then
		${CAT} << EOM
==============================================================================
Please run the following command with superuser privileges to begin the
removal of ${PKGNAME}:

    cd ${PKG_METADATA_DIR} && ${SELF} REMOVE

Then, please run pkg_delete(1) again to complete the removal of this
package.

==============================================================================
EOM
		exitcode=1
	fi
	;;
esac
exit $exitcode

EOF
	${SED} -n "/^\# SYMLINK: /p" ${SELF} >> ./+ROOT_ACTIONS
	${CHMOD} +x ./+ROOT_ACTIONS
	;;
esac

# SYMLINK: /dev/rcd0a @EMULSUBDIR@/dev/cdrom
# SYMLINK: /dev/rfd0a @EMULSUBDIR@/dev/fd0
# SYMLINK: /dev/wd0d @EMULSUBDIR@/dev/hda
# SYMLINK: /dev/wd1d @EMULSUBDIR@/dev/hdb
# SYMLINK: /dev/wd2d @EMULSUBDIR@/dev/hdc
# SYMLINK: /dev/wd3d @EMULSUBDIR@/dev/hdd
# SYMLINK: /dev/sd0d @EMULSUBDIR@/dev/hde
# SYMLINK: /dev/sd1d @EMULSUBDIR@/dev/hdf
# SYMLINK: /dev/sd2d @EMULSUBDIR@/dev/hdg
# SYMLINK: /dev/sd3d @EMULSUBDIR@/dev/hdh
# SYMLINK: /dev/sd4d @EMULSUBDIR@/dev/hdi
# SYMLINK: /dev/ttyE0 @EMULSUBDIR@/dev/tty1
# SYMLINK: /dev/ttyE1 @EMULSUBDIR@/dev/tty2
# SYMLINK: /dev/ttyE2 @EMULSUBDIR@/dev/tty3
# SYMLINK: /dev/ttyE3 @EMULSUBDIR@/dev/tty4
# SYMLINK: /dev/ttyE4 @EMULSUBDIR@/dev/tty5
# SYMLINK: /dev/ttyE5 @EMULSUBDIR@/dev/tty6
# SYMLINK: /dev/ttyE6 @EMULSUBDIR@/dev/tty7
# SYMLINK: /dev/ttyE7 @EMULSUBDIR@/dev/tty8
# SYMLINK: tty1 @EMULSUBDIR@/dev/tty0

case "${STAGE}" in
POST-INSTALL)
	${TEST} ! -x ./+ROOT_ACTIONS ||
		./+ROOT_ACTIONS ADD ${PKG_METADATA_DIR}
	;;
esac