build: Generate addon.d script at build time

Signed-off-by: Paul Keith <javelinanddart@bestas.gr>
This commit is contained in:
Paul Keith 2017-04-06 21:42:46 -05:00
parent 8ac16034dc
commit 28eb9cdff2
No known key found for this signature in database
GPG Key ID: AB0BF746E05523CF
3 changed files with 59 additions and 0 deletions

9
addond_head Normal file
View File

@ -0,0 +1,9 @@
#!/sbin/sh
#
# /system/addon.d/30-gapps.sh
#
. /tmp/backuptool.functions
list_files() {
cat <<EOF
addon.d/30-gapps.sh

29
addond_tail Normal file
View File

@ -0,0 +1,29 @@
EOF
}
case "$1" in
backup)
list_files | while read FILE DUMMY; do
backup_file $S/$FILE
done
;;
restore)
list_files | while read FILE REPLACEMENT; do
R=""
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
[ -f "$C/$S/$FILE" ] && restore_file $S/$FILE $R
done
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# Stub
;;
esac

View File

@ -14,6 +14,7 @@ BUILD=$TOP/build
METAINF=$BUILD/meta
COMMON=$TOP/common/proprietary
GLOG=/tmp/gapps_log
ADDOND=$TOP/addond.sh
##
# functions
@ -53,6 +54,26 @@ function create() {
echo "Copying stuff" >> $GLOG
cp -r $PREBUILT/* $OUT/$GARCH/system >> $GLOG
cp -r $COMMON/* $OUT/$GARCH/system >> $GLOG
echo "Generating addon.d script" >> $GLOG
test -d $OUT/$GARCH/system/addon.d || mkdir -p $OUT/$GARCH/system/addon.d
test -f $ADDOND && rm -f $ADDOND
cat $TOP/addond_head > $ADDOND
for txt_file in common-proprietary-files proprietary-files-$GARCH proprietary-files
do
cat $TOP/$txt_file.txt | while read l
do
if [ "$l" != "" ]; then
line=$(echo "$l" | sed 's/^-//g')
line=${line%%:*}
echo "$line" >> $ADDOND.tmp
fi
done
done
cat $ADDOND.tmp | LC_ALL=C sort | uniq >> $ADDOND
rm $ADDOND.tmp
cat $TOP/addond_tail >> $ADDOND
chmod 755 $ADDOND
mv $ADDOND $OUT/$GARCH/system/addon.d/30-gapps.sh
}
function zipit() {