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
nexedi
chromebrew
Commits
8f3a7519
Commit
8f3a7519
authored
Apr 14, 2021
by
Ed Reel
Committed by
GitHub
Apr 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add binary repo tools (#5623)
parent
a375846c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
287 additions
and
0 deletions
+287
-0
tools/balto_upload.sh
tools/balto_upload.sh
+55
-0
tools/download_binary.sh
tools/download_binary.sh
+103
-0
tools/sf.sh
tools/sf.sh
+129
-0
No files found.
tools/balto_upload.sh
0 → 100755
View file @
8f3a7519
#!/bin/bash
# Overview:
#
# A script to upload binaries to baltorepo.com.
#
# Usage:
#
# bash ./balto_upload.sh <package>
#
# A token is needed to upload. Set as follows:
# export BALTO_TOKEN=<your token here>
#
# Directory structure:
#
# release/armv7l/*.tar.xz binary tarball for armv7l
# release/i686/*.tar.xz binary tarball for i686
# release/x86_64/*.tar.xz binary tarball for x86_64
#
# Author: Ed Reel (uberhacker) edreel at gmail dot com
# Contact me if you would like access to the repository.
#
# Updated: 2021-04-14
#
# License: GPL-3+
[
-z
"
$1
"
]
&&
echo
"Usage:
$(
basename
$0
)
<package>"
&&
exit
1
[
!
-f
../packages/
$1
.rb
]
&&
echo
"Package
$1
.rb not found."
&&
exit
1
for
ARCH
in
armv7l i686 x86_64
;
do
NAME
=
$1
[[
"
${
NAME
}
"
=
~
"_"
]]
&&
NAME
=
$(
echo
${
NAME
}
|sed
-e
's/_//g'
)
PACKAGE
=
../packages/
$1
.rb
FILE
=
"../release/
${
ARCH
}
/
${
1
}
-*
${
ARCH
}
.tar.xz"
DOWNLOAD
=
$(
ls
${
FILE
}
2> /dev/null |
sed
's,../release/${ARCH}/,,'
)
if
[
-n
"
${
DOWNLOAD
}
"
]
;
then
NONAME
=
${
DOWNLOAD
#*-
}
VERSION
=
${
NONAME
%-chromeos*
}
RAWDESC
=
$(
grep
"^ description"
${
PACKAGE
}
)
DESCRIPTION
=
$(
echo
${
RAWDESC
}
|sed
-e
's/^description //'
|sed
-e
's/"//g'
|sed
-e
"s/'//g"
|cut
-c
-200
)
#echo "NAME=$NAME"
#echo "VARIANT=$ARCH"
#echo "VERSION=$VERSION"
#echo "DOWNLOAD=$DOWNLOAD"
#echo "DESCRIPTION=$DESCRIPTION"
#exit
curl
\
--header
"Authorization: Bearer
${
BALTO_TOKEN
}
"
\
--form
"download=@
${
DOWNLOAD
}
"
\
--form
"name=
${
NAME
}
"
\
--form
"variant=
${
ARCH
}
"
\
--form
"version=
${
VERSION
}
"
\
--form
"description=
${
DESCRIPTION
}
"
\
https://chromebrew.baltorepo.com/chromebrew/chromebrew/upload/
fi
done
tools/download_binary.sh
0 → 100755
View file @
8f3a7519
#!/bin/bash
# Overview:
#
# A generic script to download binaries from various repositories.
#
# Usage:
#
# bash ./download_binary.sh [package|all] [repo]
#
# If no options are provided, core package binaries will be downloaded.
# If no repo is provided, the default is sourceforge.
#
# Author: Ed Reel (uberhacker) edreel at gmail dot com
#
# Updated: 2021-04-14
#
# License: GPL-3+
if
test
$1
;
then
if
[[
"
$1
"
==
"all"
]]
;
then
echo
"Downloading all packages..."
PACKAGES
=
"
$(
ls
-1
../packages/
*
.rb | xargs |
sed
's,../packages/,,g'
|
sed
's,\.rb , ,g'
|
sed
's,\.rb$,,'
)
"
else
[
!
-f
../packages/
$1
.rb
]
&&
echo
"Package
$1
.rb not found."
&&
exit
1
echo
"Downloading
$1
package binaries..."
PACKAGES
=
$1
fi
else
echo
"Downloading core package binaries..."
PACKAGES
=
$(
cat
../tools/core_packages.txt | xargs
)
fi
BINTRAY_REPO
=
"https://dl.bintray.com/chromebrew/chromebrew/"
SOURCEFORGE_REPO
=
"https://downloads.sourceforge.net/project/chromebrew/"
BALTO_REPO
=
"https://baltocdn.com/chromebrew/chromebrew/chromebrew/downloads/"
REPO
=
"sourceforge"
if
test
$2
;
then
valid
=
valid_repos
=
"balto bintray sourceforge"
for
r
in
$valid_repos
;
do
[[
"
$2
"
==
"
$r
"
]]
&&
valid
=
1
done
if
[
!
$valid
]
;
then
echo
"
$2
is an invalid repo."
exit
1
else
REPO
=
$2
fi
fi
for
package
in
${
PACKAGES
}
;
do
for
arch
in
armv7l i686 x86_64
;
do
pkgfile
=
../packages/
${
package
}
.rb
url
=
"
$(
grep
-m
3
${
arch
}
:
${
pkgfile
}
|
head
-n
1 |
cut
-d
\'
-f2
|
tr
-d
\'
|
tr
-d
\"
|
sed
's/,//g'
)
"
sha256
=
"
$(
grep
-m
3
${
arch
}
:
${
pkgfile
}
|
tail
-n
1 |
cut
-d
\'
-f2
|
tr
-d
\'
|
tr
-d
\"
|
sed
's/,//g'
)
"
case
${
REPO
}
in
balto
)
new_package
=
$(
echo
${
package
}
|
sed
's,\_,,'
)
new_base
=
"
${
BALTO_REPO
}${
package
:0:1
}
/
${
new_package
}
/"
;;
bintray
)
new_base
=
"
${
BINTRAY_REPO
}
"
;;
sourceforge
)
new_base
=
"
${
SOURCEFORGE_REPO
}${
arch
}
/"
;;
esac
tarfile
=
"
$(
basename
${
url
}
)
"
noname
=
"
${
tarfile
#*-
}
"
version
=
"
${
noname
%-chromeos*
}
"
new_url
=
"
${
new_base
}${
tarfile
}
"
#echo $url
#echo $new_url
#exit
#sed -i "s,${url},${new_url},g" ${pkgfile}
#if [ "${package}" == "glibc" ]; then
# case ${arch} in
# armv7l)
# url="${new_base}glibc-2.27-chromeos-armv7l.tar.xz"
# sha256="64b4b73e2096998fd1a0a0e7d18472ef977aebb2f1cad83d99c77e164cb6a1d6"
# ;;
# x86_64)
# url="${new_base}glibc-2.27-chromeos-x86_64.tar.xz"
# sha256="5fe94642dbbf900d22b715021c73ac1a601b81517f0da1e7413f0af8fbea7997"
# ;;
# esac
#fi
echo
"Package:
${
package
}
, Arch:
${
arch
}
, Version:
${
version
}
"
echo
"Downloading
${
url
}
..."
curl -#Lsf
${
url
}
-o
${
tarfile
}
echo
-e
"Verifying
${
tarfile
}
..."
echo
-e
"
$(
echo
"
${
sha256
}
"
"
${
tarfile
}
"
|
sha256sum
-c
-
)
"
case
"
${
?
}
"
in
0
)
echo
-e
"Verification passed."
;;
*
)
echo
-e
"Verification failed."
exit
1
;;
esac
done
done
tools/sf.sh
0 → 100755
View file @
8f3a7519
#!/bin/bash
# Overview:
#
# A script to upload binaries to sourceforge.net and add or update package file binaries.
#
# Usage:
#
# bash ./sf.sh [package1 package2 ...]
#
# If no packages are provided, all packages with binaries in release/* will be processed.
#
# Directory structure:
#
# release/armv7l/*.tar.xz(.sha256) binary tarball and sha256 files for armv7l
# release/i686/*.tar.xz(.sha256) binary tarball and sha256 files for i686
# release/x86_64/*.tar.xz(.sha256) binary tarball and sha256 files for x86_64
#
# Author: Ed Reel (uberhacker) edreel at gmail dot com
# Contact me if you would like access to the repository.
#
# Updated: 2021-04-14
#
# License: GPL-3+
packages
=
if
test
$1
;
then
for
package
in
$@
;
do
pkgfile
=
"../packages/
${
package
}
.rb"
if
[
-f
${
pkgfile
}
]
;
then
packages+
=
"
${
package
}
"
else
echo
"Package
${
pkgfile
}
not found."
fi
done
else
packages
=
$(
find ../release
-type
f
-exec
basename
-s
.tar.xz.sha256
{}
+ |
cut
-d
'-'
-f1
|
sort
|
uniq
| xargs
)
fi
[
-z
"
${
packages
}
"
]
&&
echo
"No packages found."
&&
exit
1
function
update_url
()
{
if
sed
-e
'/binary_url.*({/,/})/p; d'
../packages/
$1
.rb |
grep
-q
$2
:
;
then
sed
-e
"/
$2
:.*
\(
http
\|
https
\|
ftp
\)
:/c
\ \ \ \
$(
printf
%7s
$2
)
: '
$3
',"
-i
../packages/
$1
.rb
else
sed
-e
"/binary_url.*({/a
\ \ \ \
$(
printf
%7s
$2
)
: '
$3
',"
-i
../packages/
$1
.rb
fi
}
function
update_sha256
()
{
if
sed
-e
'/binary_sha256.*({/,/})/p; d'
../packages/
$1
.rb |
grep
-q
$2
:
;
then
sed
-e
"/
$2
:.*['
\"
][0-9a-f]*['
\"
]/c
\ \ \ \
$(
printf
%7s
$2
)
: '
$3
',"
-i
../packages/
$1
.rb
else
sed
-e
"/binary_sha256.*({/a
\ \ \ \
$(
printf
%7s
$2
)
: '
$3
',"
-i
../packages/
$1
.rb
fi
}
for
package
in
${
packages
}
;
do
for
arch
in
x86_64 i686 armv7l
;
do
echo
"Package:
${
package
}
, Arch:
${
arch
}
"
pkgfile
=
../packages/
${
package
}
.rb
old_url
=
"
$(
grep
-m
3
${
arch
}
:
${
pkgfile
}
2> /dev/null |
head
-n
1 |
cut
-d
\'
-f2
|
tr
-d
\'
|
tr
-d
\"
|
sed
's/,//g'
)
"
if
[
-n
"
${
old_url
}
"
]
;
then
old_sha256
=
"
$(
grep
-m
3
${
arch
}
:
${
pkgfile
}
2> /dev/null |
tail
-n
1 |
cut
-d
\'
-f2
|
tr
-d
\'
|
tr
-d
\"
|
sed
's/,//g'
)
"
tarfile
=
"
$(
basename
${
old_url
}
)
"
noname
=
"
${
tarfile
#*-
}
"
old_version
=
"
${
noname
%-chromeos*
}
"
fi
new_tarfile
=
"
$(
ls
../release/
${
arch
}
/
${
package
}
-
*
-chromeos-
${
arch
}
.tar.xz 2> /dev/null |
head
-1
)
"
if
[
-z
"
${
new_tarfile
}
"
]
;
then
echo
"../release/
${
arch
}
/
${
package
}
-#-chromeos-
${
arch
}
.tar.xz not found."
echo
continue
fi
new_sha256file
=
"
$(
ls
../release/
${
arch
}
/
${
package
}
-
*
-chromeos-
${
arch
}
.tar.xz.sha256 2> /dev/null |
head
-1
)
"
if
[
-z
"
${
new_sha256file
}
"
]
;
then
echo
"
${
new_tarfile
}
.sha256 not found."
echo
continue
else
new_sha256
=
$(
cut
-d
' '
-f1
${
new_sha256file
}
)
fi
noname
=
"
${
new_tarfile
#*-
}
"
new_version
=
"
${
noname
%-chromeos*
}
"
new_url
=
$(
echo
"https://downloads.sourceforge.net/project/chromebrew/
${
new_tarfile
}
"
|
sed
's,../release/,,'
)
echo
"Uploading
${
new_tarfile
}
..."
scp
${
new_tarfile
}
chromebrew@frs.sourceforge.net:/home/frs/project/chromebrew/
${
arch
}
/
if
[
-n
"
${
old_url
}
"
]
;
then
if
[[
${
old_url
}
!=
${
new_url
}
]]
;
then
echo
"Updating binary_url in
${
pkgfile
}
..."
echo
"from:
${
arch
}
: '
${
old_url
}
'"
echo
" to:
${
arch
}
: '
${
new_url
}
'"
sed
-i
"s,
${
old_url
}
,
${
new_url
}
,g"
${
pkgfile
}
echo
"Updating binary_sha256 in
${
pkgfile
}
.."
echo
"from:
${
arch
}
: '
${
old_sha256
}
'"
echo
" to:
${
arch
}
: '
${
new_sha256
}
'"
sed
-i
"s,
${
old_sha256
}
,
${
new_sha256
}
,g"
${
pkgfile
}
else
echo
"Skipping update in
${
pkgfile
}
..."
fi
else
if
!
grep
-q
binary_url ../packages/
${
package
}
.rb
;
then
sed
-e
'/source_sha256/ a\
\
\ \ binary_url ({\
\ \ })\
\ \ binary_sha256 ({\
\ \ })'
-i
../packages/
${
package
}
.rb
fi
echo
"Adding binary_url to
${
pkgfile
}
..."
echo
"
${
arch
}
: '
${
new_url
}
'"
echo
"Adding binary_sha256 to
${
pkgfile
}
..."
echo
"
${
arch
}
: '
${
new_sha256
}
'"
case
x
${
new_url
}
in
x
)
;;
*
)
update_url
${
package
}
${
arch
}
${
new_url
}
update_sha256
${
package
}
${
arch
}
${
new_sha256
}
case
${
arch
}
in
armv7l
)
update_url
${
package
}
aarch64
${
new_url
}
update_sha256
${
package
}
aarch64
${
new_sha256
}
;;
esac
;;
esac
fi
echo
done
done
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