-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patharm-eos-welcome-installer
executable file
·125 lines (111 loc) · 3.53 KB
/
arm-eos-welcome-installer
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
PROBLEM() {
local msg="$1"
local problem=(
eos_yad --form --image=$ICO_ERROR
--title="ARM installer problem"
--text="$progname: $msg"
--button=yad-quit:1
)
"${problem[@]}"
}
DIE() {
PROBLEM "$1"
exit 1
}
SelectTerminal() {
local xx
for xx in "${terminals_supported[@]}" ; do
if which "$xx" &> /dev/null ; then
echo "$xx"
return 0
fi
done
return 1
}
ARM_installer_in_terminal() {
local urls=(
"$ARM_IMAGES_GIT_PAGE"
)
local url ix count=${#urls[@]}
local errcode
local msg
local targetdir=/tmp/arm-install
rm -rf $targetdir
for ((ix=0; ix < $count; ix++)) ; do
url="${urls[$ix]}"
git clone $url $targetdir 2>/dev/null
errcode=$?
if [ $errcode -eq 0 ] ; then
#if [ "$Manuels_internal_testing" = "yes" ] ; then
# PROBLEM "$FUNCNAME called for testing only."
# return
#fi
cd $targetdir
chmod +x image-install-calamares.sh # sudo not needed here?
$terminal -e "sudo ./image-install-calamares.sh"
return
else
msg="ARM installer fetch failed (git code $errcode) from\n<tt>$url</tt>\n\n"
if [ $ix -lt $((count - 1)) ] ; then
PROBLEM "${msg}Next URL to try:\n<tt>${urls[$((ix+1))]}</tt>\n"
else
PROBLEM "${msg}Bailing out.\n"
return
fi
fi
done
}
export -f ARM_installer_in_terminal
InfoPage() {
local browser="firefox"
[ -x /usr/bin/$browser ] || browser="kde-open"
[ -x /usr/bin/$browser ] || browser="xdg-open"
$browser "$ARM_INFO_PAGE"
}
export -f InfoPage
Main() {
local progname=${0##*/}
# common configs
local file=/usr/share/endeavouros/scripts/eos-script-lib-yad
source $file || DIE "file $file not found"
AssignIconVariables_in_eos_bash_shared
# ARM configs
file=/etc/welcome-installer.conf
source $file || DIE "file $file not found"
[ "$ARM_INFO_PAGE" ] || DIE "variable ARM_INFO_PAGE not set in $file"
[ "$ARM_IMAGES_GIT_PAGE" ] || DIE "variable ARM_IMAGES_GIT_PAGE not properly set in $file"
local terminals_supported=(konsole xfce4-terminal)
local terminal="$(SelectTerminal)"
[ -n "$terminal" ] || DIE "no terminal found"
case "$terminal" in
konsole) terminal+=" --fullscreen" ;;
xfce4-terminal) terminal+=" --maximize" ;;
esac
local icon=$ICO_CALAMARES
local title="EndeavourOS ARM image installer"
local text=""
text+="Starting to install the EndeavourOS ARM image\n"
text+="to your external storage device.\n"
text+="Please follow the instructions in the terminal window.\n"
text+="\n"
text+="Before starting the ARM Installer, ensure you have a storage device\n"
text+="plugged into a USB port to receive the image.\n"
text+="Note that the download size of the image is about 1.5 GB.\n"
text+="Click <b>More Info</b> for further details.\n"
local cmd=(
eos_yad
--form --align-buttons --use-interp --image=$icon
--title="$title"
--text="$text"
--button="Start ARM Installer!$icon!Install EndeavourOS ARM image":5
--button='More Info!user-info!More details on the wiki page':"InfoPage"
--button=yad-cancel:1
)
"${cmd[@]}"
case "$?" in
5) ARM_installer_in_terminal ;;
esac
return 0
}
Main "$@"