--- makepkg.orig 2004-11-26 13:09:03.000000000 +0000 +++ makepkg 2004-11-26 13:45:32.000000000 +0000 @@ -22,6 +22,9 @@ # # Wed Mar 18 15:32:33 CST 1998 # Patched to avoid possible symlink attacks in /tmp. +# Fri Nov 26 13:53:36 GMT 2004 +# Patched to chmod 755 the package's root directory +# - will restore previous permissions after the package has been created TAR=tar-1.13 umask 022 @@ -209,6 +212,19 @@ find . -type d -exec chmod -v 755 {} \; find . -type d -exec chown -v root.root {} \; fi + +# Ensure that the 'root' of the package is chmod 755 because +# the / of your filesystem will inherit these permissions. +# If it's anything tighter than 755 then bad things happen such as users +# not being able to login, users already logged in can no longer run commands +# and so on. +OLDROOTPERMS="`find -name . -printf "%m\n"`" +if [ $OLDROOTPERMS -ne 755 ]; then + echo "WARNING: $PWD is chmod $OLDROOTPERMS" + echo " temporarily changing to chmod 755" + chmod 755 . +fi + echo echo "Creating tar file $TAR_NAME.tar..." echo @@ -231,6 +247,14 @@ echo "Moving $PACKAGE_NAME to $TARGET_NAME..." mv $PACKAGE_NAME $TARGET_NAME fi + +# Restore the old permissions if they previously weren't chmod 755 +if [ $OLDROOTPERMS -ne 755 ]; then + echo + echo "Restoring permissions of $PWD to chmod $OLDROOTPERMS" + chmod $OLDROOTPERMS . +fi + echo echo "Package creation complete." echo