-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathhalium-install
More file actions
executable file
·88 lines (73 loc) · 1.62 KB
/
halium-install
File metadata and controls
executable file
·88 lines (73 loc) · 1.62 KB
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
#!/bin/bash
#
# Halium installer script
# =======================
#
# Copyright (C) 2017 JBBgameich
# Copyright (C) 2017 TheWiseNerd
#
# License: GPLv3
#
# dependencies: qemu binfmt-support qemu-user-static e2fsprogs sudo simg2img
# Opts parser, to be rewritten
if [ "$#" -lt 2 ] || [ "$#" -gt 3 ]; then
usage
exit
fi
if [ ! -f $1 ] || [ ! -f $2 ]; then
usage
exit
fi
if [ "$#" -eq 3 ]; then
case "$3" in
halium | pm | ut)
export ROOTFS_RELEASE="$3"
;;
*)
echo "release [$3] not supported."
exit
;;
esac
else
ROOTFS_RELEASE="none"
fi
# Include functions
. ./functions/misc.sh
. ./functions/distributions.sh
. ./functions/core.sh
# Check for missing dependencies
if ! init_checks; then
exit
fi
export ROOTFS_TAR=$1
export AND_IMAGE=$2
export ROOTFS_DIR=$(mktemp -d .halium-install-rootfs.XXXXX)
export IMAGE_DIR=$(mktemp -d .halium-install-imgs.XXXXX)
# Set defaults
export ${FLASH_METHOD:="rsync"}
export ${DEBUG:="true"}
# Print out useful debugging information
[ $DEBUG == "true" ] && debug_variables
# Start installer
echo "I: Writing rootfs into mountable image"
convert_rootfs $IMAGE_SIZE &>/dev/null &
spinner $!
echo "I: Writing android image into mountable image"
convert_androidimage &>/dev/null &
spinner $!
echo "I: Running post installation tasks"
post_install $ROOTFS_RELEASE
echo "I: Unmounting images"
unmount &>/dev/null &
spinner $!
echo "I: Shrinking images"
shrink_images
echo "I: Pushing rootfs and android image to /data"
if [ $FLASH_METHOD == "adb" ]; then
flash_adb || flash_error
elif [ $FLASH_METHOD == "rsync" ]; then
flash_rsync || flash_error
fi
echo "I: Cleaning up host"
clean &
spinner $!