Subversion Repositories OpenARM Single-board Computer

Rev

Blame | Last modification | View Log | RSS feed

#!/bin/bash

#Company:       PowerCraft Technology
#Author:        Copyright Jelle de Jong <jelledejong@powercraft.nl>
#Note:          Please send me an email if you enhanced the script
#Version:       0.0.1
#Date:          20-08-2008
#Description:   create symbolic links of all *.sym files in one place

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

if [ -n "$1" ] && [ "$1" == "update" ]
then
    OPTIONS+="-mmin -15"
fi

if [ -z "$2" ]
then
    DESTINATION="../gschem/sym/all"
else
    DESTINATION="$1"
fi

if [ -z "$3" ]
then
    SOURCE="../gschem/sym/resources"
else
    SOURCE="$1"
fi

find -P "$DESTINATION" -maxdepth 1 -type l -exec rm --verbose '{}' \;

unset list
list=($(find "$SOURCE" -maxdepth 3 $OPTIONS -type f -iname "*.sym"))

for file in "${list[@]}"
do
    filename=${file##*/}
    location=${file#*"resources"}
    location=${location%/*}
    path="../resources"
    path+="$location"
    ln --symbolic $path/$filename $DESTINATION/$filename
done

exit