diff --git a/Shorewall/install.sh b/Shorewall/install.sh index 47411c714..c93726d35 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -31,6 +31,7 @@ usage() # $1 = exit status echo " $ME -v" echo " $ME -h" echo " $ME -n" + echo " $ME -c" exit $1 } @@ -157,6 +158,7 @@ if [ -z "$GROUP" ] ; then fi NOBACKUP= +NOCONFIGFILES= while [ $# -gt 0 ] ; do case "$1" in @@ -170,6 +172,9 @@ while [ $# -gt 0 ] ; do -n) NOBACKUP=Yes ;; + -c) + NOCONFIGFILES=Yes + ;; *) usage 1 ;; @@ -254,23 +259,25 @@ echo "Shorewall script installed in ${PREFIX}${DEST}/$INIT" # mkdir -p ${PREFIX}/etc/shorewall mkdir -p ${PREFIX}/usr/share/shorewall -mkdir -p ${PREFIX}/usr/share/shorewall/configfiles +[ -n "$NOCONFIGFILES" ] || mkdir -p ${PREFIX}/usr/share/shorewall/configfiles mkdir -p ${PREFIX}/var/lib/shorewall chmod 755 ${PREFIX}/etc/shorewall chmod 755 ${PREFIX}/usr/share/shorewall -chmod 755 ${PREFIX}/usr/share/shorewall/configfiles +[ -n "$NOCONFIGFILES" ] || chmod 755 ${PREFIX}/usr/share/shorewall/configfiles -# -# Install the config file -# -run_install $OWNERSHIP -m 0644 shorewall.conf ${PREFIX}/usr/share/shorewall/configfiles/shorewall.conf +if [ -z "$NOCONFIGFILES" ]; then + # + # Install the config file + # + run_install $OWNERSHIP -m 0644 shorewall.conf ${PREFIX}/usr/share/shorewall/configfiles/shorewall.conf -qt mywhich perl && perl -p -w -i -e 's|^CONFIG_PATH=.*|CONFIG_PATH=/usr/share/shorewall/configfiles:/usr/share/shorewall|;' ${PREFIX}/usr/share/shorewall/configfiles/shorewall.conf + qt mywhich perl && perl -p -w -i -e 's|^CONFIG_PATH=.*|CONFIG_PATH=/usr/share/shorewall/configfiles:/usr/share/shorewall|;' ${PREFIX}/usr/share/shorewall/configfiles/shorewall.conf -if [ ! -f ${PREFIX}/etc/shorewall/shorewall.conf ]; then - run_install $OWNERSHIP -m 0644 shorewall.conf ${PREFIX}/etc/shorewall/shorewall.conf - echo "Config file installed as ${PREFIX}/etc/shorewall/shorewall.conf" + if [ ! -f ${PREFIX}/etc/shorewall/shorewall.conf ]; then + run_install $OWNERSHIP -m 0644 shorewall.conf ${PREFIX}/etc/shorewall/shorewall.conf + echo "Config file installed as ${PREFIX}/etc/shorewall/shorewall.conf" + fi fi @@ -280,7 +287,7 @@ fi # # Install the zones file # -run_install $OWNERSHIP -m 0644 zones ${PREFIX}/usr/share/shorewall/configfiles/zones +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 zones ${PREFIX}/usr/share/shorewall/configfiles/zones if [ ! -f ${PREFIX}/etc/shorewall/zones ]; then run_install $OWNERSHIP -m 0744 zones ${PREFIX}/etc/shorewall/zones @@ -313,7 +320,7 @@ echo "Help command executor installed in ${PREFIX}/usr/share/shorewall/help" # # Install the policy file # -run_install $OWNERSHIP -m 0644 policy ${PREFIX}/usr/share/shorewall/configfiles/policy +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 policy ${PREFIX}/usr/share/shorewall/configfiles/policy if [ ! -f ${PREFIX}/etc/shorewall/policy ]; then run_install $OWNERSHIP -m 0600 policy ${PREFIX}/etc/shorewall/policy @@ -322,7 +329,7 @@ fi # # Install the interfaces file # -run_install $OWNERSHIP -m 0644 interfaces ${PREFIX}/usr/share/shorewall/configfiles/interfaces +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 interfaces ${PREFIX}/usr/share/shorewall/configfiles/interfaces if [ ! -f ${PREFIX}/etc/shorewall/interfaces ]; then run_install $OWNERSHIP -m 0600 interfaces ${PREFIX}/etc/shorewall/interfaces @@ -331,7 +338,7 @@ fi # # Install the ipsec file # -run_install $OWNERSHIP -m 0644 ipsec ${PREFIX}/usr/share/shorewall/configfiles/ipsec +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 ipsec ${PREFIX}/usr/share/shorewall/configfiles/ipsec if [ ! -f ${PREFIX}/etc/shorewall/ipsec ]; then run_install $OWNERSHIP -m 0600 ipsec ${PREFIX}/etc/shorewall/ipsec @@ -341,7 +348,7 @@ fi # # Install the hosts file # -run_install $OWNERSHIP -m 0644 hosts ${PREFIX}/usr/share/shorewall/configfiles/hosts +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 hosts ${PREFIX}/usr/share/shorewall/configfiles/hosts if [ ! -f ${PREFIX}/etc/shorewall/hosts ]; then run_install $OWNERSHIP -m 0600 hosts ${PREFIX}/etc/shorewall/hosts @@ -350,7 +357,7 @@ fi # # Install the rules file # -run_install $OWNERSHIP -m 0644 rules ${PREFIX}/usr/share/shorewall/configfiles/rules +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 rules ${PREFIX}/usr/share/shorewall/configfiles/rules if [ ! -f ${PREFIX}/etc/shorewall/rules ]; then run_install $OWNERSHIP -m 0600 rules ${PREFIX}/etc/shorewall/rules @@ -359,7 +366,7 @@ fi # # Install the NAT file # -run_install $OWNERSHIP -m 0644 nat ${PREFIX}/usr/share/shorewall/configfiles/nat +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 nat ${PREFIX}/usr/share/shorewall/configfiles/nat if [ ! -f ${PREFIX}/etc/shorewall/nat ]; then run_install $OWNERSHIP -m 0600 nat ${PREFIX}/etc/shorewall/nat @@ -368,7 +375,7 @@ fi # # Install the NETMAP file # -run_install $OWNERSHIP -m 0644 netmap ${PREFIX}/usr/share/shorewall/configfiles/netmap +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 netmap ${PREFIX}/usr/share/shorewall/configfiles/netmap if [ ! -f ${PREFIX}/etc/shorewall/netmap ]; then run_install $OWNERSHIP -m 0600 netmap ${PREFIX}/etc/shorewall/netmap @@ -377,7 +384,7 @@ fi # # Install the Parameters file # -run_install $OWNERSHIP -m 0644 params ${PREFIX}/usr/share/shorewall/configfiles/params +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 params ${PREFIX}/usr/share/shorewall/configfiles/params if [ ! -f ${PREFIX}/etc/shorewall/params ]; then run_install $OWNERSHIP -m 0644 params ${PREFIX}/etc/shorewall/params @@ -386,7 +393,7 @@ fi # # Install the proxy ARP file # -run_install $OWNERSHIP -m 0644 proxyarp ${PREFIX}/usr/share/shorewall/configfiles/proxyarp +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 proxyarp ${PREFIX}/usr/share/shorewall/configfiles/proxyarp if [ ! -f ${PREFIX}/etc/shorewall/proxyarp ]; then run_install $OWNERSHIP -m 0600 proxyarp ${PREFIX}/etc/shorewall/proxyarp @@ -395,7 +402,7 @@ fi # # Install the Stopped Routing file # -run_install $OWNERSHIP -m 0644 routestopped ${PREFIX}/usr/share/shorewall/configfiles/routestopped +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 routestopped ${PREFIX}/usr/share/shorewall/configfiles/routestopped if [ ! -f ${PREFIX}/etc/shorewall/routestopped ]; then run_install $OWNERSHIP -m 0600 routestopped ${PREFIX}/etc/shorewall/routestopped @@ -404,7 +411,7 @@ fi # # Install the Mac List file # -run_install $OWNERSHIP -m 0644 maclist ${PREFIX}/usr/share/shorewall/configfiles/maclist +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 maclist ${PREFIX}/usr/share/shorewall/configfiles/maclist if [ ! -f ${PREFIX}/etc/shorewall/maclist ]; then run_install $OWNERSHIP -m 0600 maclist ${PREFIX}/etc/shorewall/maclist @@ -413,7 +420,7 @@ fi # # Install the Masq file # -run_install $OWNERSHIP -m 0644 masq ${PREFIX}/usr/share/shorewall/configfiles/masq +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 masq ${PREFIX}/usr/share/shorewall/configfiles/masq if [ ! -f ${PREFIX}/etc/shorewall/masq ]; then run_install $OWNERSHIP -m 0600 masq ${PREFIX}/etc/shorewall/masq @@ -431,7 +438,7 @@ echo "Xmodules file installed as ${PREFIX}/usr/share/shorewall/xmodules" # # Install the TC Rules file # -run_install $OWNERSHIP -m 0644 tcrules ${PREFIX}/usr/share/shorewall/configfiles/tcrules +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 tcrules ${PREFIX}/usr/share/shorewall/configfiles/tcrules if [ ! -f ${PREFIX}/etc/shorewall/tcrules ]; then run_install $OWNERSHIP -m 0600 tcrules ${PREFIX}/etc/shorewall/tcrules @@ -441,7 +448,7 @@ fi # # Install the TOS file # -run_install $OWNERSHIP -m 0644 tos ${PREFIX}/usr/share/shorewall/configfiles/tos +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 tos ${PREFIX}/usr/share/shorewall/configfiles/tos if [ ! -f ${PREFIX}/etc/shorewall/tos ]; then run_install $OWNERSHIP -m 0600 tos ${PREFIX}/etc/shorewall/tos @@ -450,7 +457,7 @@ fi # # Install the Tunnels file # -run_install $OWNERSHIP -m 0644 tunnels ${PREFIX}/usr/share/shorewall/configfiles/tunnels +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 tunnels ${PREFIX}/usr/share/shorewall/configfiles/tunnels if [ ! -f ${PREFIX}/etc/shorewall/tunnels ]; then run_install $OWNERSHIP -m 0600 tunnels ${PREFIX}/etc/shorewall/tunnels @@ -459,7 +466,7 @@ fi # # Install the blacklist file # -run_install $OWNERSHIP -m 0644 blacklist ${PREFIX}/usr/share/shorewall/configfiles/blacklist +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 blacklist ${PREFIX}/usr/share/shorewall/configfiles/blacklist if [ ! -f ${PREFIX}/etc/shorewall/blacklist ]; then run_install $OWNERSHIP -m 0600 blacklist ${PREFIX}/etc/shorewall/blacklist @@ -478,7 +485,7 @@ delete_file ${PREFIX}/usr/share/shorewall/tcstart # # Install the Providers file # -run_install $OWNERSHIP -m 0644 providers ${PREFIX}/usr/share/shorewall/configfiles/providers +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 providers ${PREFIX}/usr/share/shorewall/configfiles/providers if [ ! -f ${PREFIX}/etc/shorewall/providers ]; then run_install $OWNERSHIP -m 0600 providers ${PREFIX}/etc/shorewall/providers @@ -488,7 +495,7 @@ fi # # Install the Route Rules file # -run_install $OWNERSHIP -m 0644 route_rules ${PREFIX}/usr/share/shorewall/configfiles/route_rules +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 route_rules ${PREFIX}/usr/share/shorewall/configfiles/route_rules if [ ! -f ${PREFIX}/etc/shorewall/route_rules ]; then run_install $OWNERSHIP -m 0600 route_rules ${PREFIX}/etc/shorewall/route_rules @@ -498,7 +505,7 @@ fi # # Install the tcclasses file # -run_install $OWNERSHIP -m 0644 tcclasses ${PREFIX}/usr/share/shorewall/configfiles/tcclasses +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 tcclasses ${PREFIX}/usr/share/shorewall/configfiles/tcclasses if [ ! -f ${PREFIX}/etc/shorewall/tcclasses ]; then run_install $OWNERSHIP -m 0600 tcclasses ${PREFIX}/etc/shorewall/tcclasses @@ -508,7 +515,7 @@ fi # # Install the tcdevices file # -run_install $OWNERSHIP -m 0644 tcdevices ${PREFIX}/usr/share/shorewall/configfiles/tcdevices +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 tcdevices ${PREFIX}/usr/share/shorewall/configfiles/tcdevices if [ ! -f ${PREFIX}/etc/shorewall/tcdevices ]; then run_install $OWNERSHIP -m 0600 tcdevices ${PREFIX}/etc/shorewall/tcdevices @@ -528,7 +535,7 @@ echo "Default config path file installed as ${PREFIX}/usr/share/shorewall/config # # Install the init file # -run_install $OWNERSHIP -m 0644 init ${PREFIX}/usr/share/shorewall/configfiles/init +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 init ${PREFIX}/usr/share/shorewall/configfiles/init if [ ! -f ${PREFIX}/etc/shorewall/init ]; then run_install $OWNERSHIP -m 0600 init ${PREFIX}/etc/shorewall/init @@ -537,7 +544,7 @@ fi # # Install the initdone file # -run_install $OWNERSHIP -m 0644 initdone ${PREFIX}/usr/share/shorewall/configfiles/initdone +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 initdone ${PREFIX}/usr/share/shorewall/configfiles/initdone if [ ! -f ${PREFIX}/etc/shorewall/initdone ]; then run_install $OWNERSHIP -m 0600 initdone ${PREFIX}/etc/shorewall/initdone @@ -546,7 +553,7 @@ fi # # Install the start file # -run_install $OWNERSHIP -m 0644 start ${PREFIX}/usr/share/shorewall/configfiles/start +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 start ${PREFIX}/usr/share/shorewall/configfiles/start if [ ! -f ${PREFIX}/etc/shorewall/start ]; then run_install $OWNERSHIP -m 0600 start ${PREFIX}/etc/shorewall/start @@ -555,7 +562,7 @@ fi # # Install the stop file # -run_install $OWNERSHIP -m 0644 stop ${PREFIX}/usr/share/shorewall/configfiles/stop +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 stop ${PREFIX}/usr/share/shorewall/configfiles/stop if [ ! -f ${PREFIX}/etc/shorewall/stop ]; then run_install $OWNERSHIP -m 0600 stop ${PREFIX}/etc/shorewall/stop @@ -564,7 +571,7 @@ fi # # Install the stopped file # -run_install $OWNERSHIP -m 0644 stopped ${PREFIX}/usr/share/shorewall/configfiles/stopped +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 stopped ${PREFIX}/usr/share/shorewall/configfiles/stopped if [ ! -f ${PREFIX}/etc/shorewall/stopped ]; then run_install $OWNERSHIP -m 0600 stopped ${PREFIX}/etc/shorewall/stopped @@ -573,7 +580,7 @@ fi # # Install the ECN file # -run_install $OWNERSHIP -m 0644 ecn ${PREFIX}/usr/share/shorewall/configfiles/ecn +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 ecn ${PREFIX}/usr/share/shorewall/configfiles/ecn if [ ! -f ${PREFIX}/etc/shorewall/ecn ]; then run_install $OWNERSHIP -m 0600 ecn ${PREFIX}/etc/shorewall/ecn @@ -582,7 +589,7 @@ fi # # Install the Accounting file # -run_install $OWNERSHIP -m 0644 accounting ${PREFIX}/usr/share/shorewall/configfiles/accounting +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 accounting ${PREFIX}/usr/share/shorewall/configfiles/accounting if [ ! -f ${PREFIX}/etc/shorewall/accounting ]; then run_install $OWNERSHIP -m 0600 accounting ${PREFIX}/etc/shorewall/accounting @@ -591,7 +598,7 @@ fi # # Install the Continue file # -run_install $OWNERSHIP -m 0644 continue ${PREFIX}/usr/share/shorewall/configfiles/continue +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 continue ${PREFIX}/usr/share/shorewall/configfiles/continue if [ ! -f ${PREFIX}/etc/shorewall/continue ]; then run_install $OWNERSHIP -m 0600 continue ${PREFIX}/etc/shorewall/continue @@ -600,7 +607,7 @@ fi # # Install the Started file # -run_install $OWNERSHIP -m 0644 started ${PREFIX}/usr/share/shorewall/configfiles/started +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 started ${PREFIX}/usr/share/shorewall/configfiles/started if [ ! -f ${PREFIX}/etc/shorewall/started ]; then run_install $OWNERSHIP -m 0600 started ${PREFIX}/etc/shorewall/started @@ -615,7 +622,7 @@ echo "Standard actions file installed as ${PREFIX}/etc/shorewall/actions.std" # # Install the Actions file # -run_install $OWNERSHIP -m 0644 actions ${PREFIX}/usr/share/shorewall/configfiles/actions +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 actions ${PREFIX}/usr/share/shorewall/configfiles/actions if [ ! -f ${PREFIX}/etc/shorewall/actions ]; then run_install $OWNERSHIP -m 0644 actions ${PREFIX}/etc/shorewall/actions @@ -625,7 +632,7 @@ fi # # Install the Makefile # -run_install $OWNERSHIP -m 0644 Makefile ${PREFIX}/usr/share/shorewall/configfiles/Makefile +[ -n "$NOCONFIGFILES" ] || run_install $OWNERSHIP -m 0644 Makefile ${PREFIX}/usr/share/shorewall/configfiles/Makefile run_install $OWNERSHIP -m 0600 Makefile ${PREFIX}/etc/shorewall/Makefile echo "Makefile installed as ${PREFIX}/etc/shorewall/Makefile" #