Rev 145 | Rev 152 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
145 | jelle | 1 | #!/bin/bash |
2 | |||
3 | #Company: PowerCraft Technology |
||
4 | #Author: Copyright Jelle de Jong <jelledejong@powercraft.nl> |
||
5 | #Note: Please send me an email if you enhanced the script |
||
6 | #Version: 0.0.1 |
||
7 | #Date: 20-08-2008 |
||
8 | #Description: create symbolic links of all *.sym files in one place |
||
9 | |||
10 | # This program is free software; you can redistribute it and/or modify |
||
11 | # it under the terms of the GNU General Public License as published by |
||
12 | # the Free Software Foundation; either version 2 of the License, or |
||
13 | # (at your option) any later version. |
||
14 | |||
15 | # This program is distributed in the hope that it will be useful, |
||
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
18 | # GNU General Public License for more details. |
||
19 | |||
20 | if [ -n "$1" ] && [ "$1" == "update" ] |
||
21 | then |
||
22 | OPTIONS+="-mmin -15" |
||
23 | fi |
||
24 | |||
25 | if [ -z "$2" ] |
||
26 | then |
||
27 | DESTINATION="../gschem/sym/all" |
||
28 | else |
||
29 | DESTINATION="$1" |
||
30 | fi |
||
31 | |||
32 | if [ -z "$3" ] |
||
33 | then |
||
34 | SOURCE="../gschem/sym/resources" |
||
35 | else |
||
36 | SOURCE="$1" |
||
37 | fi |
||
38 | |||
39 | find -P "$DESTINATION" -maxdepth 1 -type l -exec rm --verbose '{}' \; |
||
40 | |||
41 | unset list |
||
42 | list=($(find "$SOURCE" -maxdepth 3 $OPTIONS -type f -iname "*.sym")) |
||
43 | |||
44 | for file in "${list[@]}" |
||
45 | do |
||
46 | filename=${file##*/} |
||
47 | location=${file#*"resources"} |
||
48 | location=${location%/*} |
||
49 | path="../resources" |
||
50 | path+="$location" |
||
51 | ln --symbolic $path/$filename $DESTINATION/$filename |
||
52 | done |
||
53 | |||
54 | exit |