-
Notifications
You must be signed in to change notification settings - Fork 5
/
eos-select-file-server
executable file
·53 lines (41 loc) · 1.21 KB
/
eos-select-file-server
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
#!/bin/bash
# This program is only meant to be called by Welcome at install.
WarnExit() {
Msg2 "$1" warning
exit 0
}
Msg2() {
local msg="$1"
local type="$2"
[ -n "$type" ] || type=info
if [ "$LOGNAME" = "liveuser" ] && [ -x /usr/bin/calamares ] ; then
echo "==> $progname: $type: $msg" >> $preprelogfile
else
echo "==> $progname: $type: $msg" >&2
fi
}
SelectFileServer() {
# Select file server for all code snippets
local progname="$(basename "$0")"
local preprelogfile=/tmp/preprelog.txt
case "$1" in
--logfilename) echo "$preprelogfile"; return ;;
esac
rm -f $preprelogfile
# [ "$(id -u)" != "0" ] && return 0
if ! eos-connection-checker ; then
WarnExit "internet connection not available"
fi
local fserver=gitlab
local place="$(show-location-info country 2>/dev/null)"
case "$place" in
IR)
# run for both liveuser and target
fserver=github
sudo sed -i /etc/eos-script-lib-yad.conf -e "s|^EOS_FILESERVER_SITE=.*|EOS_FILESERVER_SITE=$fserver|"
Msg2 "set EOS_FILESERVER_SITE to $fserver"
;;
esac
echo "$fserver"
}
SelectFileServer "$@"