Skip to content

Commit

Permalink
Add ZIP builder scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Roboe committed Jul 2, 2017
1 parent f395993 commit 0a393a3
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
39 changes: 39 additions & 0 deletions META-INF/com/google/android/update-binary
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/sbin/sh

# Copyright 2013 Koushik Dutta, 2014 Ron Rieve
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# arg 1 is recovery api version, generally 3.
# arg 2 is the pipe fd, to the recovery binary.
# communicate with it using the recovery api.
# arg 3 is the zip file

echo -n -e 'ui_print Getting ready...\n' > /proc/self/fd/$2

SU_PATHS='/system/bin/su /system/xbin/su'
ADDOND_PATHS='/system/addon.d/51-addonsu.sh' # OTA survival script from LineageOS
INITRC_PATHS='/system/etc/init/superuser.rc'

mount /system


echo -n -e "ui_print Deleting root files...\n" > /proc/self/fd/$2

rm -rf $SU_PATHS $ADDOND_PATHS $INITRC_PATHS


echo -n -e 'ui_print Done\n' > /proc/self/fd/$2
echo -n -e 'ui_print\n' > /proc/self/fd/$2

umount /system
1 change: 1 addition & 0 deletions META-INF/com/google/android/updater-script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Dummy file; update-binary is a shell script.
28 changes: 28 additions & 0 deletions build-zip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
set -e

#_______________________________________________________________________________
# Configurations
ZIP_PREFIX='unroot'

#_______________________________________________________________________________
# Inner functions
function generate_zip() {
local ZIP_NAME="$1_$(date +%Y-%m-%d).zip"

local ZIP_FILES=./*

zip \
--quiet \
--recurse-path $ZIP_NAME \
$ZIP_FILES \
--exclude '*.asc' '*.xml'
echo "Result: $ZIP_NAME"
}

#_______________________________________________________________________________
# Main
echo "~~~ Packing up"
generate_zip $ZIP_PREFIX

echo "~~~ Finished"

0 comments on commit 0a393a3

Please sign in to comment.