-
Notifications
You must be signed in to change notification settings - Fork 35
/
install_plugin.sh
executable file
·68 lines (56 loc) · 1.51 KB
/
install_plugin.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
67
68
#!/bin/bash
# Install Kicad plugin
# For this plugin work, KiRI, kidiff and plotgitsh must be in the enviromnment variable PATH
# Kicad = 5
install_kiri_for_kicad_5()
{
if [[ -d "${HOME}/.kicad" ]]; then
case "${OSTYPE}" in
darwin*)
KICAD_PLUGINS_PATH="$HOME/Library/Preferences/kicad/scripting/plugins"
;;
*)
KICAD_PLUGINS_PATH="$HOME/.kicad/scripting/plugins"
;;
esac
mkdir -p "${KICAD_PLUGINS_PATH}"
rm -rf "${KICAD_PLUGINS_PATH}/kiri"
cp -r "${KIRI_REPO_PATH}/kicad/plugin/kiri_v5" "${KICAD_PLUGINS_PATH}/kiri"
echo "Kiri plugin installed in ${KICAD_PLUGINS_PATH}/kiri"
fi
}
# Kicad >= 6
install_kiri_for_kicad()
{
kicad_version=$1
if [[ -d "$HOME/.local/share/kicad/${kicad_version}/" ]]; then
case "${OSTYPE}" in
darwin*)
KICAD_PLUGINS_PATH="$HOME/Library/Preferences/Kicad/scripting/plugins"
;;
*)
KICAD_PLUGINS_PATH="$HOME/.local/share/kicad/${kicad_version}/scripting/plugins"
;;
esac
mkdir -p "${KICAD_PLUGINS_PATH}"
rm -rf "${KICAD_PLUGINS_PATH}/kiri"
cp -r "${KIRI_REPO_PATH}/kicad/plugin/kiri_v6" "${KICAD_PLUGINS_PATH}/kiri"
echo "Kiri plugin installed in ${KICAD_PLUGINS_PATH}/kiri"
fi
}
main()
{
if [[ -z "${KIRI_REPO_PATH}" ]]; then
if [[ "$(basename "$(pwd)")" == "kiri" ]]; then
KIRI_REPO_PATH=.
else
KIRI_REPO_PATH="${HOME}/.local/share/kiri"
fi
fi
kicad_version=$(kicad_version.py | cut -d"." -f1-2)
case ${kicad_version} in
5.0) install_kiri_for_kicad_5 ;;
*) install_kiri_for_kicad "${kicad_version}" ;;
esac
}
main