* Use the new stat(1) to get mode information from the files we

are installing.
* Since this means that for now we can't accomodate non-standard
umask's, warn the user accordingly.
* Convert the "press enter to continue" prompt into a function.
This commit is contained in:
dougb 2002-06-06 20:38:22 +00:00
parent 7916563c61
commit bfb17f2ab2

View File

@ -214,6 +214,12 @@ diff_loop () {
esac esac
} }
press_to_continue () {
local DISCARD
echo -n ' *** Press the [Enter] or [Return] key to continue '
read DISCARD
}
# Set the default path for the temporary root environment # Set the default path for the temporary root environment
# #
TEMPROOT='/var/tmp/temproot' TEMPROOT='/var/tmp/temproot'
@ -472,9 +478,7 @@ case "${RERUN}" in
case "${VERBOSE}" in case "${VERBOSE}" in
'') ;; '') ;;
*) *)
echo " *** Press [Enter] or [Return] key to continue" press_to_continue
read ANY_KEY
unset ANY_KEY
;; ;;
esac esac
@ -522,14 +526,10 @@ case "${RERUN}" in
echo ' However because these files are not updated by this process you' echo ' However because these files are not updated by this process you'
echo ' might want to verify their status before rebooting your system.' echo ' might want to verify their status before rebooting your system.'
echo '' echo ''
echo ' *** Press [Enter] or [Return] key to continue' press_to_continue
read ANY_KEY
unset ANY_KEY
diff -qr ${DESTDIR}/etc ${TEMPROOT}/etc | grep "^Only in /etc" | ${PAGER} diff -qr ${DESTDIR}/etc ${TEMPROOT}/etc | grep "^Only in /etc" | ${PAGER}
echo '' echo ''
echo ' *** Press [Enter] or [Return] key to continue' press_to_continue
read ANY_KEY
unset ANY_KEY
;; ;;
esac esac
@ -559,35 +559,36 @@ find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null
# Get ready to start comparing files # Get ready to start comparing files
# Check umask if not specified on the command line, # Check umask if we are not doing an autorun
# and we are not doing an autorun
# #
if [ -z "${NEW_UMASK}" -a -z "${AUTO_RUN}" ]; then case "${AUTO_RUN}" in
USER_UMASK=`umask` '')
case "${NEW_UMASK}" in
'')
USER_UMASK=`umask`
;;
*)
USER_UMASK="${NEW_UMASK}"
;;
esac
case "${USER_UMASK}" in case "${USER_UMASK}" in
0022|022) ;; 0022|022) ;;
*) *)
echo '' echo ''
echo " *** Your umask is currently set to ${USER_UMASK}. By default, this script" echo " *** Your umask is currently set to ${USER_UMASK}. This script installs"
echo " installs all files with the same user, group and modes that" echo ' all files with the same user, group, and modes that they'
echo " they are created with by ${SOURCEDIR}/Makefile, compared to" echo " are created with by ${SOURCEDIR}/Makefile."
echo " a umask of 022. This umask allows world read permission when"
echo " the file's default permissions have it."
echo " No world permissions can sometimes cause problems. A umask of"
echo " 022 will restore the default behavior, but is not mandatory."
echo " /etc/master.passwd is a special case. Its file permissions"
echo " will be 600 (rw-------) if installed."
echo '' echo ''
echo -n "What umask should I use? [${USER_UMASK}] " echo ' If you would like different permissions for the files or'
read NEW_UMASK echo ' directories, you will have to set them after installation.'
echo ''
NEW_UMASK="${NEW_UMASK:-$USER_UMASK}" press_to_continue
;; ;;
esac esac
echo '' echo ''
fi ;;
esac
CONFIRMED_UMASK=${NEW_UMASK:-0022}
# Warn users who still have ${DESTDIR}/etc/sysconfig # Warn users who still have ${DESTDIR}/etc/sysconfig
# #
@ -621,7 +622,7 @@ if [ -e "${DESTDIR}/etc/sysconfig" ]; then
esac esac
fi fi
# Use the umask/mode information to install the files # Use the mode information to install the files
# Create directories as needed # Create directories as needed
# #
do_install_and_rm () { do_install_and_rm () {
@ -641,13 +642,11 @@ mm_install () {
esac esac
if [ -n "${DESTDIR}${INSTALL_DIR}" -a ! -d "${DESTDIR}${INSTALL_DIR}" ]; then if [ -n "${DESTDIR}${INSTALL_DIR}" -a ! -d "${DESTDIR}${INSTALL_DIR}" ]; then
DIR_MODE=`perl -e 'printf "%04o\n", (((stat("$ARGV[0]"))[2] & 07777) &~ \ DIR_MODE=`stat -f "%OMp%OLp" "${TEMPROOT}/${INSTALL_DIR}"`
oct("$ARGV[1]"))' "${TEMPROOT}/${INSTALL_DIR}" "${CONFIRMED_UMASK}"`
install -d -o root -g wheel -m "${DIR_MODE}" "${DESTDIR}${INSTALL_DIR}" install -d -o root -g wheel -m "${DIR_MODE}" "${DESTDIR}${INSTALL_DIR}"
fi fi
FILE_MODE=`perl -e 'printf "%04o\n", (((stat("$ARGV[0]"))[2] & 07777) &~ \ FILE_MODE=`stat -f "%OMp%OLp" "${1}"`
oct("$ARGV[1]"))' "${1}" "${CONFIRMED_UMASK}"`
if [ ! -x "${1}" ]; then if [ ! -x "${1}" ]; then
case "${1#.}" in case "${1#.}" in