Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
784e43f2
Commit
784e43f2
authored
Jan 28, 2014
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option --remove-orphaned-libraries to scripts/library-repos-install.sh
parent
c63fa6ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
4 deletions
+56
-4
library-repos-install.sh
scripts/library-repos-install.sh
+56
-4
No files found.
scripts/library-repos-install.sh
View file @
784e43f2
...
@@ -34,10 +34,10 @@ usage()
...
@@ -34,10 +34,10 @@ usage()
echo
""
echo
""
echo
"./library-sources-install.sh <cmd>"
echo
"./library-sources-install.sh <cmd>"
echo
" where <cmd> is one of:"
echo
" where <cmd> is one of:"
echo
" --install-or-update (
of
the library sources.)"
echo
" --install-or-update (
from github,
the library sources.)"
echo
" --remove-all-
sources (remove all source trees.
)"
echo
" --remove-all-
libraries (remove all *.pretty from
$WORKING_TREES
/library-repos/.
)"
echo
" --install-prerequisites (install command tools needed here, run once first.)"
echo
" --install-prerequisites (install command tools needed here, run once first.)"
# echo " --uninstall-libraries (remove KiCad supplied libraries which have been installed
.)"
echo
" --remove-orphaned-libraries (remove local libraries which have been deleted or renamed at github
.)"
echo
""
echo
""
echo
"example:"
echo
"example:"
echo
' $ ./library-sources-install.sh --install-or-update'
echo
' $ ./library-sources-install.sh --install-or-update'
...
@@ -148,13 +148,65 @@ checkout_or_update_libraries()
...
@@ -148,13 +148,65 @@ checkout_or_update_libraries()
}
}
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
if
[
$#
-eq
1
-a
"
$1
"
==
"--install-or-update"
]
;
then
checkout_or_update_libraries
checkout_or_update_libraries
exit
exit
fi
fi
if
[
$#
-eq
1
-a
"
$1
"
==
"--remove-all-sources"
]
;
then
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"
rm
-rf
"
$WORKING_TREES
/library-repos"
exit
exit
fi
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment