forked from stupidloud/nanopi-openwrt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dist.sh
executable file
·87 lines (73 loc) · 2.82 KB
/
dist.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
#!/bin/bash
# This script makes one dir in home dir: `release`
# It's highly recommanded to use this script only with docker
distadt=$(date +"%Y-%m-%d %H:%M:%S")
echo start dist job at $distadt
cd ~
if [ -d ib ]; then
rm -rf ib
fi
tar -Jxvf ib-$DEVICE.tar.xz && mv *imagebuilder* ib
cd ib
. $GITHUB_WORKSPACE/scripts/merge_files.sh
# # include local packages to feed
# if [ ! -d files/local_feed ]; then
# mkdir -p files/local_feed
# fi
# mount --bind packages files/local_feed
sed -i '/local/d;s/#//' files/etc/opkg/distfeeds.conf
sed -i '/luci-lib-base/d;/luci-lib-ipkg/d' include/target.mk
sed -i 's/luci-app-[^ ]*//g' include/target.mk $(find target/ -name Makefile)
sed -i 's/$(OPKG) install $(BUILD_PACKAGES)/$(OPKG) install --force-overwrite $(BUILD_PACKAGES)/' Makefile
ls packages/*.ipk | xargs -n1 basename > ipks.txt
cat $GITHUB_WORKSPACE/configs/$DEVICE.seed $GITHUB_WORKSPACE/configs/common.seed | \
grep -v '^#' | \
grep -v CONFIG_PACKAGE_luci-app | \
grep CONFIG_PACKAGE | \
sed 's/CONFIG_PACKAGE_//;s/=y//' | \
xargs -n1 -i grep -o {} ipks.txt | \
sort -u | \
xargs echo > packages.txt
cat $GITHUB_WORKSPACE/configs/$DEVICE.seed $GITHUB_WORKSPACE/configs/common.seed | \
grep -v '^#' | \
grep CONFIG_PACKAGE_luci-app | \
sed 's/CONFIG_PACKAGE_//;s/=y//' | \
xargs -n1 -i grep -o {} ipks.txt | \
sort -u > luci-apps.txt
cat luci-apps.txt | \
sed 's/-app-/-i18n-/g' | \
xargs -n1 -i grep -o {}-zh-cn ipks.txt | \
xargs echo | \
sed 's/ /\n/g' > luci-lps.txt
cat luci-apps.txt | xargs echo > luci.txt
cat luci-apps.txt | grep -v docker | xargs echo > luci-no-docker.txt
cat luci-lps.txt | xargs echo > lp.txt
cat luci-lps.txt | grep -v docker | xargs echo > lp-no-docker.txt
PACKAGES=$(cat packages.txt)
LUCI=$(cat luci.txt)
LP=$(cat lp.txt)
make image PACKAGES="$PACKAGES $LUCI $LP" FILES="files"
if [ ! -d '~/release' ]; then
mkdir -p ~/release
fi
mv $(ls -1 ./bin/targets/*/*/*img.gz | head -1) ~/release/$DEVICE-with-docker-$BRANCH.img.gz
cd ~/release/ && md5sum $DEVICE-with-docker-$BRANCH.img.gz > $DEVICE.md5
gzip -dc $DEVICE-with-docker-$BRANCH.img.gz | md5sum | sed "s/-/$DEVICE-with-docker.img/" >> $DEVICE.md5
# start building img without docker
cd ~/ib
rm -rf bin/
LUCI=$(cat luci-no-docker.txt)
LP=$(cat lp-no-docker.txt)
echo "========NO docker========="
echo "=========PACKAGES========="
echo $PACKAGES
echo "===========LUCI==========="
echo $LUCI
echo "============LP============"
echo $LP
echo "======================="
make image PACKAGES="$PACKAGES $LUCI $LP" FILES="files"
mv $(ls -1 ./bin/targets/*/*/*img.gz | head -1) ~/release/$DEVICE-$BRANCH.img.gz
cd ~/release/ && md5sum $DEVICE-$BRANCH.img.gz >> $DEVICE.md5
gzip -dc $DEVICE-$BRANCH.img.gz | md5sum | sed "s/-/$DEVICE.img/" >> $DEVICE.md5
echo Done dist at $(date +"%Y-%m-%d %H:%M:%S"), started at $distadt