Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
chromebrew
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
chromebrew
Commits
d97aa9a7
Commit
d97aa9a7
authored
Apr 13, 2020
by
Casey Strouse
Committed by
GitHub
Apr 13, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4009 from uberhacker/update-check_updates.sh
Update check_updates.sh
parents
d8bcef69
0ac7b05d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
16 deletions
+63
-16
tools/check_updates.sh
tools/check_updates.sh
+63
-16
No files found.
tools/check_updates.sh
View file @
d97aa9a7
#!/bin/bash
#!/bin/bash
if
!
test
$(
command
-v
elinks 2> /dev/null
)
;
then
crew
install
elinks
fi
if
[
!
-f
packages.yaml
]
;
then
if
[
!
-f
packages.yaml
]
;
then
echo
"packages.yaml not found."
echo
"packages.yaml not found."
exit
1
exit
1
fi
fi
if
test
$1
;
then
if
test
$1
;
then
grep
-2
"^activity:
$1
"
packages.yaml
>
/tmp/activity.txt
valid
=
grep
^name: /tmp/activity.txt |
cut
-d
' '
-f2
>
/tmp/names.txt
opt
=
"core high medium low none"
grep
^url: /tmp/activity.txt |
cut
-d
' '
-f2
>
/tmp/urls.txt
for
o
in
$opt
;
do
rm
-f
/tmp/activity.txt
[
$1
==
$o
]
&&
valid
=
1
done
if
!
test
$valid
;
then
echo
"Usage:
$0
[activity] [offset] [lines]"
echo
"activity: core|high|medium|low|none"
echo
"offset: # from the beginning line"
echo
"lines: # of lines to check"
exit
1
fi
if
[[
"
$1
"
==
"core"
]]
;
then
rm
-f
/tmp/urls.txt
cat
core_packages.txt
>
/tmp/names.txt
for
p
in
$(
cat
/tmp/names.txt
)
;
do
grep
-1
"^name:
$p
"
packages.yaml |
tail
-1
|
cut
-d
' '
-f2
>>
/tmp/urls.txt
done
else
grep
-2
"^activity:
$1
"
packages.yaml
>
/tmp/activity.txt
grep
^name: /tmp/activity.txt |
cut
-d
' '
-f2
>
/tmp/names.txt
grep
^url: /tmp/activity.txt |
cut
-d
' '
-f2
>
/tmp/urls.txt
rm
-f
/tmp/activity.txt
fi
else
else
grep
^name: packages.yaml |
cut
-d
' '
-f2
>
/tmp/names.txt
grep
^name: packages.yaml |
cut
-d
' '
-f2
>
/tmp/names.txt
grep
^url: packages.yaml |
cut
-d
' '
-f2
>
/tmp/urls.txt
grep
^url: packages.yaml |
cut
-d
' '
-f2
>
/tmp/urls.txt
...
@@ -30,20 +47,50 @@ if test $2; then
...
@@ -30,20 +47,50 @@ if test $2; then
mv
/tmp/new_names.txt /tmp/names.txt
mv
/tmp/new_names.txt /tmp/names.txt
mv
/tmp/new_urls.txt /tmp/urls.txt
mv
/tmp/new_urls.txt /tmp/urls.txt
fi
fi
#for u in $(cat /tmp/urls.txt); do elinks $u; done
c
=
0
#rm -f /tmp/urls.txt
for
p
in
$(
cat
/tmp/names.txt
)
;
do
c
=
1
u
=
$(
grep
-1
"^name:
${
p
}
$"
packages.yaml |
tail
-1
|
cut
-d
' '
-f2
)
for
u
in
$(
cat
/tmp/urls.txt
)
;
do
version
=
$(
grep
"^ version"
../packages/
$p
.rb |
cut
-d
"'"
-f2
)
if
[[
$u
==
*
"github.com"
*
&&
$u
==
*
"/releases"
*
]]
;
then
repo
=
name
=
$(
head
-
$c
/tmp/names.txt |
tail
-1
)
[[
$u
==
*
"gnu.org"
*
]]
&&
repo
=
"gnu"
version
=
$(
grep
"^ version"
../packages/
$name
.rb |
cut
-d
"'"
-f2
)
[[
$u
==
*
"github.com"
*
&&
$u
==
*
"/releases"
*
]]
&&
repo
=
"github"
[[
$u
==
*
"savannah.gnu.org"
*
&&
$u
==
*
"/releases"
*
]]
&&
repo
=
"savannah"
case
$repo
in
gnu
)
content
=
$(
curl
-Ls
$u
)
content
=
$(
echo
$content
|
sed
's,[ds|latest].tar,,g'
)
d
=
${
content
##*\.tar\.[g|l|x]z\
">}
rel=
$(
echo
$d
|
cut
-d
'<'
-f1
|
cut
-d
'-'
-f2
)
ver=
${
rel
%.tar*
}
nu="
$u
/
$p
-
$rel
"
[[
$version
!=
$ver
]] && echo "
- [ ]
$p
|
$nu
|
$version
|
$ver
"
;;
github)
content=
$(
curl
-Ls
$u
)
content=
$(
curl
-Ls
$u
)
d=
${
content
#*/archive/
}
d=
${
content
#*/archive/
}
rel=
$(
echo
$d
|
cut
-d
'"'
-f1
)
rel=
$(
echo
$d
|
cut
-d
'"'
-f1
)
ver=
${
rel
%.zip*
}
ver=
${
rel
%.zip*
}
nu=
$(
echo
"
${
u
/releases/archive
}
"
)
nu=
$(
echo
"
${
u
/releases/archive
}
"
)
echo
"
$name
|
$nu
/
$ver
.tar.gz |
$version
|
$ver
"
[[
$version
!=
$ver
]] && echo "
- [ ]
$p
|
$nu
/
$ver
.tar.gz |
$version
|
$ver
"
fi
;;
savannah)
content=
$(
curl
-Ls
$u
)
d=
${
content
##*\.tar\.[g|l|x]z\
">}
rel=
$(
echo
$d
|
cut
-d
'<'
-f1
|
cut
-d
'-'
-f2
)
ver=
${
rel
%.tar*
}
nu="
$u
/
$p
-
$rel
"
[[
$version
!=
$ver
]] && echo "
- [ ]
$p
|
$nu
|
$version
|
$ver
"
;;
*)
echo "
- [ ]
$p
|
$u
|
$version
| not checked
"
esac
c=
$((
c+1
))
c=
$((
c+1
))
done
done
echo "
Total
packages
:
$c
"
#most /tmp/urls.txt
#most /tmp/urls.txt
#if ! test
$(
command
-v
elinks 2> /dev/null
)
; then
# crew install elinks
#fi
#for u in
$(
cat
/tmp/urls.txt
)
; do elinks
$u
; done
#rm -f /tmp/names.txt
#rm -f /tmp/urls.txt
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