Skip to content

Commit

Permalink
Minor changes to scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ikalkov committed Aug 16, 2016
1 parent 4fa0f43 commit 9077013
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 30 deletions.
2 changes: 1 addition & 1 deletion boot/config.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
hdmi_force_hotplug=1
hdmi_ignore_edid=0xa5000080
hdmi_drive=1
hdmi_drive=2
hdmi_group=2
hdmi_mode=28
disable_overscan=1
Expand Down
30 changes: 19 additions & 11 deletions gapps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# https://github.com/RTAndroid/android_device_brcm_rpi3/blob/aosp-n/gapps.sh
#

package="open_gapps-arm-6.0-pico-20160815.zip"
timestamp="20160815"
package="open_gapps-arm-6.0-pico-$timestamp.zip"
address="192.168.1.37"

# ------------------------------------------------
Expand Down Expand Up @@ -44,25 +45,30 @@ echo "GApps installation script for RPi"
echo "Used package: $package"
echo "Device address: $address"

if [ ! -d org ]; then
echo " * Downloading GApps package..."
wget https://github.com/opengapps/arm/releases/download/20160815/$package
if [ ! -d "org" ]; then
echo " * Downloading OpenGApps package..."
wget https://github.com/opengapps/arm/releases/download/$timestamp/$package
unzip $package -d org
fi

if [ ! -d "org" ]; then
echo "ERR: unzipping the package failed!"
exit 1
fi

echo " * Extracting supplied packages..."
rm -rf tmp
rm -rf tmp > /dev/null 2>&1
mkdir -p tmp
find . -name "*.tar.xz" -exec tar -xf {} -C tmp/ \;

echo " * Removing not needed packages..."
echo " * Removing conflicting packages..."
echo " - SetupWizard (Tablet)"
rm -rf tmp/setupwizardtablet*
rm -rf tmp/setupwizardtablet* > /dev/null 2>&1
echo " - PackageInstaller (Google)"
rm -rf tmp/packageinstallergoogle*
rm -rf tmp/packageinstallergoogle* > /dev/null 2>&1

echo " * Creating system partition..."
rm -rf sys
rm -rf sys > /dev/null 2>&1
mkdir -p sys
for dir in tmp/*/
do
Expand All @@ -88,15 +94,17 @@ echo " * Enforcing a reboot, please be patient..."
wait_for_adb
reboot_now

echo " * Waiting for the device (errors are OK)..."
echo " * Waiting for ADB (errors are OK)..."
wait_for_adb

echo " * Applying correct permissions..."
adb shell "pm grant com.google.android.gms android.permission.ACCESS_COARSE_LOCATION"
adb shell "pm grant com.google.android.gms android.permission.ACCESS_FINE_LOCATION"
adb shell "pm grant com.google.android.setupwizard android.permission.READ_PHONE_STATE"

echo "All done. The device will be rebooted once again."
echo " * Waiting for ADB..."
wait_for_adb

echo "All done. The device will reboot once again."
reboot_now
adb kill-server
58 changes: 40 additions & 18 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ check_partitions()

# allow less partitions if we are going to re-partition it anyways
if [ "$PARTITION" = true ]; then
echo " - ignoring this count due to upcoming partitioning"
echo " - ignoring this count due to upcoming partitioning"
PARTITION_COUNT=4
fi

Expand Down Expand Up @@ -210,45 +210,62 @@ create_partitions()

echo " * Start partitioning..."

# add partition 1 (min 512 MB) -> boot
# add partition 1 -> boot
echo ""
echo " - creating 'boot'"
printf "n\np\n1\n\n+${SIZE_P1}M\nw\n" | sudo fdisk $DEVICE_LOCATION
((TEST+=$?))

# re-read the partition table
sudo partprobe $DEVICE_LOCATION
((TEST+=$?))
sudo partprobe

# set it as bootable with partition type "W95 FAT32 (LBA)"
printf "a\n1\nt\nc\nw\n" | sudo fdisk $DEVICE_LOCATION
((TEST=$?))
# set the first partition as bootable
echo ""
echo " - setting bootable flag"
printf "a\n1\nw\n" | sudo fdisk $DEVICE_LOCATION

# re-read the partition table
sudo partprobe $DEVICE_LOCATION
# set the partition type to "W95 FAT32 (LBA)"
echo ""
echo " - setting correct partition type"
printf "t\nc\nw\n" | sudo fdisk $DEVICE_LOCATION

# add partition 2 (min 1024 MB) -> system
# add partition 2 -> system
echo ""
echo " - creating 'system'"
printf "n\np\n2\n\n+${SIZE_P2}M\nw\n" | sudo fdisk $DEVICE_LOCATION
((TEST+=$?))

# re-read the partition table
sudo partprobe $DEVICE_LOCATION
((TEST+=$?))
sudo partprobe

# add partition 3 (min 512 MB) -> cache
# add partition 3 -> cache
echo ""
echo " - creating 'cache'"
printf "n\np\n3\n\n+${SIZE_P3}M\nw\n" | sudo fdisk $DEVICE_LOCATION
((TEST+=$?))

# re-read the partition table
sudo partprobe $DEVICE_LOCATION
((TEST+=$?))
sudo partprobe

# add partition 4 (rest of disk) -> userdata
# add partition 4 -> userdata
echo ""
echo " - creating 'userdata'"
printf "n\np\n\n\nw\n" | sudo fdisk $DEVICE_LOCATION
((TEST=$?))

# re-read the partition table
sudo partprobe $DEVICE_LOCATION
((TEST+=$?))
sudo partprobe

if [[ $TEST -gt 0 ]]; then
echo "ERR: an error while partitioning occured."
exit 1
fi

echo ""
echo " * Printing the new partition table..."

printf "p\nq\n" | sudo fdisk $DEVICE_LOCATION
echo ""
}

unmount_all()
Expand All @@ -274,10 +291,12 @@ format_data()
local TEST=0

echo " - formatting 'cache'"
echo ""
sudo mkfs.ext4 -L cache ${DEVICE_LOCATION}${DEVICE_SUFFIX}3
((TEST+=$?))

echo " - formatting 'userdata'"
echo ""
sudo mkfs.ext4 -L userdata ${DEVICE_LOCATION}${DEVICE_SUFFIX}4
((TEST+=$?))

Expand All @@ -293,10 +312,13 @@ format_system()
local TEST=0

echo " - formatting 'boot'"
echo ""
sudo mkfs.vfat -n boot -F 32 ${DEVICE_LOCATION}${DEVICE_SUFFIX}1
((TEST+=$?))

echo ""
echo " - formatting 'system'"
echo ""
sudo mkfs.ext4 -L system ${DEVICE_LOCATION}${DEVICE_SUFFIX}2
((TEST+=$?))

Expand Down

0 comments on commit 9077013

Please sign in to comment.