mirror of
https://github.com/endeavouros-team/eos-bash-shared.git
synced 2026-06-13 01:34:36 +00:00
54 lines
1.2 KiB
Bash
Executable File
54 lines
1.2 KiB
Bash
Executable File
#!/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 "$@"
|
|
|