Browse code

Update version and usage information

Dmitrii Kashin authored on 10/10/2014 01:05:33
Showing 2 changed files
... ...
@@ -8,3 +8,9 @@
8 8
    ERROR: unable to publish: unable to detached sign file: exit status 2
9 9
    
10 10
    I've patched aptly for this: 59055d7fbddba4ea18b59ef4bdda601d4ebee278
11
+
12
+** TODO action to create mirrors automatically
13
+   User should be lazy, shouldn't he? I think it would be cool if user didn't
14
+   need to create mirrors himself.
15
+   I can check /etc/apt/sources.list and catch his preferred mirrors from
16
+   there. Or I can try to use netselect-apt.
... ...
@@ -1,8 +1,10 @@
1 1
 #!/bin/sh
2 2
 
3
-# Main dependencies: aptly, grep, awk, sed, date
3
+# Main dependencies: aptly(>=0.9), grep, awk, sed, date
4 4
 # Debug dependencies: time
5 5
 
6
+VERSION="0.1"
7
+
6 8
 # This shell script was written in order to help you to update your mirrors
7 9
 # every day via crontab with aptly[1]. All you need is to name your mirrors in
8 10
 # the appropriate format: '$release/$component';
... ...
@@ -30,9 +32,13 @@ repo-update.sh [-d] [-g <gpg-key-passphrase>] [-l <log-file>] <action>
30 30
         with cron.
31 31
 -l	File to store log. Type '-' for output to screen.
32 32
 -b	Batch mode (not to use tty)
33
+-v	Show script version
33 34
 
34 35
 Action could be one of:
35
-update	update mirrors and publications
36
+create	Update mirrors and create publications
37
+update	Update mirrors and publications
38
+clear	Delete publications and snapshots
39
+
36 40
 EOF
37 41
 }
38 42
 
... ...
@@ -48,9 +54,10 @@ DEBUG=0
48 48
 BATCH=""
49 49
 
50 50
 ## Configuration:
51
-while getopts hdbg:l: option
51
+while getopts vhdbg:l: option
52 52
 do
53 53
     case "$option" in
54
+	v) echo "$VERSION"; exit 0;;
54 55
         d) DEBUG=1;;
55 56
 	b) BATCH='-batch=true';;
56 57
         g) GPG_PASSWD="$OPTARG";;
... ...
@@ -61,10 +68,10 @@ do
61 61
 done
62 62
 ACTION=$(eval "echo \"\$$OPTIND\"") # bit-hack: Dash doesn't have ${!OPTIND} construction
63 63
 
64
-# output everything into $LOGFILE
65
-if [ "x$LOGFILE" != "x-" ]
64
+if [ -z "$ACTION" ]
66 65
 then
67
-    exec 3>>"$LOGFILE" 1>&3 2>&1
66
+    usage
67
+    exit 0
68 68
 fi
69 69
 
70 70
 # debug flag enables time measuring 
... ...
@@ -180,6 +187,13 @@ act_test () {
180 180
 }
181 181
 
182 182
 ## Runtime:
183
+
184
+# output everything into $LOGFILE
185
+if [ "x$LOGFILE" != "x-" ]
186
+then
187
+    exec 3>>"$LOGFILE" 1>&3 2>&1
188
+fi
189
+
183 190
 logger "Script $SCRIPT's started at $(LANG=C date)"
184 191
 
185 192
 case "$ACTION" in