-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·78 lines (64 loc) · 1.64 KB
/
install.sh
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
#!/usr/bin/env bash
# Variables
UBOOTDIR=/efifiles
FCOSEFIDIR=/tmp/FCOSEfiPart
FCOSDISK=/dev/sdX
BUTANEFILE="/data/input.btn"
G="\033[0;32m"
R="\033[0;31m"
NOCOLOR="\033[0m"
function usage () {
echo "convert <butane file>"
echo "install <butane file> <disk>"
}
function convert_ignation () {
echo -n "Converting ignation file - "
if [ -s $1 ]; then
butane -o config.ign $1 > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo -e "${G}done${NOCOLOR}"
else
echo -e "${R}File not valid${NOCOLOR}"
fi
else
echo -e "${R}file not found${NOCOLOR}"
#exit 1
fi
}
function install_coreos () {
# Run CoreOS installer to disk
convert_ignation $1
echo -n "Installing CoreOS - "
if [ -f $2 ]; then
coreos-installer install --architecture=aarch64 -i config.ign $2 #> /dev/null 2>&1
echo -e "${G}done${NOCOLOR}"
else
echo -e "${R}disk not found${NOCOLOR}"
exit 1
fi
# Installing u-boot files
echo -n "Installing u-boot files - "
FCOSEFIPARTITION=$(lsblk $2 -J -oLABEL,PATH | jq -r '.blockdevices[] | select(.label == "EFI-SYSTEM")'.path)
mkdir $FCOSEFIMOUNT
mount $FCOSEFIPARTITION $FCOSEFIDIR
rsync -avh --ignore-existing $UBOOTDIR/boot/efi/ $FCOSEFIDIR
umount $FCOSEFIPARTITION
echo -e "${G}done${NOCOLOR}"
}
if [ $# -gt 1 ]; then
case $1 in
convert)
convert_ignation $2;;
install)
if [ $# -gt 2 ]; then
install_coreos $2 $3
else
usage
fi;;
*)
usage
exit 1;;
esac
else
usage
fi