SPS · log · files · refs · tags · releases · people · languages · GitHub · file
lib/mkiso/live-rc
6208 bytes at 2909919 · GitHub
#!/bin/busybox sh
# Sysinit for the live image. Child of busybox init, or a systemd oneshot.
# Must not replace PID 1 and must not exec a console. The old live TTY did
# that and the kernel reported "Attempted to kill init" (exit 127).
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
if [ -d /usr/lib64/go1.27.0/go/bin ]; then
PATH=/usr/lib64/go1.27.0/go/bin:$PATH
fi
export PATH
export HOME=/root
export TERM=${TERM:-linux}
export CARGO_HOME=${CARGO_HOME:-/root/.cargo}
export LANG=${LANG:-C.UTF-8}
export LC_ALL=${LC_ALL:-C.UTF-8}
mkdir -p /proc /sys /dev /run /tmp /root /mnt /etc/sps /var/lib/dbus
mount -t proc proc /proc 2>/dev/null || :
mount -t sysfs sysfs /sys 2>/dev/null || :
mount -t devtmpfs devtmpfs /dev 2>/dev/null || :
mkdir -p /dev/pts /dev/shm
mount -t devpts devpts /dev/pts 2>/dev/null || :
mount -t tmpfs tmpfs /run 2>/dev/null || :
mount -t tmpfs -o mode=1777,nosuid,nodev tmpfs /tmp 2>/dev/null || \
mount -t tmpfs tmpfs /tmp 2>/dev/null || :
chmod 1777 /tmp 2>/dev/null || :
mkdir -p /tmp/.X11-unix /tmp/.ICE-unix
chmod 1777 /tmp/.X11-unix /tmp/.ICE-unix 2>/dev/null || :
mkdir -p /run/dbus
if [ ! -e /var/run ]; then
mkdir -p /var
ln -s ../run /var/run
fi
if command -v ldconfig >/dev/null 2>&1; then
ldconfig 2>/dev/null || :
fi
ln -sf /proc/self/fd /dev/fd 2>/dev/null || :
ln -sf /proc/self/fd/0 /dev/stdin 2>/dev/null || :
ln -sf /proc/self/fd/1 /dev/stdout 2>/dev/null || :
ln -sf /proc/self/fd/2 /dev/stderr 2>/dev/null || :
hostname splux-live 2>/dev/null || :
[ -f /etc/hostname ] || printf '%s\n' splux-live >/etc/hostname
if [ ! -f /etc/locale.conf ]; then
printf '%s\n' 'LANG=C.UTF-8' >/etc/locale.conf
fi
if [ ! -s /etc/machine-id ] && command -v dbus-uuidgen >/dev/null 2>&1; then
dbus-uuidgen --ensure=/etc/machine-id 2>/dev/null || :
fi
# NVIDIA live path is nouveau. Do not load proprietary nvidia* next to KWin.
mkdir -p /etc/modprobe.d
if [ ! -f /etc/modprobe.d/sps-nouveau.conf ]; then
printf '%s\n' \
'blacklist nvidia' \
'blacklist nvidia_drm' \
'blacklist nvidia_modeset' \
'blacklist nvidia_uvm' \
'options nouveau modeset=1' \
>/etc/modprobe.d/sps-nouveau.conf
fi
if [ -d /lib/modules ] && command -v depmod >/dev/null 2>&1; then
depmod -a 2>/dev/null || :
fi
# QEMU/virt-manager usually presents virtio-gpu, stdvga (bochs), qxl,
# or cirrus. KWin needs a DRM node; nouveau/bochs alone is not enough.
for mod in e1000 e1000e r8169 virtio_net virtio_blk virtio_pci virtio_scsi \
usbnet hid-generic usbhid atkbd \
drm drm_kms_helper drm_shmem_helper drm_ttm_helper ttm virtio_dma_buf \
virtio_gpu nouveau bochs cirrus_qemu qxl vmwgfx i915 amdgpu
do
modprobe "$mod" 2>/dev/null || :
done
n=0
while [ "$n" -lt 5 ]
do
if [ -e /dev/dri/card0 ] || [ -e /dev/dri/card1 ]; then
break
fi
n=$((n + 1))
sleep 1
done
if [ ! -e /dev/dri/card0 ] && [ ! -e /dev/dri/card1 ]; then
modprobe simpledrm 2>/dev/null || :
fi
# udev first so virtio_net and friends have device nodes before DHCP.
if command -v udevd >/dev/null 2>&1; then
udevd --daemon 2>/dev/null || :
udevadm trigger --action=add 2>/dev/null || :
udevadm settle --timeout=5 2>/dev/null || :
elif [ -x /lib/systemd/systemd-udevd ]; then
/lib/systemd/systemd-udevd --daemon 2>/dev/null || :
udevadm trigger --action=add 2>/dev/null || :
udevadm settle --timeout=5 2>/dev/null || :
fi
if command -v ip >/dev/null 2>&1; then
ip link set lo up 2>/dev/null || :
for sps_netif in /sys/class/net/*; do
sps_if=${sps_netif##*/}
[ "$sps_if" = lo ] && continue
ip link set "$sps_if" up 2>/dev/null || :
done
fi
# A host resolv.conf symlink to systemd-resolved would leave libc talking
# to 127.0.0.53 with no daemon. Keep a real file; DHCP may overwrite it.
if [ -L /etc/resolv.conf ]; then
rm -f /etc/resolv.conf
fi
if [ ! -s /etc/resolv.conf ] || ! grep -q '^nameserver ' /etc/resolv.conf
then
printf '%s\n' 'nameserver 1.1.1.1' 'nameserver 8.8.8.8' \
>/etc/resolv.conf
fi
if [ ! -s /etc/nsswitch.conf ]; then
printf '%s\n' 'passwd: files' 'group: files' 'shadow: files' \
'hosts: files dns' 'networks: files' 'protocols: files' \
'services: files' >/etc/nsswitch.conf
fi
mkdir -p /var/lib/dhcpcd /var/db /run/dhcpcd
if command -v dhcpcd >/dev/null 2>&1; then
dhcpcd -b 2>/dev/null || :
elif command -v udhcpc >/dev/null 2>&1; then
sps_udhcp_script=/etc/sps/udhcpc-script
for sps_netif in /sys/class/net/*; do
sps_if=${sps_netif##*/}
[ "$sps_if" = lo ] && continue
if [ -x "$sps_udhcp_script" ]; then
udhcpc -i "$sps_if" -s "$sps_udhcp_script" -b \
-p /run/udhcpc."$sps_if".pid 2>/dev/null || :
else
udhcpc -i "$sps_if" -b \
-p /run/udhcpc."$sps_if".pid 2>/dev/null || :
fi
done
elif command -v dhclient >/dev/null 2>&1; then
dhclient -nw 2>/dev/null || :
fi
# System bus before Plasma. Always rewrite system-local.conf: a copied
# host file would otherwise keep <user>messagebus</user>.
mkdir -p /run/dbus /var/lib/dbus /etc/dbus-1
cat >/etc/dbus-1/system-local.conf <<'EOF'
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<user>root</user>
</busconfig>
EOF
if [ ! -S /run/dbus/system_bus_socket ] &&
[ ! -S /var/run/dbus/system_bus_socket ]
then
if command -v dbus-daemon >/dev/null 2>&1; then
dbus-daemon --system --nofork --nopidfile --nosyslog \
>/run/sps-dbus.log 2>&1 &
n=0
while [ "$n" -lt 5 ]; do
if [ -S /run/dbus/system_bus_socket ] ||
[ -S /var/run/dbus/system_bus_socket ]
then
break
fi
n=$((n + 1))
sleep 1
done
if [ ! -S /run/dbus/system_bus_socket ] &&
[ ! -S /var/run/dbus/system_bus_socket ]
then
printf '%s\n' "SPS: dbus-daemon did not create a system bus socket"
cat /run/sps-dbus.log 2>/dev/null || :
fi
fi
fi
if [ -x /usr/lib/polkit-1/polkitd ]; then
/usr/lib/polkit-1/polkitd --no-debug >/run/sps-polkitd.log 2>&1 &
fi
cat /etc/issue 2>/dev/null || :
cat /etc/motd 2>/dev/null || :
cmdline=$(cat /proc/cmdline 2>/dev/null || :)
case " $cmdline " in
*" sps=setup "*)
# Child, not PID 1. setup can fail without taking the box down.
if command -v setup >/dev/null 2>&1; then
setup || :
fi
;;
esac
exit 0