Browse code

Dont't bother user if there are no dependencies. Better help.

Nat! authored on 05-08-2016 11:45:18
Showing 5 changed files
... ...
@@ -6,7 +6,8 @@
6 6
 * You can now put configuration setting like variables into the URL. Like so:
7 7
    https://${host:-www.mulle-kybernetik.com}:foo.git. Define the host like
8 8
    a regular fetch setting. `echo "x.y.com" > .bootstrap/host`
9
-
9
+* Fix help screen for refresh and update
10
+* Don't complain if there are no dependencies generated
10 11
 
11 12
 1.0
12 13
 ===
... ...
@@ -291,7 +291,7 @@ main()
291 291
          ;;
292 292
 
293 293
       build)
294
-         COMMAND="refresh" mulle-bootstrap-refresh.sh  || exit 1
294
+         COMMAND="refresh" mulle-bootstrap-refresh.sh || exit 1
295 295
          COMMAND="${command}" mulle-bootstrap-build.sh "$@" || exit 1
296 296
          ;;
297 297
 
... ...
@@ -315,7 +315,7 @@ main()
315 315
          ;;
316 316
 
317 317
       update)
318
-         COMMAND="refresh" mulle-bootstrap-refresh.sh "$@" || exit 1
318
+         COMMAND="refresh" mulle-bootstrap-refresh.sh || exit 1
319 319
          COMMAND="${command}" mulle-bootstrap-fetch.sh "$@" || exit 1
320 320
          ;;
321 321
 
... ...
@@ -324,12 +324,12 @@ main()
324 324
          ;;
325 325
 
326 326
       setup-xcode|xcode)
327
-         COMMAND="refresh" mulle-bootstrap-refresh.sh  || exit 1
327
+         COMMAND="refresh" mulle-bootstrap-refresh.sh || exit 1
328 328
          mulle-bootstrap-xcode.sh "$@"|| exit 1
329 329
          ;;
330 330
 
331 331
       tag)
332
-         COMMAND="refresh" mulle-bootstrap-refresh.sh  || exit 1
332
+         COMMAND="refresh" mulle-bootstrap-refresh.sh || exit 1
333 333
          mulle-bootstrap-tag.sh "$@" || exit 1
334 334
          ;;
335 335
 
... ...
@@ -1891,8 +1891,13 @@ main()
1891 1891
 
1892 1892
    build_clones "$@"
1893 1893
 
1894
-   log_info "Write-protecting ${C_RESET_BOLD}${DEPENDENCY_SUBDIR}${C_INFO} to avoid spurious header edits"
1895
-   exekutor chmod -R a-w "${DEPENDENCY_SUBDIR}"
1894
+   if [ -d "${DEPENDENCY_SUBDIR}" ]
1895
+   then
1896
+      log_info "Write-protecting ${C_RESET_BOLD}${DEPENDENCY_SUBDIR}${C_INFO} to avoid spurious header edits"
1897
+      exekutor chmod -R a-w "${DEPENDENCY_SUBDIR}"
1898
+   else
1899
+      log_fluff "No dependencies have been generated"
1900
+   fi
1896 1901
 }
1897 1902
 
1898 1903
 main "$@"
... ...
@@ -45,7 +45,9 @@
45 45
 usage()
46 46
 {
47 47
    cat <<EOF
48
-usage: fetch <install|nonrecursive|update>
48
+usage: fetch [-f] <install|nonrecursive|update>
49
+   -f           : override dirty harry check
50
+
49 51
    install      : clone or symlink non-exisiting repositories and other resources
50 52
    nonrecursive : like above, but ignore .bootstrap folders of repositories
51 53
    update       : execute `git pull` in fetched repositories
... ...
@@ -42,49 +42,53 @@
42 42
 usage()
43 43
 {
44 44
    cat <<EOF
45
-usage: refresh <refresh|nonrecursive>
45
+usage: <refresh|nonrecursive>
46 46
    refresh      : update settings, remove unused repositories (default)
47 47
    nonrecursive : ignore .bootstrap folders of fetched repositories
48 48
 EOF
49 49
 }
50 50
 
51 51
 
52
-check_and_usage_and_help()
53
-{
54
-   case "$COMMAND" in
55
-      nonrecursive)
56
-        DONT_RECURSE="YES"
57
-         ;;
58
-      refresh)
59
-         ;;
60
-      *)
61
-         usage >&2
62
-         exit 1
63
-         ;;
64
-   esac
65
-}
52
+while :
53
+do
54
+   if [ "$1" = "-h" -o "$1" = "--help" ]
55
+   then
56
+      usage >&2
57
+      exit 1
58
+   fi
66 59
 
60
+   break
61
+done
67 62
 
68
-if [ "$1" = "-h" -o "$1" = "--help" ]
63
+
64
+if [ -z "${COMMAND}" ]
69 65
 then
70
-   COMMAND=help
71
-else
72
-   if [ -z "${COMMAND}" ]
73
-   then
74
-      COMMAND=${1:-"refresh"}
75
-      [ $# -eq 0 ] || shift
76
-   fi
66
+   COMMAND=${1:-"refresh"}
67
+   [ $# -eq 0 ] || shift
68
+fi
77 69
 
78
-   if [ "${MULLE_BOOTSTRAP}" = "mulle-bootstrap" ]
79
-   then
80
-      COMMAND="refresh"
81
-   fi
70
+if [ "${MULLE_BOOTSTRAP}" = "mulle-bootstrap" ]
71
+then
72
+   COMMAND="refresh"
82 73
 fi
83 74
 
84 75
 
85
-check_and_usage_and_help
76
+case "$COMMAND" in
77
+   refresh)
78
+      ;;
79
+   nonrecursive)
80
+     DONT_RECURSE="YES"
81
+      ;;
86 82
 
83
+   *)
84
+      usage >&2
85
+      exit 1
86
+      ;;
87
+esac
87 88
 
89
+#
90
+#
91
+#
88 92
 
89 93
 refresh_repositories_settings()
90 94
 {