# start of install # # $NetBSD: install,v 1.6 2001/12/04 21:05:06 seb Exp $ case ${STAGE} in PRE-INSTALL) if [ -n "${PKG_GROUPS}" ] then eval set -- ${PKG_GROUPS} for groupset do ( IFS=":" set -- ${groupset} group="$1"; groupid="$2" # We need to check that ${PKG_GROUP} exists before # adding the user. Do it with chgrp to be able to # use NIS. # ${TOUCH} /tmp/grouptest.$$ if ${CHGRP} ${group} /tmp/grouptest.$$ >/dev/null 2>&1 then ${ECHO} "Group '${group}' already exists." else groupid_option= if [ -n "${groupid}" ] then groupid_option="-g" fi ${ECHO} "Creating group: ${group}" ${GROUPADD} ${groupid_option} ${groupid} "${group}" fi ${RM} -f /tmp/grouptest.$$ ) done fi if [ -n "${PKG_USERS}" ] then eval set -- ${PKG_USERS} for userset do ( IFS=":" set -- ${userset} user="$1"; group="$2"; userid="$3" descr="${4:-${PKGBASE} ${user} user}" home="${5:-@PKG_USER_HOME@}" shell="${6:-@PKG_USER_SHELL@}" # Use `id' to be able to use NIS. if ${ID} "${user}" >/dev/null 2>&1 then ${ECHO} "User '${user}' already exists." else userid_option= if [ -n "${userid}" ] then userid_option="-u" fi ${ECHO} "Creating user: ${user}" ${USERADD} -c "${descr}" \ ${userid_option} ${userid} \ -g "${group}" \ -d "${home}" \ -s "${shell}" \ "${user}" fi ) done fi ;; POST-INSTALL) # Create package directories. eval set -- ${MAKE_DIRS} ${OWN_DIRS} for dir do ${MKDIR} "${dir}" done eval set -- ${MAKE_DIRS_PERMS} ${OWN_DIRS_PERMS} while [ $# -gt 0 ] do dir="$1"; owner="$2"; group="$3"; mode="$4" shift; shift; shift; shift ${MKDIR} "${dir}" ${CHOWN} "${owner}" "${dir}" ${CHGRP} "${group}" "${dir}" ${CHMOD} "${mode}" "${dir}" done if [ -n "${CONF_FILES}" -o -n "${CONF_FILES_PERMS}" -o \ -n "${SUPPORT_FILES}" -o -n "${SUPPORT_FILES_PERMS}" -o \ -n "${RCD_SCRIPTS}" ] then ${ECHO} "Installing configuration files:" fi eval set -- ${CONF_FILES} while [ $# -gt 0 ] do samplefile="$1"; file="$2" shift; shift if [ -e "${file}" ] then ${ECHO} " ${file} already exists" else if [ -e "${samplefile}" ] then ${ECHO} " ${file}" ${CP} "${samplefile}" "${file}" ${CHMOD} @CONF_FILES_MODE@ "${file}" fi fi done eval set -- ${SUPPORT_FILES} while [ $# -gt 0 ] do samplefile="$1"; file="$2" shift; shift if [ -e "${file}" ] then ${ECHO} " ${file} already exists" else if [ -e "${samplefile}" ] then ${ECHO} " ${file}" ${CP} "${samplefile}" "${file}" ${CHMOD} @SUPPORT_FILES_MODE@ "${file}" fi fi done eval set -- ${CONF_FILES_PERMS} ${SUPPORT_FILES_PERMS} while [ $# -gt 0 ] do samplefile="$1"; file="$2"; owner="$3"; group="$4"; mode="$5" shift; shift; shift; shift; shift if [ -e ${file} ] then ${ECHO} " ${file} already exists" else if [ -e "${samplefile}" ] then ${ECHO} " ${file}" ${CP} "${samplefile}" "${file}" ${CHOWN} "${owner}" "${file}" ${CHGRP} "${group}" "${file}" ${CHMOD} ${mode} "${file}" fi fi done eval set -- ${RCD_SCRIPTS} for script do samplefile="${PKG_PREFIX}/etc/rc.d/${script}" file="${RCD_SCRIPTS_DIR}/${script}" if [ -e "${file}" ] then ${ECHO} " ${file} already exists" else if [ -e "${samplefile}" ] then ${ECHO} " ${file}" ${CP} "${samplefile}" "${file}" ${CHMOD} @RCD_SCRIPTS_MODE@ "${file}" fi fi done if [ -n "${CONF_FILES}" -o -n "${CONF_FILES_PERMS}" ] then ${CAT} << EOF =========================================================================== You may wish to customize the following files: EOF eval set -- ${CONF_FILES} while [ $# -gt 0 ] do samplefile="$1"; file="$2" shift; shift ${ECHO} " ${file}" done eval set -- ${CONF_FILES_PERMS} while [ $# -gt 0 ] do samplefile="$1"; file="$2"; owner="$3"; group="$4"; mode="$5" shift; shift; shift; shift; shift ${ECHO} " ${file}" done ${CAT} << EOF =========================================================================== EOF fi ;; *) ${ECHO} "Unexpected argument: ${STAGE}" exit 1 ;; esac # end of install