Lines 7-71
Link Here
|
7 |
|
7 |
|
8 |
scriptname=`basename $0` |
8 |
scriptname=`basename $0` |
9 |
|
9 |
|
10 |
# edit the lines below to your liking |
10 |
get_config() { |
|
|
11 |
item=$1 |
11 |
|
12 |
|
12 |
# arguments used whenever rm is called |
13 |
# First strip off comment lines, then grab the configuration |
13 |
rm_opts="-i" |
14 |
# item. If there's more than one of the same configuration item, |
|
|
15 |
# then allow the last setting to take precedence. |
16 |
cut -d'#' -f1-1 /etc/etc-update.conf | \ |
17 |
sed -ne "s/^\ *$item\ *=\ *\"\(.*\)\"/\1/p" | tail -1 |
18 |
} |
19 |
|
20 |
# load etc-config's configuration |
21 |
rm_opts=`get_config rm_opts` |
22 |
mv_opts=`get_config mv_opts` |
23 |
cp_opts=`get_config cp_opts` |
24 |
pager=`get_config pager` |
25 |
diff_command=`get_config diff_command` |
26 |
merge_command=`get_config merge_command` |
14 |
|
27 |
|
15 |
# arguments used whenever mv is called |
28 |
#echo "rm_opts: $rm_opts, mv_opts: $mv_opts, cp_opts: $cp_opts" |
16 |
mv_opts="-i" |
29 |
#echo "pager: $pager, diff_command: $diff_command, merge_command: $merge_command" |
17 |
|
|
|
18 |
# arguments used whenever cp is called |
19 |
cp_opts="-i" |
20 |
|
21 |
# pager for use with diff commands (see NOTE_2) |
22 |
#pager="less -E" |
23 |
pager="" |
24 |
|
25 |
# vim-users: you CAN use vimdiff for diff_command. (see NOTE_1) |
26 |
diff_command="diff -uN %file1 %file2" |
27 |
#diff_command="vim -d %file1 %file2" |
28 |
|
29 |
# vim-users: don't use vimdiff for merging (see NOTE_1) |
30 |
merge_command="sdiff -s -o %merged %orig %new" |
31 |
|
32 |
# EXPLANATION |
33 |
# |
34 |
# pager: |
35 |
# |
36 |
# Examples of pager usage: |
37 |
# pager="" # don't use a pager |
38 |
# pager="less -E" # less |
39 |
# pager="more" # more |
40 |
# |
41 |
# |
42 |
# diff_command: |
43 |
# |
44 |
# Arguments: |
45 |
# %file1 [REQUIRED] |
46 |
# %file2 [REQUIRED] |
47 |
# |
48 |
# Examples of diff_command: |
49 |
# diff_command="diff -uN %file1 %file2" # diff |
50 |
# diff_command="vim -d %file1 %file2" # vimdiff |
51 |
# |
52 |
# |
53 |
# merge_command: |
54 |
# |
55 |
# Arguments: |
56 |
# %orig [REQUIRED] |
57 |
# %new [REQUIRED] |
58 |
# %merged [REQUIRED] |
59 |
# |
60 |
# Examples of merge_command: |
61 |
# merge_command="sdiff -s -o %merged %old %new" # sdiff |
62 |
# |
63 |
|
64 |
# NOTE_1: Editors such as vim/vimdiff are not usable for the merge_command |
65 |
# because it is not known what filenames the produced files have (the user can |
66 |
# choose while using those programs) |
67 |
|
68 |
# NOTE_2: Make sure pager is set to "" when using an editor as diff_command! |
69 |
|
30 |
|
70 |
# |
31 |
# |
71 |
# Find all "new" configuration files, sort, so that ._cfg_0000 is presented |
32 |
# Find all "new" configuration files, sort, so that ._cfg_0000 is presented |