-
Notifications
You must be signed in to change notification settings - Fork 75
/
ci-populate-artifacts.sh
executable file
·100 lines (83 loc) · 1.77 KB
/
ci-populate-artifacts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
out=artifacts
pkgs=$out/packages
images=$out/images
sdk=$out/sdk
distro=$1
rm -rf $out
mkdir $out
function debs
{
for a in $(find deploy -name reprepro); do
deb=$(basename $(dirname $a))
dst=$pkgs/$deb
echo "$a -> $dst"
mkdir -p $pkgs
cp -r $a $dst
done
}
function ipkgs
{
if [ -d deploy/venus/ipk ]; then
dst=$pkgs/$distro/
echo "deploy/venus/ipk -> $dst"
mkdir -p $pkgs
cp -r deploy/venus/ipk $dst
# remove unused packages
find $dst -name "*-dbg_*.ipk" -exec rm {} \;
find $dst -type d -name i686-nativesdk -prune -exec rm -rf {} \;
find $dst -type d -name x86_64-nativesdk -prune -exec rm -rf {} \;
fi
}
function image
{
if [ ! -d deploy/venus/images ]; then return; fi
prefix=$1
ext=$2
for a in $(find deploy/venus/images -name "$prefix-*.$ext" -type l); do
machine=$(basename $(dirname $a))
dst=$images/$machine
if [ ! -d $dst ]; then mkdir -p $dst; fi
img=$(realpath $a)
echo "$img -> $dst"
cp $img $dst
echo "$a -> $dst/$(basename $a)"
cp -a $a $dst/$(basename $a)
done
}
function suffix_symlinks
{
ext="$1"
suffix="$2"
for symlink in $(find "$out" -type l -name "*.$ext"); do
tg=$(readlink $symlink)
# update where the symlink points to..
ln -sfT "$tg.$suffix" $symlink
# rename the symlink itself
mv $symlink $symlink.$suffix
done
}
function wic_images
{
# gzip the wic files
image venus-image wic
suffix_symlinks "wic" "gz"
find "$out" -type f -name "*.wic" -exec pigz {} \;
}
function sdk
{
if [ ! -d deploy/venus/sdk ]; then return; fi
src=deploy/venus/sdk
dst=$sdk
echo "$src -> $sdk"
mkdir -p $sdk
cp -r $src/* $sdk
}
debs
ipkgs
image venus-install-sdcard img.zip
image venus-swu swu
wic_images
image venus-upgrade-image zip
sdk
tar --use-compress-program=pigz -cf artifacts-$distro.tgz artifacts