You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.4 KiB
37 lines
1.4 KiB
#!/usr/bin/env bash
|
|
#
|
|
# Initial script for Live operating system
|
|
# This script are launching before starting init from linux-live script.
|
|
# Current dir allways must be set to root (/)
|
|
# All system path must be relative, except initrd dirs
|
|
|
|
ENABLED=yes
|
|
[ "$ENABLED" != "yes" ] && exit 0
|
|
DEBUGMODE=no
|
|
|
|
PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin
|
|
|
|
unset ROOTFS; [[ -d /usr/lib/ublinux ]] || ROOTFS=.
|
|
|
|
SOURCE=${ROOTFS}/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0
|
|
SOURCE=${ROOTFS}/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0
|
|
debug_mode "$0" "$@"
|
|
|
|
SYSCONF="${ROOTFS}/${SYSCONF}"
|
|
SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null
|
|
SOURCE=${SYSCONF}/network; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null
|
|
|
|
[[ -n $1 ]] && NTPSERVERS=$1
|
|
[[ -n $2 ]] && ETH_INTERFACE="_$2"
|
|
|
|
if [[ -n ${NTPSERVERS} && ${NTPSERVERS,,} != "dhcp" ]]; then
|
|
[[ ${NTPSERVERS,,} == "default" ]] && NTPSERVERS=${NTPSERVERS_DEFAULT}
|
|
if [[ -f ${ROOTFS}/usr/lib/systemd/system/systemd-timesyncd.service ]]; then
|
|
CONFIG_TIMESYNCD=${ROOTFS}/etc/systemd/timesyncd.conf.d/ubconfig${ETH_INTERFACE}.conf
|
|
mkdir -p ${ROOTFS}/etc/systemd/timesyncd.conf.d
|
|
echo "[Time]" > ${CONFIG_TIMESYNCD}
|
|
echo "NTP=${NTPSERVERS}" | tr ',;' ' ' >> ${CONFIG_TIMESYNCD}
|
|
echo "FallbackNTP=${NTPSERVERS_FALLBACK}" >> ${CONFIG_TIMESYNCD}
|
|
fi
|
|
fi
|