-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathmisc.sh
More file actions
executable file
·62 lines (53 loc) · 1.46 KB
/
misc.sh
File metadata and controls
executable file
·62 lines (53 loc) · 1.46 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
#!/bin/bash
#
# Copyright (C) 2017 JBBgameich
# Copyright (C) 2017 TheWiseNerd
#
# License: GPLv3
function spinner() {
local pid=$1
local delay=0.75
local spinstr='|/-\'
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
local temp=${spinstr#?}
printf " [%c] " "$spinstr"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b\b\b\b\b\b"
done
printf "\b\b\b\b"
}
function init_checks() {
DEPENDENCIES=(qemu binfmt-support qemu-user-static e2fsprogs sudo simg2img)
BINARIES=(simg2img qemu-arm-static mkfs.ext4 update-binfmts qemu-img)
for bin in ${BINARIES[@]}; do
if ! sudo bash -c "command -v $bin" >/dev/null 2>&1; then
echo "$bin not found in \$PATH"
echo
echo "make sure you have all dependencies installed."
echo "dependencies: ${DEPENDENCIES[*]}"
return 1
fi
done
# if qemu-arm-static exists, a sanely installed update-binfmts
# -should- have qemu-arm. try to enable it in case it isnt.
if ! sudo update-binfmts --display qemu-arm | grep -q "qemu-arm (enabled)"; then
sudo update-binfmts --enable qemu-arm
fi
return 0
}
function usage() {
cat <<-EOF
usage: $0 rootfs.tar[.gz] system.img [release]
positional arguments:
rootfs.tar[.gz]
system.img
optional arguments:
release: run common post installation tasks for release.
supported: none, halium, pm, ut
defaults : none
EOF
}
function flash_error() {
echo "Error: Couldn't copy the files to the device, is it connected?"
}