diff options
author | jlam <jlam> | 2001-11-26 14:48:53 +0000 |
---|---|---|
committer | jlam <jlam> | 2001-11-26 14:48:53 +0000 |
commit | f9da5125a760b828f531d7cfe91d26a6826ebeb7 (patch) | |
tree | 7492ff3b18268437eb528c22d45223f62363bb89 | |
parent | 4e932adfcc62bf480dd019d8362f0a392b6cc065 (diff) | |
download | pkgsrc-f9da5125a760b828f531d7cfe91d26a6826ebeb7.tar.gz |
In fit of paranoia after reading about the iTunes installer and given we
now work on Darwin, and then the discussion about allowing spaces in
user/group names, make these scripts work even if the inputs contain
spaces. Yes, this is overkill, but after doing all of the work, I didn't
want to waste it.
-rw-r--r-- | mk/install/deinstall | 110 | ||||
-rw-r--r-- | mk/install/install | 71 |
2 files changed, 99 insertions, 82 deletions
diff --git a/mk/install/deinstall b/mk/install/deinstall index 7119dae1ec7..2a67aa13128 100644 --- a/mk/install/deinstall +++ b/mk/install/deinstall @@ -1,45 +1,59 @@ # start of deinstall # -# $NetBSD: deinstall,v 1.6 2001/11/25 18:54:57 jlam Exp $ +# $NetBSD: deinstall,v 1.7 2001/11/26 14:48:53 jlam Exp $ -ALL_FILES="${ALL_FILES} ${CONF_FILES} ${SUPPORT_FILES}" -set -- ${RCD_SCRIPTS} -while [ $# -gt 0 ] +eval set -- ${CONF_FILES} ${SUPPORT_FILES} +for file +do + ALL_FILES="${ALL_FILES} \"${file}\"" +done +eval set -- ${RCD_SCRIPTS} +for script do - samplefile="${PKG_PREFIX}/etc/rc.d/$1" - file="${RCD_SCRIPTS_DIR}/$1" + samplefile="${PKG_PREFIX}/etc/rc.d/${script}" + file="${RCD_SCRIPTS_DIR}/${script}" shift - ALL_FILES="${ALL_FILES} ${samplefile} ${file}" + ALL_FILES="${ALL_FILES} \"${samplefile}\" \"${file}\"" done -set -- ${CONF_FILES_PERMS} ${SUPPORT_FILES_PERMS} +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 - ALL_FILES="${ALL_FILES} ${samplefile} ${file}" + ALL_FILES="${ALL_FILES} \"${samplefile}\" \"${file}\"" done -ALL_MAKE_DIRS="${ALL_MAKE_DIRS} ${MAKE_DIRS}" -set -- ${MAKE_DIRS_PERMS} +eval set -- ${MAKE_DIRS} +for dir +do + ALL_MAKE_DIRS="${ALL_MAKE_DIRS} \"${dir}\"" +done +eval set -- ${MAKE_DIRS_PERMS} while [ $# -gt 0 ] do dir="$1"; owner="$2"; group="$3"; mode="$4" shift; shift; shift; shift - ALL_MAKE_DIRS="${ALL_MAKE_DIRS} ${dir}" + ALL_MAKE_DIRS="${ALL_MAKE_DIRS} \"${dir}\"" +done +eval set -- ${ALL_MAKE_DIRS} ${OWN_DIRS} +for dir +do + ALL_DIRS="${ALL_DIRS} \"${dir}\"" done -ALL_DIRS="${ALL_DIRS} ${ALL_MAKE_DIRS} ${OWN_DIRS}" -set -- ${OWN_DIRS_PERMS} +eval set -- ${OWN_DIRS_PERMS} while [ $# -gt 0 ] do dir="$1"; owner="$2"; group="$3"; mode="$4" shift; shift; shift; shift - ALL_DIRS="${ALL_DIRS} ${dir}" + ALL_DIRS="${ALL_DIRS} \"${dir}\"" done -ALL_DIRS=` \ - ${ECHO} ${ALL_DIRS} | \ - ${SED} "s,[ ][ ]*, ,g" | \ - ${TR} ' ' "\012" | \ - ${SORT} -r \ +ALL_DIRS=` + ( eval set -- ${ALL_DIRS} + for dir + do + ${ECHO} "\"${dir}\"" + done + ) | ${SORT} -r ` case ${STAGE} in @@ -47,18 +61,18 @@ DEINSTALL) # Remove configuration files if they don't differ from the default # config file. # - set -- ${ALL_FILES} + eval set -- ${ALL_FILES} while [ $# -gt 0 ] do samplefile="$1"; file="$2" shift; shift if [ "${file}" != "${samplefile}" -a \ - -e ${file} -a -e ${samplefile} ] + -e "${file}" -a -e "${samplefile}" ] then - if ${CMP} -s ${file} ${samplefile} + if ${CMP} -s "${file}" "${samplefile}" then - ${RM} -f ${file} + ${RM} -f "${file}" fi fi done @@ -66,38 +80,40 @@ DEINSTALL) POST-DEINSTALL) modified_files='' - set -- ${ALL_FILES} + eval set -- ${ALL_FILES} while [ $# -gt 0 ] do samplefile="$1"; file="$2" shift; shift - if [ -e ${file} ] + if [ -e "${file}" ] then - modified_files="${modified_files} ${file}" + modified_files="${modified_files} \"${file}\"" fi done existing_dirs='' - set -- ${ALL_DIRS} - while [ $# -gt 0 ] + eval set -- ${ALL_DIRS} + for dir do - dir=$1; shift - is_make_dir=0 - for make_dir in __dummy ${ALL_MAKE_DIRS} - do - if [ "${make_dir}" != "__dummy" -a \ - "${dir}" = "${make_dir}" ] - then - is_make_dir=1 - break - fi - done - - ${RMDIR} -p ${dir} 2>/dev/null || ${TRUE} - if [ ${is_make_dir} -eq 0 -a -d ${dir} ] + is_make_dir=` + ( eval set -- ${ALL_MAKE_DIRS} + is_make_dir=0 + for make_dir + do + if [ "${dir}" = "${make_dir}" ] + then + is_make_dir=1 + break + fi + done + ${ECHO} ${is_make_dir} + ) + ` + ${RMDIR} -p "${dir}" 2>/dev/null || ${TRUE} + if [ ${is_make_dir} -eq 0 -a -d "${dir}" ] then - existing_dirs="${existing_dirs} ${dir}" + existing_dirs="${existing_dirs} \"${dir}\"" fi done @@ -129,7 +145,8 @@ EOF * the following files: EOF - for file in ${modified_files} + eval set -- ${modified_files} + for file do ${ECHO} " ${file}" done @@ -141,7 +158,8 @@ EOF * the following directories: EOF - for dir in ${existing_dirs} + eval set -- ${existing_dirs} + for dir do ${ECHO} " ${dir}" done diff --git a/mk/install/install b/mk/install/install index 99268bfa51f..b285c04ec16 100644 --- a/mk/install/install +++ b/mk/install/install @@ -1,6 +1,6 @@ # start of install # -# $NetBSD: install,v 1.3 2001/11/21 15:43:01 jlam Exp $ +# $NetBSD: install,v 1.4 2001/11/26 14:48:53 jlam Exp $ case ${STAGE} in PRE-INSTALL) @@ -21,7 +21,7 @@ PRE-INSTALL) groupid_option="-g ${PKG_GROUPID}" fi ${ECHO} "Creating '${PKG_GROUP}' group..." - ${GROUPADD} ${groupid_option} ${PKG_GROUP} + ${GROUPADD} ${groupid_option} "${PKG_GROUP}" ${ECHO} "Done." fi ${RM} -f /tmp/grouptest.$$ @@ -43,10 +43,10 @@ PRE-INSTALL) ${ECHO} "Creating '${PKG_USER}' user..." ${USERADD} -c "@PKG_USER_DESCR@" \ ${userid_option} \ - -g ${PKG_GROUP} \ - -d @PKG_USER_HOME@ \ - -s @PKG_USER_SHELL@ \ - ${PKG_USER} + -g "${PKG_GROUP}" \ + -d "@PKG_USER_HOME@" \ + -s "@PKG_USER_SHELL@" \ + "${PKG_USER}" ${ECHO} "Done." fi fi @@ -54,20 +54,20 @@ PRE-INSTALL) POST-INSTALL) # Create package directories. - set -- ${MAKE_DIRS} ${OWN_DIRS} + eval set -- ${MAKE_DIRS} ${OWN_DIRS} for dir do - ${MKDIR} ${dir} + ${MKDIR} "${dir}" done - set -- ${MAKE_DIRS_PERMS} ${OWN_DIRS_PERMS} + 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} + ${MKDIR} "${dir}" + ${CHOWN} "${owner}" "${dir}" + ${CHGRP} "${group}" "${dir}" + ${CHMOD} "${mode}" "${dir}" done if [ -n "${CONF_FILES}" -o -n "${CONF_FILES_PERMS}" -o \ @@ -75,37 +75,37 @@ POST-INSTALL) then ${ECHO} "Installing configuration files:" fi - set -- ${CONF_FILES} + eval set -- ${CONF_FILES} while [ $# -gt 0 ] do samplefile="$1"; file="$2" shift; shift - if [ -e ${file} ] + if [ -e "${file}" ] then ${ECHO} " ${file} already exists" else ${ECHO} " ${file}" - ${CP} ${samplefile} ${file} - ${CHMOD} @CONF_FILES_MODE@ ${file} + ${CP} "${samplefile}" "${file}" + ${CHMOD} @CONF_FILES_MODE@ "${file}" fi done - set -- ${SUPPORT_FILES} + eval set -- ${SUPPORT_FILES} while [ $# -gt 0 ] do samplefile="$1"; file="$2" shift; shift - if [ -e ${file} ] + if [ -e "${file}" ] then ${ECHO} " ${file} already exists" else ${ECHO} " ${file}" - ${CP} ${samplefile} ${file} - ${CHMOD} @SUPPORT_FILES_MODE@ ${file} + ${CP} "${samplefile}" "${file}" + ${CHMOD} @SUPPORT_FILES_MODE@ "${file}" fi done - set -- ${CONF_FILES_PERMS} ${SUPPORT_FILES_PERMS} + eval set -- ${CONF_FILES_PERMS} ${SUPPORT_FILES_PERMS} while [ $# -gt 0 ] do samplefile="$1"; file="$2"; owner="$3"; group="$4"; mode="$5" @@ -116,26 +116,25 @@ POST-INSTALL) ${ECHO} " ${file} already exists" else ${ECHO} " ${file}" - ${CP} ${samplefile} ${file} - ${CHOWN} ${owner} ${file} - ${CHGRP} ${group} ${file} - ${CHMOD} ${mode} ${file} + ${CP} "${samplefile}" "${file}" + ${CHOWN} "${owner}" "${file}" + ${CHGRP} "${group}" "${file}" + ${CHMOD} ${mode} "${file}" fi done - set -- ${RCD_SCRIPTS} - while [ $# -gt 0 ] + eval set -- ${RCD_SCRIPTS} + for script do - samplefile="${PKG_PREFIX}/etc/rc.d/$1" - file="${RCD_SCRIPTS_DIR}/$1" - shift + samplefile="${PKG_PREFIX}/etc/rc.d/${script}" + file="${RCD_SCRIPTS_DIR}/${script}" - if [ -e ${file} ] + if [ -e "${file}" ] then ${ECHO} " ${file} already exists" else ${ECHO} " ${file}" - ${CP} ${samplefile} ${file} - ${CHMOD} @RCD_SCRIPTS_MODE@ ${file} + ${CP} "${samplefile}" "${file}" + ${CHMOD} @RCD_SCRIPTS_MODE@ "${file}" fi done @@ -147,7 +146,7 @@ POST-INSTALL) You may wish to customize the following files: EOF - set -- ${CONF_FILES} + eval set -- ${CONF_FILES} while [ $# -gt 0 ] do samplefile="$1"; file="$2" @@ -155,7 +154,7 @@ EOF ${ECHO} " ${file}" done - set -- ${CONF_FILES_PERMS} + eval set -- ${CONF_FILES_PERMS} while [ $# -gt 0 ] do samplefile="$1"; file="$2"; owner="$3"; group="$4"; mode="$5" |