~ubuntu-branches/debian/sid/shorewall/sid

« back to all changes in this revision

Viewing changes to lib.cli-std

  • Committer: Package Import Robot
  • Author(s): Roberto C. Sanchez
  • Date: 2013-09-24 19:17:20 UTC
  • mfrom: (1.3.53)
  • Revision ID: package-import@ubuntu.com-20130924191720-zn2nxs9sjn117ypr
Tags: 4.5.20-1
* New Upstream Version (Closes: #712282, #686909)
* Update to Standards-Version 3.9.4 (no changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
337
337
    ifs="$IFS"
338
338
    IFS=':'
339
339
 
340
 
    for dir in $CONFIG_PATH; do
 
340
    for dir in $g_shorewalldir $CONFIG_PATH; do
341
341
        if [ -n "$(find ${dir} -newer $1)" ]; then
342
342
            IFS="$ifs"
343
343
            return 1;
373
373
    #
374
374
    get_config Yes
375
375
 
 
376
    [ -n "$g_doing" ] && progress_message3 "$g_doing..."
 
377
 
376
378
    case $COMMAND in
377
379
        *start|try|refresh)
378
380
            ;;
399
401
        [ -f "$shorewallrc1" ] || fatal_error "Compiling for export requires a shorewallrc file"
400
402
    fi
401
403
 
 
404
    if [ -n "$g_conditional" ] && uptodate $g_file; then
 
405
        echo "$g_file is up to date -- no compilation required"
 
406
        return 0
 
407
    fi
 
408
 
402
409
    options="--verbose=$VERBOSITY --family=$g_family --config_path=$CONFIG_PATH --shorewallrc=${shorewallrc}"
403
410
    [ -n "$shorewallrc1" ] && options="$options --shorewallrc1=${shorewallrc1}"
404
411
    [ -n "$STARTUP_LOG" ] && options="$options --log=$STARTUP_LOG"
466
473
            rc=$?
467
474
            [ -n "$nolock" ] || mutex_off
468
475
        else
469
 
            progress_message3 "Compiling..."
470
 
 
471
476
            if compiler $g_debugging $nolock compile ${VARDIR}/.start; then
472
477
                run_postcompile ${VARDIR}/.start
473
478
                [ -n "$nolock" ] || mutex_on
629
634
                            g_debug=Yes;
630
635
                            option=${option#d}
631
636
                            ;;
 
637
                        c*)
 
638
                            g_conditional=Yes;
 
639
                            option=${option#c}
 
640
                            ;;
632
641
                        T*)
633
642
                            g_confess=Yes
634
643
                            option=${option#T}
649
658
        esac
650
659
    done
651
660
 
652
 
    file=
 
661
    g_file=
653
662
 
654
663
    case $# in
655
664
        0)
656
 
            [ -n "$g_export" ] && file=firewall || file=${VARDIR}/firewall
 
665
            [ -n "$g_export" ] && g_file=firewall || g_file=${VARDIR}/firewall
657
666
            ;;
658
667
        1)
659
 
            file=$1
660
 
            [ -d $file ] && fatal_error "$file is a directory"
 
668
            g_file=$1
 
669
            [ -d $g_file ] && fatal_error "$g_file is a directory"
661
670
            ;;
662
671
        2)
663
672
            [ -n "$g_shorewalldir" -a -z "$g_export" ] && usage 2
671
680
            fi
672
681
 
673
682
            g_shorewalldir=$(resolve_file $1)
674
 
            file=$2
 
683
            g_file=$2
675
684
            ;;
676
685
        *)
677
686
            usage 1
678
687
            ;;
679
688
    esac
680
689
 
681
 
    [ "x$file" = x- ] || progress_message3 "Compiling..."
 
690
    [ "x$g_file" = x- ] && g_doing=''
682
691
 
683
 
    compiler $g_debugging compile $file && run_postcompile $file
 
692
    compiler $g_debugging compile $g_file && run_postcompile $g_file
684
693
}
685
694
 
686
695
#
757
766
            ;;
758
767
    esac
759
768
 
760
 
    progress_message3 "Checking..."
 
769
    g_doing="Checking"
761
770
 
762
771
    compiler $g_debugging $nolock check
763
772
}
849
858
            ;;
850
859
    esac
851
860
 
852
 
    progress_message3 "Updating..."
 
861
    g_doing="Updating..."
853
862
 
854
863
    compiler $g_debugging $nolock check
855
864
}
944
953
    fi
945
954
 
946
955
    if [ -z "$g_fast" ]; then
947
 
        progress_message3 "Compiling..."
948
 
 
949
956
        if compiler $g_debugging $nolock compile ${VARDIR}/.restart; then
950
957
            run_postcompile ${VARDIR}/.restart
951
958
            [ -n "$nolock" ] || mutex_on
1036
1043
 
1037
1044
    [ -n "$STARTUP_ENABLED" ] || fatal_error "Startup is disabled"
1038
1045
 
1039
 
    progress_message3 "Compiling..."
1040
 
 
1041
1046
    if compiler $g_debugging $nolock compile ${VARDIR}/.refresh; then
1042
1047
        run_postcompile ${VARDIR}/.refresh
1043
1048
        [ -n "$nolock" ] || mutex_on
1147
1152
        command="restart"
1148
1153
    fi
1149
1154
 
1150
 
    progress_message3 "Compiling..."
1151
 
 
1152
1155
    if ! compiler $g_debugging nolock compile ${VARDIR}/.$command; then
1153
1156
        status=$?
1154
1157
        exit $status
1280
1283
        command="restart"
1281
1284
    fi
1282
1285
 
1283
 
    progress_message3 "Compiling..."
1284
 
 
1285
1286
    if ! compiler $g_debugging $nolock compile ${VARDIR}/.$command; then
1286
1287
        status=$?
1287
1288
        exit $status
1577
1578
    echo "where <command> is one of:"
1578
1579
    echo "   add <interface>[:<host-list>] ... <zone>"
1579
1580
    echo "   allow <address> ..."
1580
 
    echo "   check [ -e ] [ -r ] [ -p ] [ -r ] [ -T ] [ <directory> ]"
 
1581
    echo "   [ check | ck ] [ -e ] [ -r ] [ -p ] [ -r ] [ -T ] [ <directory> ]"
1581
1582
    echo "   clear"
1582
 
    echo "   compile [ -e ] [ -p ] [ -t ] [ -d ] [ -T ] [ <directory name> ] [ <path name> ]"
 
1583
    echo "   [ compile | co ] [ -e ] [ -p ] [ -t ] [ -c ] [ -d ] [ -T ] [ <directory name> ] [ <path name> ]"
1583
1584
    echo "   delete <interface>[:<host-list>] ... <zone>"
1584
1585
    echo "   disable <interface>"
1585
1586
    echo "   drop <address> ..."
1622
1623
    echo "   safe-restart [ -t <timeout> ] [ <directory> ]"
1623
1624
    echo "   safe-start [ -t <timeout> ] [ <directory> ]"
1624
1625
    echo "   save [ <file name> ]"
1625
 
    echo "   show [ -x ] [ -t {filter|mangle|nat|raw|rawpost} ] [ {chain [<chain> [ <chain> ... ]"
1626
 
    echo "   show actions"
1627
 
    echo "   show [ -f ] capabilities"
1628
 
    echo "   show classifiers"
1629
 
    echo "   show config"
1630
 
    echo "   show connections"
1631
 
    echo "   show dynamic <zone>"
1632
 
    echo "   show filters"
1633
 
    echo "   show ip"
 
1626
    echo "   [ show | list | ls ] [ -x ] [ -t {filter|mangle|nat|raw|rawpost} ] [ {chain [<chain> [ <chain> ... ]"
 
1627
    echo "   [ show | list | ls ] actions"
 
1628
    echo "   [ show | list | ls ] [ -f ] capabilities"
 
1629
    echo "   [ show | list | ls ] classifiers"
 
1630
    echo "   [ show | list | ls ] config"
 
1631
    echo "   [ show | list | ls ] connections"
 
1632
    echo "   [ show | list | ls ] dynamic <zone>"
 
1633
    echo "   [ show | list | ls ] filters"
 
1634
    echo "   [ show | list | ls ] ip"
1634
1635
 
1635
1636
    if [ $g_family -eq 4 ]; then
1636
 
        echo "   show ipa"
 
1637
        echo "   [ show | list | ls ] ipa"
1637
1638
    fi
1638
1639
 
1639
 
    echo "   show [ -m ] log [<regex>]"
1640
 
    echo "   show macro <macro>"
1641
 
    echo "   show macros"
1642
 
    echo "   show marks"
1643
 
    echo "   show [ -x ] mangle|nat|raw|rawpost|routing"
1644
 
    echo "   show nfacct"
1645
 
    echo "   show policies"
1646
 
    echo "   show routing"
1647
 
    echo "   show tc [ device ]"
1648
 
    echo "   show vardir"
1649
 
    echo "   show zones"
 
1640
    echo "   [ show | list | ls ] [ -m ] log [<regex>]"
 
1641
    echo "   [ show | list | ls ] macro <macro>"
 
1642
    echo "   [ show | list | ls ] macros"
 
1643
    echo "   [ show | list | ls ] marks"
 
1644
    echo "   [ show | list | ls ] [ -x ] mangle|nat|raw|rawpost|routing"
 
1645
    echo "   [ show | list | ls ] nfacct"
 
1646
    echo "   [ show | list | ls ] policies"
 
1647
    echo "   [ show | list | ls ] routing"
 
1648
    echo "   [ show | list | ls ] tc [ device ]"
 
1649
    echo "   [ show | list | ls ] vardir"
 
1650
    echo "   [ show | list | ls ] zones"
1650
1651
    echo "   start [ -f ] [ -n ] [ -p ] [ -c ] [ -T ] [ <directory> ]"
1651
1652
    echo "   status"
1652
1653
    echo "   stop"
1660
1661
compiler_command() {
1661
1662
 
1662
1663
    case $COMMAND in
1663
 
        compile)
 
1664
        compile|co)
1664
1665
            shift
1665
1666
            compile_command $@
1666
1667
            ;;
1669
1670
            shift
1670
1671
            refresh_command $@
1671
1672
            ;;
1672
 
        check)
 
1673
        check|ck)
1673
1674
            shift
1674
1675
            check_command $@
1675
1676
            ;;