2 changed files with 0 additions and 362 deletions
@ -1,89 +0,0 @@ |
|||
REM This file was created using <kicad_src>/scripts/library-repos-install.sh on linux. |
|||
REM Run it from a directory you desire as the base for all libraries. |
|||
git clone https://github.com/KiCad/kicad-library |
|||
git clone https://github.com/KiCad/Displays_7-Segment.pretty |
|||
git clone https://github.com/KiCad/Air_Coils_SML_NEOSID.pretty |
|||
git clone https://github.com/KiCad/Sockets_BNC.pretty |
|||
git clone https://github.com/KiCad/Buzzers_Beepers.pretty |
|||
git clone https://github.com/KiCad/Capacitors_Elko_ThroughHole.pretty |
|||
git clone https://github.com/KiCad/Capacitors.pretty |
|||
git clone https://github.com/KiCad/Capacitors_SMD.pretty |
|||
git clone https://github.com/KiCad/Capacitors_ThroughHole.pretty |
|||
git clone https://github.com/KiCad/Choke_Axial_ThroughHole.pretty |
|||
git clone https://github.com/KiCad/Choke_Radial_ThroughHole.pretty |
|||
git clone https://github.com/KiCad/Choke_SMD.pretty |
|||
git clone https://github.com/KiCad/Choke_Toroid_ThroughHole.pretty |
|||
git clone https://github.com/KiCad/Choke_Common-Mode_Wurth.pretty |
|||
git clone https://github.com/KiCad/Connect.pretty |
|||
git clone https://github.com/KiCad/Connectors_Serial_MOLEX.pretty |
|||
git clone https://github.com/KiCad/Converters_DCDC_ACDC.pretty |
|||
git clone https://github.com/KiCad/Crystals.pretty |
|||
git clone https://github.com/KiCad/Crystals_Oscillators_SMD.pretty |
|||
git clone https://github.com/KiCad/Diodes_SMD.pretty |
|||
git clone https://github.com/KiCad/Diodes_ThroughHole.pretty |
|||
git clone https://github.com/KiCad/Discret.pretty |
|||
git clone https://github.com/KiCad/Display.pretty |
|||
git clone https://github.com/KiCad/Divers.pretty |
|||
git clone https://github.com/KiCad/EuroBoard_Outline.pretty |
|||
git clone https://github.com/KiCad/Fiducials.pretty |
|||
git clone https://github.com/KiCad/Filters_HF_Coils_NEOSID.pretty |
|||
git clone https://github.com/KiCad/Footprint_Symbols.pretty |
|||
git clone https://github.com/KiCad/Fuse_Holders_and_Fuses.pretty |
|||
git clone https://github.com/KiCad/Heatsinks.pretty |
|||
git clone https://github.com/KiCad/Housings_ROHM.pretty |
|||
git clone https://github.com/KiCad/Housings_SIP9.pretty |
|||
git clone https://github.com/KiCad/Housings_SOT-23_SOT-143_TSOT-6.pretty |
|||
git clone https://github.com/KiCad/Housings_SOT-89.pretty |
|||
git clone https://github.com/KiCad/Housings_SOT.pretty |
|||
git clone https://github.com/KiCad/Housings_TO-50.pretty |
|||
git clone https://github.com/KiCad/Housings_TO-78.pretty |
|||
git clone https://github.com/KiCad/Housings_TO-92.pretty |
|||
git clone https://github.com/KiCad/Inductors.pretty |
|||
git clone https://github.com/KiCad/Inductors_NEOSID.pretty |
|||
git clone https://github.com/KiCad/IR-DirectFETs.pretty |
|||
git clone https://github.com/KiCad/Iut.pretty |
|||
git clone https://github.com/KiCad/Labels.pretty |
|||
git clone https://github.com/KiCad/LEDs.pretty |
|||
git clone https://github.com/KiCad/Hall-Effect_Transducers_LEM.pretty |
|||
git clone https://github.com/KiCad/Measurement_Points.pretty |
|||
git clone https://github.com/KiCad/Measurement_Scales.pretty |
|||
git clone https://github.com/KiCad/Mechanical_Sockets.pretty |
|||
git clone https://github.com/KiCad/Mounting_Holes.pretty |
|||
git clone https://github.com/KiCad/Muonde.pretty |
|||
git clone https://github.com/KiCad/NF-Transformers_ETAL.pretty |
|||
git clone https://github.com/KiCad/Oddities.pretty |
|||
git clone https://github.com/KiCad/Transistors_OldSowjetAera.pretty |
|||
git clone https://github.com/KiCad/Opto-Devices.pretty |
|||
git clone https://github.com/KiCad/Oscillator-Modules.pretty |
|||
git clone https://github.com/KiCad/Oscillators.pretty |
|||
git clone https://github.com/KiCad/Pentawatts.pretty |
|||
git clone https://github.com/KiCad/PFF_PSF_PSS_Leadforms.pretty |
|||
git clone https://github.com/KiCad/Pin_Arrays.pretty |
|||
git clone https://github.com/KiCad/Potentiometers.pretty |
|||
git clone https://github.com/KiCad/Power_Integrations.pretty |
|||
git clone https://github.com/KiCad/Printtrafo_CHK.pretty |
|||
git clone https://github.com/KiCad/Relays_ThroughHole.pretty |
|||
git clone https://github.com/KiCad/Resistors_SMD.pretty |
|||
git clone https://github.com/KiCad/Resistors_ThroughHole.pretty |
|||
git clone https://github.com/KiCad/Resistors_Universal.pretty |
|||
git clone https://github.com/KiCad/QFP.pretty |
|||
git clone https://github.com/KiCad/SMD_Packages.pretty |
|||
git clone https://github.com/KiCad/Sockets_DIP.pretty |
|||
git clone https://github.com/KiCad/Sockets_Mini-Universal.pretty |
|||
git clone https://github.com/KiCad/Sockets.pretty |
|||
git clone https://github.com/KiCad/Sockets_MOLEX_KK-System.pretty |
|||
git clone https://github.com/KiCad/Sockets_PGA.pretty |
|||
git clone https://github.com/KiCad/Sockets_WAGO734.pretty |
|||
git clone https://github.com/KiCad/SOIC_Packages.pretty |
|||
git clone https://github.com/KiCad/SSOP_Packages.pretty |
|||
git clone https://github.com/KiCad/Capacitors_Tantalum_SMD.pretty |
|||
git clone https://github.com/KiCad/Terminal_Blocks.pretty |
|||
git clone https://github.com/KiCad/Transformers_SMPS_ThroughHole.pretty |
|||
git clone https://github.com/KiCad/Transistors_SMD.pretty |
|||
git clone https://github.com/KiCad/Transistors_TO-220.pretty |
|||
git clone https://github.com/KiCad/Transistors_TO-247.pretty |
|||
git clone https://github.com/KiCad/Valves.pretty |
|||
git clone https://github.com/KiCad/Wire_Connections_Bridges.pretty |
|||
git clone https://github.com/KiCad/Wire_Pads.pretty |
|||
git clone https://github.com/KiCad/Pin_Headers.pretty |
|||
git clone https://github.com/KiCad/Socket_Strips.pretty |
|||
@ -1,273 +0,0 @@ |
|||
#!/bin/bash |
|||
# Git KiCad library repos: |
|||
# |
|||
# The "install_prerequisites" step is the only "distro dependent" one. Could modify |
|||
# that step for other linux distros. |
|||
# This script requires "git". The package bzr-git is not up to the task. |
|||
# The first time you run with option --install-or-update that is the slowest, because |
|||
# git clone from github.com is slow. |
|||
# After that updates should run faster. |
|||
|
|||
# There are two reasons why you might want to run this script: |
|||
# |
|||
# 1) You want to contribute to the KiCad library team maintained libraries and have yet to |
|||
# discover or have chosen not to use the COW feature in the Github "Plugin Type". |
|||
# |
|||
# 2) You want to run with local pretty footprint libraries and not those remotely located |
|||
# on https://github.com using Github plugin. After running this script you should be able to |
|||
# a) $ cp ~/kicad_sources/library-repos/kicad-library/template/fp-lib-table.for-pretty ~/.config/kicad/fp-lib-table |
|||
# and then |
|||
# b) set your environment variable KISYSMOD to "~/kicad_sources/library-repos". |
|||
# Edit /etc/profile.d/kicad.sh, then reboot. |
|||
# |
|||
# This will use the KiCad plugin against the *.pretty dirs in that base dir. |
|||
|
|||
|
|||
# Set where the library repos will go, use a full path |
|||
WORKING_TREES=${WORKING_TREES:-~/kicad_sources} |
|||
|
|||
|
|||
usage() |
|||
{ |
|||
echo "" |
|||
echo " usage:" |
|||
echo "" |
|||
echo "./library-sources-install.sh <cmd>" |
|||
echo " where <cmd> is one of:" |
|||
echo " --install-prerequisites (install command tools needed here, run once first.)" |
|||
echo " --install-or-update (from github, the library sources.)" |
|||
echo " --remove-all-libraries (remove all *.pretty from $WORKING_TREES/library-repos/. )" |
|||
echo " --remove-orphaned-libraries (remove local libraries which have been deleted or renamed at github.)" |
|||
echo " --list-libraries (show the full list of github libraries.)" |
|||
echo " --create-bat-file (cat a windows batch file, redirect to capture to disk.)" |
|||
echo "" |
|||
echo "examples (with --install-prerequisites once first):" |
|||
echo ' $ ./library-sources-install.sh --install-prerequisites' |
|||
echo ' $ ./library-sources-install.sh --install-or-update' |
|||
} |
|||
|
|||
|
|||
install_prerequisites() |
|||
{ |
|||
# Find a package manager, PM |
|||
PM=$( command -v yum || command -v apt-get ) |
|||
|
|||
# assume all these Debian, Mint, Ubuntu systems have same prerequisites |
|||
if [ "$(expr match "$PM" '.*\(apt-get\)')" == "apt-get" ]; then |
|||
#echo "debian compatible system" |
|||
sudo apt-get install \ |
|||
git \ |
|||
curl \ |
|||
sed |
|||
|
|||
# assume all yum systems have same prerequisites |
|||
elif [ "$(expr match "$PM" '.*\(yum\)')" == "yum" ]; then |
|||
#echo "red hat compatible system" |
|||
# Note: if you find this list not to be accurate, please submit a patch: |
|||
sudo yum install \ |
|||
git \ |
|||
curl \ |
|||
sed |
|||
else |
|||
echo |
|||
echo "Incompatible System. Neither 'yum' nor 'apt-get' found. Not possible to" |
|||
echo "continue. Please make sure to install git, curl, and sed before using this" |
|||
echo "script." |
|||
echo |
|||
exit 1 |
|||
fi |
|||
} |
|||
|
|||
|
|||
rm_build_dir() |
|||
{ |
|||
local dir="$1" |
|||
# this file is often created as root, so remove as root |
|||
sudo rm "$dir/install_manifest.txt" 2> /dev/null |
|||
rm -rf "$dir" |
|||
} |
|||
|
|||
|
|||
cmake_uninstall() |
|||
{ |
|||
# assume caller set the CWD, and is only telling us about it in $1 |
|||
local dir="$1" |
|||
|
|||
cwd=`pwd` |
|||
if [ "$cwd" != "$dir" ]; then |
|||
echo "missing dir $dir" |
|||
elif [ ! -e install_manifest.txt ]; then |
|||
echo |
|||
echo "Missing file $dir/install_manifest.txt." |
|||
else |
|||
echo "uninstalling from $dir" |
|||
sudo make uninstall |
|||
sudo rm install_manifest.txt |
|||
fi |
|||
} |
|||
|
|||
|
|||
detect_pretty_repos() |
|||
{ |
|||
# Check for the correct option to enable extended regular expressions in |
|||
# sed. This is '-r' for GNU sed and '-E' for (older) BSD-like sed, as on |
|||
# Mac OSX. |
|||
if [ $(echo | sed -r '' &>/dev/null; echo $?) -eq 0 ]; then |
|||
SED_EREGEXP="-r" |
|||
elif [ $(echo | sed -E '' &>/dev/null; echo $?) -eq 0 ]; then |
|||
SED_EREGEXP="-E" |
|||
else |
|||
echo "Your sed command does not support extended regular expressions. Cannot continue." |
|||
exit 1 |
|||
fi |
|||
|
|||
# Use github API to list repos for org KiCad, then subset the JSON reply for only |
|||
# *.pretty repos in the "full_name" variable. |
|||
PRETTY_REPOS=`curl -s "https://api.github.com/orgs/KiCad/repos?per_page=99&page=1" \ |
|||
"https://api.github.com/orgs/KiCad/repos?per_page=99&page=2" 2> /dev/null \ |
|||
| sed $SED_EREGEXP 's:.+ "full_name".*"KiCad/(.+\.pretty)",:\1:p;d'` |
|||
|
|||
#echo "PRETTY_REPOS:$PRETTY_REPOS" |
|||
|
|||
PRETTY_REPOS=`echo $PRETTY_REPOS | tr " " "\n" | sort` |
|||
|
|||
#echo "PRETTY_REPOS sorted:$PRETTY_REPOS" |
|||
} |
|||
|
|||
|
|||
checkout_or_update_libraries() |
|||
{ |
|||
if [ ! -d "$WORKING_TREES" ]; then |
|||
sudo mkdir -p "$WORKING_TREES" |
|||
echo " mark $WORKING_TREES as owned by me" |
|||
sudo chown -R `whoami` "$WORKING_TREES" |
|||
fi |
|||
cd $WORKING_TREES |
|||
|
|||
detect_pretty_repos |
|||
|
|||
if [ ! -e "$WORKING_TREES/library-repos" ]; then |
|||
mkdir -p "$WORKING_TREES/library-repos" |
|||
fi |
|||
|
|||
for repo in kicad-library $PRETTY_REPOS; do |
|||
# echo "repo:$repo" |
|||
|
|||
if [ ! -e "$WORKING_TREES/library-repos/$repo" ]; then |
|||
|
|||
# Preserve the directory extension as ".pretty". |
|||
# That way those repos can serve as pretty libraries directly if need be. |
|||
|
|||
echo "installing $WORKING_TREES/library-repos/$repo" |
|||
git clone "https://github.com/KiCad/$repo" "$WORKING_TREES/library-repos/$repo" |
|||
else |
|||
echo "updating $WORKING_TREES/library-repos/$repo" |
|||
cd "$WORKING_TREES/library-repos/$repo" |
|||
git pull |
|||
fi |
|||
done |
|||
} |
|||
|
|||
|
|||
listcontains() |
|||
{ |
|||
local list=$1 |
|||
local item=$2 |
|||
local ret=1 |
|||
local OIFS=$IFS |
|||
|
|||
# omit the space character from internal field separator. |
|||
IFS=$'\n' |
|||
|
|||
for word in $list; do |
|||
if [ "$word" == "$item" ]; then |
|||
ret=0 |
|||
break |
|||
fi |
|||
done |
|||
|
|||
IFS=$OIFS |
|||
return $ret |
|||
} |
|||
|
|||
|
|||
remove_orphaned_libraries() |
|||
{ |
|||
cd $WORKING_TREES/library-repos |
|||
|
|||
if [ $? -ne 0 ]; then |
|||
echo "Directory $WORKING_TREES/library-repos does not exist." |
|||
echo "The option --remove-orphaned-libraries should be used only after you've run" |
|||
echo "the --install-or-update at least once." |
|||
exit 2 |
|||
fi |
|||
|
|||
detect_pretty_repos |
|||
|
|||
for mylib in *.pretty; do |
|||
echo "checking local lib: $mylib" |
|||
|
|||
if ! listcontains "$PRETTY_REPOS" "$mylib"; then |
|||
echo "Removing orphaned local library $WORKING_TREES/library-repos/$mylib" |
|||
rm -rf "$mylib" |
|||
fi |
|||
done |
|||
} |
|||
|
|||
|
|||
if [ $# -eq 1 -a "$1" == "--install-or-update" ]; then |
|||
checkout_or_update_libraries |
|||
exit |
|||
fi |
|||
|
|||
|
|||
if [ $# -eq 1 -a "$1" == "--remove-orphaned-libraries" ]; then |
|||
remove_orphaned_libraries |
|||
exit |
|||
fi |
|||
|
|||
|
|||
if [ $# -eq 1 -a "$1" == "--remove-all-libraries" ]; then |
|||
rm -rf "$WORKING_TREES/library-repos" |
|||
exit |
|||
fi |
|||
|
|||
|
|||
if [ $# -eq 1 -a "$1" == "--install-prerequisites" ]; then |
|||
install_prerequisites |
|||
exit |
|||
fi |
|||
|
|||
if [ $# -eq 1 -a "$1" == "--list-libraries" ]; then |
|||
|
|||
# use github API to get repos into PRETTY_REPOS var |
|||
detect_pretty_repos |
|||
|
|||
# add the "schematic parts & 3D model" kicad-library to total |
|||
for repo in $PRETTY_REPOS; do |
|||
echo "$repo" |
|||
done |
|||
|
|||
echo |
|||
echo "and the special 'kicad-library' which holds 3D stuff and schematic parts" |
|||
|
|||
exit |
|||
fi |
|||
|
|||
# may re-direct this output to a disk file for Windows *.BAT file creation. |
|||
if [ $# -eq 1 -a "$1" == "--create-bat-file" ]; then |
|||
|
|||
# use github API to get repos into PRETTY_REPOS var |
|||
detect_pretty_repos |
|||
|
|||
echo "REM This file was created using <kicad_src>/scripts/library-repos-install.sh on linux." |
|||
echo "REM Run it from a directory you desire as the base for all libraries." |
|||
|
|||
# add the "schematic parts & 3D model" kicad-library to total |
|||
for repo in kicad-library $PRETTY_REPOS; do |
|||
echo "git clone https://github.com/KiCad/$repo" |
|||
done |
|||
exit |
|||
fi |
|||
|
|||
usage |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue