Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / emulators / suse121_base / INSTALL
blobad36ee7c72661391cb5017821e088eaaa572ac7c
1 # $NetBSD: INSTALL,v 1.1.1.1 2012/03/21 13:35:50 obache Exp $
3 # Generate a +ROOT_ACTIONS script that runs certain actions that require
4 # superuser privileges.
6 case "${STAGE},$1" in
7 UNPACK,|UNPACK,+ROOT_ACTIONS)
8         ${CAT} > ./+ROOT_ACTIONS << 'EOF'
9 #!@SH@
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
18 # privileges.
21 CAT="@CAT@"
22 CHMOD="@CHMOD@"
23 CP="@CP@"
24 DIRNAME="@DIRNAME@"
25 ECHO="@ECHO@"
26 ID="@ID@"
27 LN="@LN@"
28 MKDIR="@MKDIR@"
29 PWD_CMD="@PWD_CMD@"
30 RM="@RM@"
31 SH="@SH@"
32 TEST="@TEST@"
34 SELF=$0
35 ACTION=$1
37 CURDIR=`${PWD_CMD}`
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"
46 EUID=`${ID} -u`
48 exitcode=0
49 case $ACTION,$EUID in
50 ADD,0)
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 &&
63                   ${LN} -fs sound dsp )
65         # Create the appropriate symlink so that the kernel will
66         # find the installed files.
67         #
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
73                         ${CAT} << EOM
74 ==============================================================================
75 The following symbolic link must be created for ${PKGNAME}
76 to work properly:
78         ${EMULDIR} -> ${OPSYS_EMULDIR}
80 ==============================================================================
81 EOM
82                 else
83                         ${ECHO} "${PKGNAME}: creating symlink ${EMULDIR} -> ${OPSYS_EMULDIR}"
84                         ( ${MKDIR} -p `${DIRNAME} ${OPSYS_EMULDIR}` && 
85                           ${LN} -fs ${EMULDIR} ${OPSYS_EMULDIR} ) || ${TRUE}
86                 fi
87         fi
88         ;;
90 REMOVE,0)
91         ${ECHO} "${PKGNAME}: removing ${EMULDIR}/dev"
92         ${RM} -fr ${EMULDIR}/dev
93         ${RM} -f ${ROOT_ACTIONS_COOKIE}
94         ;;
96 ADD,*)
97         if ${TEST} ! -f ${ROOT_ACTIONS_COOKIE}; then
98                 ${CAT} << EOM
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 ==============================================================================
107         fi
108         ;;
110 REMOVE,*)
111         if ${TEST} -f ${ROOT_ACTIONS_COOKIE}; then
112                 ${CAT} << EOM
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
120 package.
122 ==============================================================================
124                 exitcode=1
125         fi
126         ;;
127 esac
128 exit $exitcode
131         ${CHMOD} +x ./+ROOT_ACTIONS
132         ;;
133 esac
135 EMULDIR="${PKG_PREFIX}/@EMULSUBDIR@"
136 OPSYS_EMULDIR="@OPSYS_EMULDIR@"
138 case "${STAGE}" in
139 POST-INSTALL)
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 ../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}
150         ;;
151 esac