1 # $NetBSD: INSTALL,v 1.7 2007/07/30 14:42:43 jlam Exp $
3 # Generate a +ROOT_ACTIONS script that runs certain actions that require
4 # superuser privileges.
7 UNPACK,|UNPACK,+ROOT_ACTIONS)
8 ${CAT} > ./+ROOT_ACTIONS << 'EOF'
11 # +ROOT_ACTIONS - run actions requiring superuser privileges
13 # Usage: ./+ROOT_ACTIONS ADD|REMOVE [metadatadir]
15 # This script runs certain actions that require superuser privileges.
16 # If such privileges are not available, then simply output a message
17 # asking the user to run this script with the appropriate elevated
38 PKG_METADATA_DIR="${2-${CURDIR}}"
39 : ${PKGNAME=${PKG_METADATA_DIR##*/}}
40 : ${PKG_PREFIX=@PREFIX@}
42 EMULDIR="${PKG_PREFIX}/@EMULSUBDIR@"
43 OPSYS_EMULDIR="@OPSYS_EMULDIR@"
45 ROOT_ACTIONS_COOKIE="./+ROOT_ACTIONS_done"
51 ${ECHO} "" > ${ROOT_ACTIONS_COOKIE}
52 ${CHMOD} g+w ${ROOT_ACTIONS_COOKIE}
53 # Create an appropriate Linux-like /dev directory.
54 ${ECHO} "${PKGNAME}: populating ${EMULDIR}/dev"
55 ${MKDIR} ${EMULDIR}/dev
56 ${TEST} ! -f /dev/MAKEDEV ||
57 ${CP} /dev/MAKEDEV ${EMULDIR}/dev
58 ${TEST} ! -f /dev/MAKEDEV.subr ||
59 ${CP} /dev/MAKEDEV.subr ${EMULDIR}/dev
60 ${TEST} ! -f ${EMULDIR}/dev/MAKEDEV ||
61 ( cd ${EMULDIR}/dev &&
62 ${SH} ./MAKEDEV std audio &&
65 # Create the appropriate symlink so that the kernel will
66 # find the installed files.
68 OPSYS_EMULDIR_PWD=`cd ${OPSYS_EMULDIR} 2>/dev/null && ${PWD_CMD}`
69 EMULDIR_PWD=`cd ${EMULDIR} 2>/dev/null && ${PWD_CMD}`
71 if ${TEST} "${OPSYS_EMULDIR_PWD}" != "${EMULDIR_PWD}"; then
72 if ${TEST} -e ${OPSYS_EMULDIR} -o -L ${OPSYS_EMULDIR}; then
74 ==============================================================================
75 The following symbolic link must be created for ${PKGNAME}
78 ${EMULDIR} -> ${OPSYS_EMULDIR}
80 ==============================================================================
83 ${ECHO} "${PKGNAME}: creating symlink ${EMULDIR} -> ${OPSYS_EMULDIR}"
84 ( ${MKDIR} -p `${DIRNAME} ${OPSYS_EMULDIR}` &&
85 ${LN} -fs ${EMULDIR} ${OPSYS_EMULDIR} ) || ${TRUE}
91 ${ECHO} "${PKGNAME}: removing ${EMULDIR}/dev"
92 ${RM} -fr ${EMULDIR}/dev
93 ${RM} -f ${ROOT_ACTIONS_COOKIE}
97 if ${TEST} ! -f ${ROOT_ACTIONS_COOKIE}; then
99 ==============================================================================
100 Please run the following command with superuser privileges to complete
101 the installation of ${PKGNAME}:
103 cd ${PKG_METADATA_DIR} && ${SELF} ADD
105 ==============================================================================
111 if ${TEST} -f ${ROOT_ACTIONS_COOKIE}; then
113 ==============================================================================
114 Please run the following command with superuser privileges to begin the
115 removal of ${PKGNAME}:
117 cd ${PKG_METADATA_DIR} && ${SELF} REMOVE
119 Then, please run pkg_delete(1) again to complete the removal of this
122 ==============================================================================
131 ${CHMOD} +x ./+ROOT_ACTIONS
135 EMULDIR="${PKG_PREFIX}/@EMULSUBDIR@"
136 OPSYS_EMULDIR="@OPSYS_EMULDIR@"
140 # Create a /proc mount point.
141 ${MKDIR} -p ${EMULDIR}/proc
143 # Make /etc/mtab usable for Linux programs.
144 ${RM} -f ${EMULDIR}/etc/mtab
145 ${LN} -fs ${EMULDIR}/proc/mounts ${EMULDIR}/etc/mtab
147 # Run any actions that require root privileges.
148 ${TEST} ! -x ./+ROOT_ACTIONS ||
149 ./+ROOT_ACTIONS ADD ${PKG_METADATA_DIR}