Import sysutils/cdrtools-devel version 3.01a24,1
[dports.git] / sysutils / cdrtools-devel / pkg-install.rscsi
1 #!/bin/sh
2
3 PATH=/bin:/usr/sbin:/usr/bin
4
5 PKG_PREFIX=${PKG_PREFIX:=/usr/local}
6
7 case $2 in
8         PRE-INSTALL)
9                 ;;
10
11         POST-INSTALL)
12                 USER=rscsi
13                 UID=99
14                 GROUP=${USER}
15                 GID=${UID}
16                 UCOMMENT="Remote SCSI"
17                 UHOME=${PKG_PREFIX}/rscsi
18                 USHELL=${PKG_PREFIX}/sbin/rscsi
19
20                 echo "==========================================================================="
21                 echo
22
23                 if ! pw groupshow "${GROUP}" >/dev/null 2>&1; then
24                         if ! pw groupadd ${GROUP} -g ${GID}; then
25                                 echo "Adding group \"${GROUP}\" failed."
26                                 exit 1
27                         fi
28                 fi
29
30                 if ! pw usershow "${USER}" >/dev/null 2>&1; then
31                         if ! pw useradd ${USER} -u ${UID} -c "${UCOMMENT}" \
32                                 -d ${UHOME} -g ${GROUP} -s ${USHELL}; then
33                                 echo "Adding user \"${USER}\" failed."
34                                 exit 1
35                         fi
36                 fi
37
38                 if ! [ -d ${UHOME} ] ; then 
39                         mkdir -p ${UHOME}
40                         chown ${UID}:${GID} ${UHOME}
41                 fi
42
43                 if ! [ -f ${UHOME}/.rhosts ] ; then
44                         cp /usr/share/skel/dot.rhosts ${UHOME}/.rhosts
45                         chown ${UID}:${GID} ${UHOME}/.rhosts
46                         chmod 0600 ${UHOME}/.rhosts
47                 fi
48
49                 echo "See ${PKG_PREFIX}/share/doc/cdrtools/README.rscsi and ${PKG_PREFIX}/etc/rscsi"
50                 echo "for further information on how to configure remote access to SCSI-devices"
51                 echo "via rscsi."
52
53                 if ! grep '^shell' /etc/inetd.conf >/dev/null 2>&1; then
54                         echo "Don't forget to add an entry for rshd(8) to /etc/inetd.conf in order to"
55                         echo "be able to use the remote SCSI daemon."
56                 fi
57
58                 echo
59
60                 ;;
61 esac