diff --git a/Shorewall-core/install.sh b/Shorewall-core/install.sh index 44a30273a..1fe40556a 100755 --- a/Shorewall-core/install.sh +++ b/Shorewall-core/install.sh @@ -276,40 +276,26 @@ echo "Installing $Product Version $VERSION" # # Create directories # -mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall -chmod 755 ${DESTDIR}${LIBEXECDIR}/shorewall +make_parent_directory ${DESTDIR}${LIBEXECDIR}/shorewall 0755 -mkdir -p ${DESTDIR}${SHAREDIR}/shorewall -chmod 755 ${DESTDIR}${SHAREDIR}/shorewall +make_parent_directory ${DESTDIR}${SHAREDIR}/shorewall 0755 -mkdir -p ${DESTDIR}${CONFDIR} -chmod 755 ${DESTDIR}${CONFDIR} +make_parent_directory ${DESTDIR}${CONFDIR} 0755 -if [ -n "${SYSCONFDIR}" ]; then - mkdir -p ${DESTDIR}${SYSCONFDIR} - chmod 755 ${DESTDIR}${SYSCONFDIR} -fi +[ -n "${SYSCONFDIR}" ] && make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755 if [ -z "${SERVICEDIR}" ]; then SERVICEDIR="$SYSTEMD" fi -if [ -n "${SERVICEDIR}" ]; then - mkdir -p ${DESTDIR}${SERVICEDIR} - chmod 755 ${DESTDIR}${SERVICEDIR} -fi +[ -n "${SERVICEDIR}" ] && make_parent_directory ${DESTDIR}${SERVICEDIR} 0755 -mkdir -p ${DESTDIR}${SBINDIR} -chmod 755 ${DESTDIR}${SBINDIR} +make_parent_directory ${DESTDIR}${SBINDIR} 0755 -if [ -n "${MANDIR}" ]; then - mkdir -p ${DESTDIR}${MANDIR} - chmod 755 ${DESTDIR}${MANDIR} -fi +[ -n "${MANDIR}" ] && make_parent_directory ${DESTDIR}${MANDIR} 0755 if [ -n "${INITFILE}" ]; then - mkdir -p ${DESTDIR}${INITDIR} - chmod 755 ${DESTDIR}${INITDIR} + make_parent_directory ${DESTDIR}${INITDIR} 0755 if [ -n "$AUXINITSOURCE" -a -f "$AUXINITSOURCE" ]; then install_file $AUXINITSOURCE ${DESTDIR}${INITDIR}/$AUXINITFILE 0544 @@ -360,7 +346,7 @@ fi if [ -n "$MANDIR" ]; then cd manpages - [ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}${MANDIR}/man8/ + [ -n "$INSTALLD" ] || make_parent_directory ${DESTDIR}${MANDIR}/man8 0755 for f in *.8; do gzip -9c $f > $f.gz diff --git a/Shorewall-init/install.sh b/Shorewall-init/install.sh index 24b33b44b..8cbfcb31a 100755 --- a/Shorewall-init/install.sh +++ b/Shorewall-init/install.sh @@ -270,7 +270,7 @@ if [ -n "$DESTDIR" ]; then OWNERSHIP="" fi - make_directory ${DESTDIR}${INITDIR} 0755 + make_parent_directory ${DESTDIR}${INITDIR} 0755 fi echo "Installing $Product Version $VERSION" @@ -284,16 +284,13 @@ else first_install="Yes" fi -if [ -n "$DESTDIR" ]; then - mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d - chmod 0755 ${DESTDIR}${CONFDIR}/logrotate.d -fi +[ -n "$DESTDIR" ] && make_parent_directory ${DESTDIR}${CONFDIR}/logrotate.d 0755 # # Install the Firewall Script # if [ -n "$INITFILE" ]; then - mkdir -p ${DESTDIR}${INITDIR} + make_parent_directory ${DESTDIR}${INITDIR} 0755 install_file $INITSOURCE ${DESTDIR}${INITDIR}/$INITFILE 0544 [ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${INITDIR}/$INITFILE @@ -312,15 +309,12 @@ if [ -z "${SERVICEDIR}" ]; then fi if [ -n "$SERVICEDIR" ]; then - mkdir -p ${DESTDIR}${SERVICEDIR} + make_parent_directory ${DESTDIR}${SERVICEDIR} 0755 [ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service install_file $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service 0644 [ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service" - if [ -n "$DESTDIR" -o $configure -eq 0 ]; then - mkdir -p ${DESTDIR}${SBINDIR} - chmod 0755 ${DESTDIR}${SBINDIR} - fi + [ -n "$DESTDIR" -o $configure -eq 0 ] && make_parent_directory ${DESTDIR}${SBINDIR} 0755 install_file $PRODUCT ${DESTDIR}${SBINDIR}/$PRODUCT 0700 [ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SBINDIR}/$PRODUCT echo "CLI installed as ${DESTDIR}${SBINDIR}/$PRODUCT" @@ -329,8 +323,7 @@ fi # # Create /usr/share/shorewall-init if needed # -mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT -chmod 0755 ${DESTDIR}${SHAREDIR}/$PRODUCT +make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT 0755 # # Install logrotate file @@ -356,21 +349,19 @@ fi if [ $HOST = debian ]; then if [ -n "${DESTDIR}" ]; then - mkdir -p ${DESTDIR}${ETC}/network/if-up.d/ - mkdir -p ${DESTDIR}${ETC}/network/if-down.d/ - mkdir -p ${DESTDIR}${ETC}/network/if-post-down.d/ + make_parent_directory ${DESTDIR}${ETC}/network/if-up.d 0755 + make_parent_directory ${DESTDIR}${ETC}/network/if-down.d 0755 + make_parent_directory ${DESTDIR}${ETC}/network/if-post-down.d 0755 elif [ $configure -eq 0 ]; then - mkdir -p ${DESTDIR}${CONFDIR}/network/if-up.d/ - mkdir -p ${DESTDIR}${CONFDIR}/network/if-down.d/ - mkdir -p ${DESTDIR}${CONFDIR}/network/if-post-down.d/ + make_parent_directory ${DESTDIR}${CONFDIR}/network/if-up.d 0755 + make_parent_directory ${DESTDIR}${CONFDIR}/network/if-down.d 0755 + make_parent_directory ${DESTDIR}${CONFDIR}/network/if-post-down.d 0755 fi if [ ! -f ${DESTDIR}${CONFDIR}/default/$PRODUCT ]; then - if [ -n "${DESTDIR}" ]; then - mkdir -p ${DESTDIR}${ETC}/default - fi + [ -n "${DESTDIR}" ] && make_parent_directory ${DESTDIR}${ETC}/default 0755 - [ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/default + [ $configure -eq 1 ] || make_parent_directory ${DESTDIR}${CONFDIR}/default 0755 install_file sysconfig ${DESTDIR}${ETC}/default/$PRODUCT 0644 echo "sysconfig file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}" fi @@ -378,12 +369,12 @@ if [ $HOST = debian ]; then IFUPDOWN=ifupdown.debian.sh else if [ -n "$DESTDIR" ]; then - mkdir -p ${DESTDIR}${SYSCONFDIR} + make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755 if [ -z "$RPM" ]; then if [ $HOST = suse ]; then - mkdir -p ${DESTDIR}${ETC}/sysconfig/network/if-up.d - mkdir -p ${DESTDIR}${ETC}/sysconfig/network/if-down.d + make_parent_directory ${DESTDIR}${ETC}/sysconfig/network/if-up.d 0755 + make_parent_directory ${DESTDIR}${ETC}/sysconfig/network/if-down.d 0755 elif [ $HOST = gentoo ]; then # Gentoo does not support if-{up,down}.d /bin/true @@ -391,7 +382,7 @@ else # Not implemented on openwrt /bin/true else - mkdir -p ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d + make_parent_directory ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d 0755 fi fi fi @@ -413,13 +404,13 @@ if [ $HOST != openwrt ]; then [ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ifupdown - mkdir -p ${DESTDIR}${LIBEXECDIR}/$PRODUCT + make_parent_directory ${DESTDIR}${LIBEXECDIR}/$PRODUCT 0755 install_file ifupdown ${DESTDIR}${LIBEXECDIR}/$PRODUCT/ifupdown 0544 fi if [ -d ${DESTDIR}/etc/NetworkManager ]; then - [ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d/ + [ $configure -eq 1 ] || make_parent_directory ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d 0755 install_file ifupdown ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall 0544 fi @@ -438,8 +429,8 @@ case $HOST in suse) if [ -z "$RPM" ]; then if [ $configure -eq 0 ]; then - mkdir -p ${DESTDIR}${SYSCONFDIR}/network/if-up.d/ - mkdir -p ${DESTDIR}${SYSCONFDIR}/network/if-down.d/ + make_parent_directory ${DESTDIR}${SYSCONFDIR}/network/if-up.d 0755 + make_parent_directory ${DESTDIR}${SYSCONFDIR}/network/if-down.d 0755 fi install_file ifupdown ${DESTDIR}${SYSCONFDIR}/network/if-up.d/shorewall 0544 @@ -542,7 +533,7 @@ else if [ $configure -eq 1 -a -n "$first_install" ]; then if [ $HOST = debian -a -z "$SERVICEDIR" ]; then if [ -n "${DESTDIR}" ]; then - mkdir -p ${DESTDIR}/etc/rcS.d + make_parent_directory ${DESTDIR}/etc/rcS.d 0755 fi ln -sf ../init.d/$PRODUCT ${DESTDIR}${CONFDIR}/rcS.d/S38${PRODUCT} @@ -557,7 +548,7 @@ if [ -d ${DESTDIR}/etc/ppp ]; then case $HOST in debian|suse) for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do - mkdir -p ${DESTDIR}/etc/ppp/$directory #SuSE doesn't create the IPv6 directories + make_parent_directory ${DESTDIR}/etc/ppp/$directory 0755 #SuSE doesn't create the IPv6 directories cp -fp ${DESTDIR}${LIBEXECDIR}/$PRODUCT/ifupdown ${DESTDIR}${CONFDIR}/ppp/$directory/shorewall done ;; diff --git a/Shorewall-lite/install.sh b/Shorewall-lite/install.sh index 293db7e85..9790b37e4 100755 --- a/Shorewall-lite/install.sh +++ b/Shorewall-lite/install.sh @@ -279,7 +279,7 @@ if [ -n "$DESTDIR" ]; then OWNERSHIP="" fi - make_directory ${DESTDIR}${INITDIR} 755 + make_parent_directory ${DESTDIR}${INITDIR} 0755 else if [ ! -f ${SHAREDIR}/shorewall/coreversion ]; then @@ -319,25 +319,20 @@ fi delete_file ${DESTDIR}/usr/share/$PRODUCT/xmodules -[ -n "${INITFILE}" ] && make_directory ${DESTDIR}${INITDIR} 755 +[ -n "${INITFILE}" ] && make_parent_directory ${DESTDIR}${INITDIR} 0755 # # Create ${CONFDIR}/$PRODUCT, /usr/share/$PRODUCT and /var/lib/$PRODUCT if needed # -mkdir -p ${DESTDIR}${CONFDIR}/$PRODUCT -mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT -mkdir -p ${DESTDIR}${LIBEXECDIR}/$PRODUCT -mkdir -p ${DESTDIR}${SBINDIR} -mkdir -p ${DESTDIR}${VARDIR} - -chmod 755 ${DESTDIR}${CONFDIR}/$PRODUCT -chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT +make_parent_directory ${DESTDIR}${CONFDIR}/$PRODUCT 0755 +make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT 0755 +make_parent_directory ${DESTDIR}${LIBEXECDIR}/$PRODUCT 0755 +make_parent_directory ${DESTDIR}${SBINDIR} 0755 +make_parent_directory ${DESTDIR}${VARDIR} 0755 if [ -n "$DESTDIR" ]; then - mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d - chmod 755 ${DESTDIR}${CONFDIR}/logrotate.d - mkdir -p ${DESTDIR}${INITDIR} - chmod 755 ${DESTDIR}${INITDIR} + make_parent_directory ${DESTDIR}${CONFDIR}/logrotate.d 0755 + make_parent_directory ${DESTDIR}${INITDIR} 0755 fi if [ -n "$INITFILE" ]; then @@ -358,7 +353,7 @@ if [ -z "${SERVICEDIR}" ]; then fi if [ -n "$SERVICEDIR" ]; then - mkdir -p ${DESTDIR}${SERVICEDIR} + make_parent_directory ${DESTDIR}${SERVICEDIR} 0755 [ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service install_file $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service 644 [ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service @@ -440,7 +435,7 @@ done if [ -d manpages -a -n "$MANDIR" ]; then cd manpages - mkdir -p ${DESTDIR}${MANDIR}/man5/ + make_parent_directory ${DESTDIR}${MANDIR}/man5 0755 for f in *.5; do gzip -c $f > $f.gz @@ -448,7 +443,7 @@ if [ -d manpages -a -n "$MANDIR" ]; then echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man5/$f.gz" done - mkdir -p ${DESTDIR}${MANDIR}/man8/ + make_parent_directory ${DESTDIR}${MANDIR}/man8 0755 for f in *.8; do gzip -c $f > $f.gz @@ -493,10 +488,7 @@ ln -sf shorewall ${DESTDIR}${SBINDIR}/${PRODUCT} # Note -- not all packages will have the SYSCONFFILE so we need to check for its existance here # if [ -n "$SYSCONFFILE" -a -f "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PRODUCT} ]; then - if [ ${DESTDIR} ]; then - mkdir -p ${DESTDIR}${SYSCONFDIR} - chmod 755 ${DESTDIR}${SYSCONFDIR} - fi + [ ${DESTDIR} ] && make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755 install_file ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/${PRODUCT} 0640 echo "$SYSCONFFILE file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}" diff --git a/Shorewall/install.sh b/Shorewall/install.sh index 09cff22e4..40dc7fc18 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -367,22 +367,16 @@ fi # # Create /etc/$PRODUCT and other directories # -mkdir -p ${DESTDIR}${CONFDIR}/$PRODUCT -mkdir -p ${DESTDIR}${LIBEXECDIR}/$PRODUCT -mkdir -p ${DESTDIR}${PERLLIBDIR}/Shorewall -mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles -mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT/deprecated -mkdir -p ${DESTDIR}${VARDIR} +make_parent_directory ${DESTDIR}${CONFDIR}/$PRODUCT 0755 +make_parent_directory ${DESTDIR}${LIBEXECDIR}/$PRODUCT 0755 +make_parent_directory ${DESTDIR}${PERLLIBDIR}/Shorewall 0755 +make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles 0755 +make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT/deprecated 0755 +make_parent_directory ${DESTDIR}${VARDIR} 0755 -chmod 755 ${DESTDIR}${CONFDIR}/$PRODUCT -chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT -chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles -chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT/deprecated +chmod 0755 ${DESTDIR}${SHAREDIR}/$PRODUCT -if [ -n "$DESTDIR" ]; then - mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d - chmod 755 ${DESTDIR}${CONFDIR}/logrotate.d -fi +[ -n "$DESTDIR" ] && make_parent_directory ${DESTDIR}${CONFDIR}/logrotate.d 0755 # # Install the .service file @@ -392,7 +386,7 @@ if [ -z "${SERVICEDIR}" ]; then fi if [ -n "$SERVICEDIR" ]; then - mkdir -p ${DESTDIR}${SERVICEDIR} + make_parent_directory ${DESTDIR}${SERVICEDIR} 0755 [ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service run_install $OWNERSHIP -m 644 $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service [ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service @@ -1077,8 +1071,7 @@ if [ -d Perl ]; then # # ${SHAREDIR}/$PRODUCT/$Product if needed # - mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT/$Product - chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT/$Product + make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT/$Product 0755 # # Install the Compiler # @@ -1145,7 +1138,7 @@ if [ -n "$MANDIR" ]; then cd manpages -[ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}${MANDIR}/man5/ +[ -n "$INSTALLD" ] || make_parent_directory ${DESTDIR}${MANDIR}/man5 0755 for f in *.5; do gzip -9c $f > $f.gz @@ -1153,7 +1146,7 @@ for f in *.5; do echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man5/$f.gz" done -[ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}${MANDIR}/man8/ +[ -n "$INSTALLD" ] || make_parent_directory ${DESTDIR}${MANDIR}/man8 0755 for f in *.8; do gzip -9c $f > $f.gz @@ -1176,8 +1169,7 @@ fi # if [ -n "$SYSCONFFILE" -a -f "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PRODUCT} ]; then if [ ${DESTDIR} ]; then - mkdir -p ${DESTDIR}${SYSCONFDIR} - chmod 755 ${DESTDIR}${SYSCONFDIR} + make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755 fi run_install $OWNERSHIP -m 0644 ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/$PRODUCT