Compare commits

...

14 commits

Author SHA1 Message Date
Tobias Powalowski
72e6192284 add loop 2023-07-21 22:17:43 +02:00
Tobias Powalowski
dfd7b4cbfb show countrycode 2023-07-21 22:08:17 +02:00
Tobias Powalowski
18ddf34ebf show countrycode 2023-07-21 22:05:53 +02:00
Tobias Powalowski
90dfc73037 show countrycode 2023-07-21 22:03:14 +02:00
Tobias Powalowski
baff5c9748 show countrycode 2023-07-21 22:00:52 +02:00
Tobias Powalowski
7964b8064b show countrycode 2023-07-21 21:58:36 +02:00
Tobias Powalowski
eba61a3f4f show countrycode 2023-07-21 21:56:39 +02:00
Tobias Powalowski
735877d03f only show https mirrors 2023-07-21 21:48:14 +02:00
Tobias Powalowski
c0b3db4577 silent curl 2023-07-21 21:45:58 +02:00
Tobias Powalowski
da08f164c4 only show https mirrors 2023-07-21 21:42:02 +02:00
Tobias Powalowski
29c9da6305 only show geoip mirrors 2023-07-21 21:40:10 +02:00
Tobias Powalowski
3d22158bd7 add ip based timezone detection 2023-07-21 21:32:41 +02:00
Tobias Powalowski
bca80745fe add ip based timezone detection 2023-07-21 21:15:00 +02:00
Tobias Powalowski
1e346c4ae3 update MOTD 2023-07-21 19:42:57 +02:00
3 changed files with 34 additions and 26 deletions

View file

@ -14,6 +14,10 @@ _hwclock() {
_timezone () {
_SET_ZONE=""
if ping -c1 www.google.com &>/dev/null; then
_ZONE="$(curl -s "http://ip-api.com/csv/?fields=timezone")"
_SET_ZONE=1
fi
while [[ -z "${_SET_ZONE}" ]]; do
_CONTINUE=""
while [[ -z "${_CONTINUE}" ]]; do
@ -36,13 +40,13 @@ _timezone () {
_SET_ZONE="1"
_ZONE=$(cat ${_ANSWER})
[[ "${_ZONE}" == "${_REGION}" ]] || _ZONE="${_REGION}/${_ZONE}"
_dialog --infobox "Setting Timezone to ${_ZONE}..." 3 50
timedatectl set-timezone "${_ZONE}"
sleep 3
else
_SET_ZONE=""
fi
done
_dialog --infobox "Setting Timezone to ${_ZONE}..." 3 50
timedatectl set-timezone "${_ZONE}"
sleep 3
}
_timeset() {

View file

@ -8,22 +8,25 @@ _select_mirror() {
## Download updated mirrorlist, if possible (only on x86_64)
if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then
_dialog --infobox "Downloading latest mirrorlist..." 3 40
${_DLPROG} "https://www.archlinux.org/mirrorlist/?country=all&protocol=http&protocol=https&ip_version=4&ip_version=6&use_mirror_status=on" -O /tmp/pacman_mirrorlist.txt
if grep -q '#Server = http:' /tmp/pacman_mirrorlist.txt; then
_COUNTRY="$(curl -s "http://ip-api.com/csv/?fields=countryCode")"
${_DLPROG} "https://www.archlinux.org/mirrorlist/?country=${_COUNTRY}&protocol=https&ip_version=4&ip_version=6&use_mirror_status=on" -O /tmp/pacman_mirrorlist.txt
if grep -q '#Server = https:' /tmp/pacman_mirrorlist.txt; then
mv "${_MIRRORLIST}" "${_MIRRORLIST}.bak"
cp /tmp/pacman_mirrorlist.txt "${_MIRRORLIST}"
fi
fi
# FIXME: this regex doesn't honor commenting
_MIRRORS=$(grep -E -o '((http)|(https))://[^/]*' "${_MIRRORLIST}" | sed 's|$| _|g')
_MIRRORS=$(grep -E -o '(https)://[^/]*' "${_MIRRORLIST}" | sed 's|$| _|g')
_SYNC_URL=""
while [[ -z "${_SYNC_URL}" ]]; do
#shellcheck disable=SC2086
_dialog --cancel-label "Exit" --title " Package Mirror " --menu "" 13 55 7 \
"Custom" "_" ${_MIRRORS} 2>${_ANSWER} || _abort
#shellcheck disable=SC2155
local _SERVER=$(cat "${_ANSWER}")
if [[ "${_SERVER}" == "Custom" ]]; then
_dialog --inputbox "Enter the full URL to repositories." 8 65 \
"" 2>"${_ANSWER}" || return 1
_dialog --cancel-label "Back" --inputbox "Enter the full URL to repositories." 8 65 \
"" 2>"${_ANSWER}" || _SYNC_URL=""
_SYNC_URL=$(cat "${_ANSWER}")
else
# Form the full URL for our mirror by grepping for the server name in
@ -32,6 +35,7 @@ _select_mirror() {
# only return one line for the mirror.
_SYNC_URL=$(grep -E -o "${_SERVER}.*" "${_MIRRORLIST}" | head -n1)
fi
done
echo "Using mirror: ${_SYNC_URL}" >"${_LOG}"
#shellcheck disable=SC2027,SC2086
echo "Server = "${_SYNC_URL}"" >> /etc/pacman.d/mirrorlist

View file

@ -21,11 +21,11 @@ if echo "${HOOKS[@]}" | grep -qw archboot_net; then
echo -e " - Use the \e[1;92m'weechat'\e[m IRC client." >> "${MOTD}"
fi
if echo "${HOOKS[@]}" | grep -qw archboot_installer; then
echo -e "\e[1mManage Archboot Environment Or For Experts:\e[m" >> "${MOTD}"
echo -e " - Use the \e[1;92m'launcher'\e[m or \e[1;92m'update'\e[m script." >> "${MOTD}"
echo -e "\e[1mManage Archboot Environment:\e[m" >> "${MOTD}"
echo -e " - Use the \e[1;92m'launcher'\e[m or the expert \e[1;92m'update'\e[m script." >> "${MOTD}"
#shellcheck disable=SC2129
echo -e "\e[1mInstallation Or Installation For Experts:\e[m" >> "${MOTD}"
echo -e " - Use the \e[1;92m'setup'\e[m or \e[1;92m'quickinst'\e[m script." >> "${MOTD}"
echo -e "\e[1mInstallation:\e[m" >> "${MOTD}"
echo -e " - Use the \e[1;92m'setup'\e[m or the expert \e[1;92m'quickinst'\e[m script." >> "${MOTD}"
fi
chmod 644 "${MOTD}"
add_file "${MOTD}" "/etc/motd"