Subversion Repositories OpenARM Single-board Computer

Rev

Rev 148 | Rev 153 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
152 jelle 1
#!/bin/bash -x
145 jelle 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
 
152 jelle 20
# This is an evil hack
21
pwd="$PWD"
22
pwd=${pwd%"working"*}
23
pwd+="working/scripts/"
24
cd $pwd
25
 
145 jelle 26
if [ -n "$1" ] && [ "$1" == "update" ]
27
then
152 jelle 28
    OPTIONS+="-mmin -1"
145 jelle 29
fi
30
 
31
if [ -z "$2" ]
32
then
33
    DESTINATION="../gschem/sym/all"
34
else
35
    DESTINATION="$1"
36
fi
37
 
38
if [ -z "$3" ]
39
then
40
    SOURCE="../gschem/sym/resources"
41
else
42
    SOURCE="$1"
43
fi
44
 
152 jelle 45
echo "pwd: $PWD"
46
 
145 jelle 47
find -P "$DESTINATION" -maxdepth 1 -type l -exec rm --verbose '{}' \;
48
 
49
unset list
50
list=($(find "$SOURCE" -maxdepth 3 $OPTIONS -type f -iname "*.sym"))
51
 
52
for file in "${list[@]}"
53
do
54
    filename=${file##*/}
55
    location=${file#*"resources"}
56
    location=${location%/*}
57
    path="../resources"
58
    path+="$location"
59
    ln --symbolic $path/$filename $DESTINATION/$filename
60
done
61
 
62
exit