aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/links-update
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-11-25 19:06:47 +0000
committerEgor Tensin <Egor.Tensin@gmail.com>2021-11-25 19:06:47 +0000
commit4d7904fd36ca5078b47b372691b4c16b256f3307 (patch)
tree5735f76f55dd4853010673a88375b6b136b742c8 /links-update
parentdebian: 1.0.1-1 (diff)
parentREADME: update (diff)
downloadconfig-links-4d7904fd36ca5078b47b372691b4c16b256f3307.tar.gz
config-links-4d7904fd36ca5078b47b372691b4c16b256f3307.zip
Merge tag 'v1.1' into debian
Diffstat (limited to 'links-update')
-rwxr-xr-xlinks-update13
1 files changed, 10 insertions, 3 deletions
diff --git a/links-update b/links-update
index 6c3b633..1e1c829 100755
--- a/links-update
+++ b/links-update
@@ -17,7 +17,7 @@
# `CYGWIN` Windows environment variable value **must** include either
# `winsymlinks:native` or `winsymlinks:nativestrict`!
-# usage: ./update.sh [-h|--help] [-d|--database PATH] [-s|--shared-dir DIR] [-n|--dry-run]
+# usage: ./links-update [-h|--help] [-d|--database PATH] [-s|--shared-dir DIR] [-m|--mode MODE] [-n|--dry-run]
set -o errexit
set -o nounset
@@ -32,6 +32,8 @@ readonly script_dir
src_dir="$( cd -- "$script_dir/src" && pwd )"
readonly src_dir
+mode=''
+
. "$src_dir/common.sh"
. "$src_dir/os.sh"
. "$src_dir/path.sh"
@@ -44,11 +46,12 @@ script_usage() {
echo "$script_name: $msg"
done
- echo "usage: $script_name [-h|--help] [-d|--database PATH] [-s|--shared-dir DIR] [-n|--dry-run]
+ echo "usage: $script_name [-h|--help] [-d|--database PATH] [-s|--shared-dir DIR] [-m|--mode MODE] [-n|--dry-run]
-h,--help show this message and exit
-d,--database set database file path
-s,--shared-dir set top-level shared directory path
(current working directory by default)
+ -m,--mode shared files mode (as in chmod)
-n,--dry-run don't actually do anything intrusive"
}
@@ -66,7 +69,7 @@ parse_script_options() {
set_dry_run
continue
;;
- -d|--database|-s|--shared-dir)
+ -d|--database|-s|--shared-dir|-m|--mode)
;;
*)
script_usage "unrecognized parameter: $key" >&2
@@ -89,6 +92,9 @@ parse_script_options() {
-s|--shared-dir)
update_shared_dir "$value"
;;
+ -m|--mode)
+ mode="$value"
+ ;;
*)
script_usage "unrecognized parameter: $key" >&2
exit 1
@@ -103,6 +109,7 @@ main() {
read_database
unlink_obsolete_entries
link_all_entries
+ test -n "$mode" && chmod_entries "$mode"
write_database
}