Преглед на файлове

add -s option to rpmtool config

Ralf S. Engelschall преди 24 години
родител
ревизия
6818133ff8
променени са 2 файла, в които са добавени 20 реда и са изтрити 9 реда
  1. 1 1
      openpkg/openpkg.spec
  2. 19 8
      openpkg/rpmtool

+ 1 - 1
openpkg/openpkg.spec

@@ -39,7 +39,7 @@
 
 #   the package version and release
 %define       V_openpkg 0.9
-%define       R_openpkg 20011104.0
+%define       R_openpkg 20011107.0
 
 #   the used software versions
 %define       V_rpm     4.0.2

+ 19 - 8
openpkg/rpmtool

@@ -51,7 +51,7 @@ if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
     echo '         [-s <shell>] [-u <min-uid>] <username>'
     echo '  group  [-c] [-d] <groupname> <min-gid> [<username> ...]'
     echo '  signal [-v] [-t] [-n] [-c] [-d <delay>] [-p <pid>] [-m <pattern>] <sig> [<sig> ...]'
-    echo '  config [-v] [-a] [-r] [-b <ext>] [-p <tagprefix>] [-t <tagname>] [-i <tagid>] <file>'
+    echo '  config [-v] [-s] [-a] [-r] [-b <ext>] [-p <tagprefix>] [-t <tagname>] [-i <tagid>] <file>'
     echo ''
     exit 0
 fi
@@ -136,10 +136,11 @@ case $tool in
         opt_m=""
         ;;
     config )
-        str_usage="[-v] [-a] [-r] [-b <ext>] [-p <tagprefix>] [-t <tagname>] [-i <tagid>] <file>"
+        str_usage="[-v] [-s] [-a] [-r] [-b <ext>] [-p <tagprefix>] [-t <tagname>] [-i <tagid>] <file>"
         arg_spec="1="
-        opt_spec="v.a.r.b:p:t:i:c:"
+        opt_spec="v.s.a.r.b:p:t:i:c:"
         opt_v=no
+        opt_s=no
         opt_a=no
         opt_r=no
         opt_b=""
@@ -1096,8 +1097,12 @@ EOT
         #   add entry
         if [ ".$opt_a" = .yes ]; then
             if [ ".$check" != . ]; then
-                echo "$msgprefix:Error: config entry already exists" 1>&2
-                exit 1
+                if [ ".$opt_s" = .yes ]; then
+                    exit 0
+                else
+                    echo "$msgprefix:Error: config entry already exists" 1>&2
+                    exit 1
+                fi
             fi
             cp $configfile $configfile$ext
             echo "${block_start}" >$tmpfile
@@ -1108,8 +1113,12 @@ EOT
         #   remove entry
         elif [ ".$opt_r" = .yes ]; then
             if [ ".$check" = . ]; then
-                echo "$msgprefix:Error: config entry does not exist" 1>&2
-                exit 1
+                if [ ".$opt_s" = .yes ]; then
+                    exit 0
+                else
+                    echo "$msgprefix:Error: config entry does not exist" 1>&2
+                    exit 1
+                fi
             fi
             cp $configfile $configfile$ext
             sed -e "/^${block_start_esc}/,/^${block_end_esc}/d" \
@@ -1122,7 +1131,9 @@ EOT
             if [ ".`cat $tmpfile`" = . ]; then
                 (diff -C1 $configfile$ext $configfile >$tmpfile) 2>/dev/null
                 if [ ".`cat $tmpfile`" = . ]; then
-                    echo "$msgprefix:Warning: unable to show difference for config file \`$configfile'" 1>&2
+                    if [ ".$opt_s" = .no ]; then
+                        echo "$msgprefix:Warning: unable to show difference for config file \`$configfile'" 1>&2
+                    fi
                 fi
             fi
             echo "editing $configfile:"