-
Notifications
You must be signed in to change notification settings - Fork 1
/
common.sh
66 lines (61 loc) · 1.8 KB
/
common.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
. conf.sh
copy_pcbnew_libs () {
LIBDIR=$1
if [ ! -d $LIBDIR ]; then
echo "Skipping $LIBDIR as it is not a directory..."
sleep 1
return 1
fi
LIBNAME=$(basename $LIBDIR)
TARGET="$KICAD_MODULES_DIR/$LIBNAME"
sudo rm -rf $TARGET
sudo mkdir -p $TARGET
while read -rd $'\0' i; do
FOOTPRINT_NAME=$(basename $i)
echo "in $LIBNAME, found pcbnew lib: $FOOTPRINT_NAME"
sudo cp -a "$i" $TARGET
done < <( find $LIBDIR -type d -iname "*.pretty" -print0 )
sudo chmod 755 $TARGET -R
}
copy_eeschema_libs () {
LIBDIR=$1
if [ ! -d $LIBDIR ]; then
echo "Skipping $LIBDIR as it is not a directory..."
sleep 1
return 1
fi
LIBNAME=$(basename $LIBDIR)
TARGET="$KICAD_LIBRARY_DIR/$LIBNAME"
echo "Looking into $LIBDIR"
sudo rm -rf $TARGET
sudo mkdir -p $TARGET
while read -rd $'\0' i; do
LIBRARY_NAME=$(basename $i)
echo "in $LIBNAME, found eeschema lib: $LIBRARY_NAME"
sudo cp "$i" $TARGET
done < <( find $LIBDIR \( -iname "*.lib" -o -iname "*.dcm" \) -print0 )
sudo chmod 755 $TARGET -R
}
copy_packages3d () {
LIBDIR=$1
if [ ! -d $LIBDIR ]; then
echo "Skipping $LIBDIR as it is not a directory..."
sleep 1
return 1
fi
LIBNAME=$(basename $LIBDIR)
sudo mkdir -p $KICAD_3DMOD_DIR/$LIBNAME
echo "Copying 3D drawings under $LIBNAME to $KICAD_3DMOD_DIR/$LIBNAME"
sleep 3
sudo rsync -avP --delete --include="*.3dshapes" --exclude="*" $LIBDIR/ $KICAD_3DMOD_DIR/$LIBNAME
}
install_lib_warning () {
echo
echo "------------------ WARNING --------------------------"
echo "Do not forget to run:"
echo " ./update-fplib-table.sh"
echo " ./update-kicad-template.sh"
echo "-----------------------------------------------------"
echo
}