Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dbp_getsh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sebt3
dbp_getsh
Commits
2a5649c6
Commit
2a5649c6
authored
Oct 28, 2017
by
sebt3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added dependency support
parent
209a806b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
27 deletions
+46
-27
README.md
README.md
+3
-1
dbp-get.sh
dbp-get.sh
+40
-23
debian/changelog
debian/changelog
+3
-3
No files found.
README.md
View file @
2a5649c6
### Usage
```
dbp_get.sh {install|list|updat
e}
./dbp-get.sh {install|list|update|list|list_installed|list_upgrade|upgrade|remov
e}
install <pck> : Install given package
remove <pck> : Remove given package
update : Update known package lists
list : List all availables packages
list_installed: List all installed packages
list_upgrade : List all upgradables packages
upgrade : Upgrade known package
```
dbp-get.sh
View file @
2a5649c6
...
...
@@ -24,20 +24,11 @@ getRepoInfo() {
getTarget
()
{
gawk
-F
=
'$1=="target"{print $2}'
"
$DBP_HOME
/config"
}
getPackage
Path
()
{
gawk
-F
=
-v
pck
=
$
1
'BEGIN{p=0}$0=="["pck"]"{p=1}/^$/{p=0}p==1&&/Download=/{print $2;exit}'
"
$DBP_HOME
/repos/
$2
/
$3
/Packages"
getPackage
Info
()
{
gawk
-F
=
-v
pck
=
$
2
'BEGIN{p=0}$0=="["pck"]"{p=1}/^$/{p=0}p==1&&/'
"
$1
"
'=/{print $2;exit}'
"
$DBP_HOME
/repos/
$3
/
$4
/Packages"
}
getPackageMD5
()
{
gawk
-F
=
-v
pck
=
$1
'BEGIN{p=0}$0=="["pck"]"{p=1}/^$/{p=0}p==1&&/MD5sum=/{print $2;exit}'
"
$DBP_HOME
/repos/
$2
/
$3
/Packages"
}
getPackageName
()
{
gawk
-F
=
-v
pck
=
$1
'BEGIN{p=0}$0=="["pck"]"{p=1}/^$/{p=0}p==1&&/Name=/{print $2;exit}'
"
$DBP_HOME
/repos/
$2
/
$3
/Packages"
}
getPackageNames
()
{
gawk
-F
=
'BEGIN{p=""}/^\[/{p=$1;gsub("^.","",p);gsub(".$","",p)}/^Name=/{print p"\t"$2}'
"
$DBP_HOME
/repos/
$1
/
$2
/Packages"
}
getPackageMD5s
()
{
gawk
-F
=
'BEGIN{p=""}/^\[/{p=$1;gsub("^.","",p);gsub(".$","",p)}/^MD5sum=/{print p"\t"$2}'
"
$DBP_HOME
/repos/
$1
/
$2
/Packages"
getPackagesInfo
()
{
gawk
-F
=
'BEGIN{p=""}/^\[/{p=$1;gsub("^.","",p);gsub(".$","",p)}/^'
"
$1
"
'=/{print p"\t"$2}'
"
$DBP_HOME
/repos/
$2
/
$3
/Packages"
}
getFileMD5
()
{
md5sum
<
"
$1
"
|awk
'{print $1}'
...
...
@@ -75,7 +66,7 @@ list() {
precheck
getRepoInfo|while
read id
url comps
;
do
for
c
in
$comps
;
do
getPackage
Names
"
$id
"
"
$c
"
|while
read id
desc
;
do
getPackage
sInfo
"Name"
"
$id
"
"
$c
"
|while
read id
desc
;
do
printf
"%s
\0
33[30G%s
\n
"
"
$id
"
"
$desc
"
done
done
...
...
@@ -87,9 +78,15 @@ install() {
precheck
getRepoInfo|
{
while
read id
url comps
;
do
for
c
in
$comps
;
do
path
=
$(
getPackage
Path
"
$pck
"
"
$id
"
"
$c
"
)
path
=
$(
getPackage
Info
"Download"
"
$pck
"
"
$id
"
"
$c
"
)
if
[[
"
$path
"
!=
""
]]
;
then
md
=
$(
getPackageMD5
"
$1
"
"
$id
"
"
$c
"
)
deps
=
$(
getPackageInfo
"Dependency
\[
dbp
\]
"
"
$1
"
"
$id
"
"
$c
"
)
if
[[
"
$deps
"
!=
""
]]
;
then
echo
$deps
|sed
's/;/\n/'
|while
read
l
;
do
install
"
$l
"
done
fi
md
=
$(
getPackageInfo
"MD5sum"
"
$1
"
"
$id
"
"
$c
"
)
fname
=
"
${
pck
}
.dbp"
echo
-n
"Downloading
$fname
..."
wget
-o
/dev/null
-O
"
$(
getTarget
)
${
fname
}
_new"
"
$(
echo
$url
|awk
-F
/
'{print $1"//"$3}'
)
$path
"
...
...
@@ -110,27 +107,45 @@ install() {
}
}
install_all
()
{
while
[
$#
-gt
0
]
;
do
install
$1
shift
done
}
list_installed
()
{
precheck
getRepoInfo|while
read id
url comps
;
do
for
c
in
$comps
;
do
getPackage
MD5s
"
$id
"
"
$c
"
|while
read
pck md
;
do
getPackage
sInfo
"MD5sum"
"
$id
"
"
$c
"
|while
read
pck md
;
do
if
[
-e
"
$(
getTarget
)
/
${
pck
}
.dbp"
]
;
then
printf
"%s
\0
33[30G%s
\n
"
"
$pck
"
"
$(
getPackage
Name
"
$pck
"
"
$id
"
"
$c
"
)
"
printf
"%s
\0
33[30G%s
\n
"
"
$pck
"
"
$(
getPackage
Info
"Name"
"
$pck
"
"
$id
"
"
$c
"
)
"
fi
done
done
done
}
remove
()
{
while
[
$#
-gt
0
]
;
do
pck
=
$1
if
[
-e
"
$(
getTarget
)
/
${
pck
}
.dbp"
]
;
then
echo
"Uninstalling
$pck
"
rm
-f
"
$(
getTarget
)
/
${
pck
}
.dbp"
fi
shift
done
}
list_upgrade
()
{
precheck
getRepoInfo|while
read id
url comps
;
do
for
c
in
$comps
;
do
getPackage
MD5s
"
$id
"
"
$c
"
|while
read
pck md
;
do
getPackage
sInfo
"MD5sum"
"
$id
"
"
$c
"
|while
read
pck md
;
do
if
[
-e
"
$(
getTarget
)
/
${
pck
}
.dbp"
]
;
then
if
[[
$(
getFileMD5
"
$(
getTarget
)
/
${
pck
}
.dbp"
)
!=
"
$md
"
]]
;
then
printf
"%s
\0
33[30G%s
\n
"
"
$pck
"
"
$(
getPackage
Name
"
$pck
"
"
$id
"
"
$c
"
)
"
printf
"%s
\0
33[30G%s
\n
"
"
$pck
"
"
$(
getPackage
Info
"Name"
"
$pck
"
"
$id
"
"
$c
"
)
"
fi
fi
done
...
...
@@ -142,7 +157,7 @@ upgrade() {
precheck
getRepoInfo|while
read id
url comps
;
do
for
c
in
$comps
;
do
getPackage
MD5s
"
$id
"
"
$c
"
|while
read
pck md
;
do
getPackage
sInfo
"MD5sum"
"
$id
"
"
$c
"
|while
read
pck md
;
do
if
[
-e
"
$(
getTarget
)
/
${
pck
}
.dbp"
]
;
then
if
[[
$(
getFileMD5
"
$(
getTarget
)
/
${
pck
}
.dbp"
)
!=
"
$md
"
]]
;
then
install
"
$pck
"
...
...
@@ -155,8 +170,9 @@ upgrade() {
showHelp
()
{
cat
<<
ENDHELP
$1
{install|list|update}
$1
{install|list|update
|list|list_installed|list_upgrade|upgrade|remove
}
install <pck> : Install given package
remove <pck> : Remove given package
update : Update known package lists
list : List all availables packages
list_installed: List all installed packages
...
...
@@ -172,7 +188,8 @@ main() {
list_upgrade
)
list_upgrade
;;
list_installed
)
list_installed
;;
upgrade
)
upgrade
;;
install
)
install
"
$2
"
;;
install
)
shift
;
install_all
"
$@
"
;;
remove
)
shift
;
remove
"
$@
"
;;
help
|
*
)
showHelp
"
$0
"
;;
esac
}
...
...
debian/changelog
View file @
2a5649c6
dbp-getsh (0.1.
0
) unstable; urgency=medium
dbp-getsh (0.1.
1
) unstable; urgency=medium
*
Initial Release.
*
Added dependency support
-- Sébastien Huss <sebastien.huss@gmail.com>
Tue, 19 Sep 2017 20:52:06
+0200
-- Sébastien Huss <sebastien.huss@gmail.com>
Sat, 28 Oct 2017 22:05:25
+0200
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