浏览代码

mklive: do not assume glibc and/or systemd (might use musl and runit instead :-).

Juan RP 11 年之前
父节点
当前提交
3b5b9cba6a
共有 3 个文件被更改,包括 18 次插入9 次删除
  1. 8 6
      dracut/adduser.sh
  2. 6 1
      dracut/locale.sh
  3. 4 2
      mklive.sh.in

+ 8 - 6
dracut/adduser.sh

@@ -22,12 +22,14 @@ if [ -f ${NEWROOT}/etc/sudoers ]; then
 fi
 
 # Enable autologin for agetty(8).
-rm -f "${NEWROOT}/etc/systemd/system/getty.target.wants/[email protected]"
-sed -e "s|/sbin/agetty --noclear|& -a ${USERNAME}|g" \
-    "${NEWROOT}/usr/lib/systemd/system/[email protected]" > \
-    "${NEWROOT}/etc/systemd/system/[email protected]"
-ln -sf /etc/systemd/system/[email protected] \
-    "${NEWROOT}/etc/systemd/system/getty.target.wants/[email protected]"
+if [ -d ${NEWROOT}/etc/systemd/system ]; then
+    rm -f "${NEWROOT}/etc/systemd/system/getty.target.wants/[email protected]"
+    sed -e "s|/sbin/agetty --noclear|& -a ${USERNAME}|g" \
+        "${NEWROOT}/usr/lib/systemd/system/[email protected]" > \
+        "${NEWROOT}/etc/systemd/system/[email protected]"
+    ln -sf /etc/systemd/system/[email protected] \
+        "${NEWROOT}/etc/systemd/system/getty.target.wants/[email protected]"
+fi
 
 if [ -d ${NEWROOT}/etc/polkit-1 ]; then
     # If polkit is installed allow users in the wheel group to run anything.

+ 6 - 1
dracut/locale.sh

@@ -14,4 +14,9 @@ echo "LC_COLLATE=C" >> $NEWROOT/etc/locale.conf
 # set keymap too.
 KEYMAP=$(getarg vconsole.keymap)
 [ -z "$KEYMAP" ] && KEYMAP="us"
-sed -e "s,^KEYMAP=.*,KEYMAP=$KEYMAP," -i $NEWROOT/etc/vconsole.conf
+
+if [ -f ${NEWROOT}/etc/vconsole.conf ]; then
+    sed -e "s,^KEYMAP=.*,KEYMAP=$KEYMAP," -i $NEWROOT/etc/vconsole.conf
+elif [ -f ${NEWROOT}/etc/rc.conf ]; then
+    sed -e "s,^KEYMAP=.*,KEYMAP=$KEYMAP," -i $NEWROOT/etc/rc.conf.conf
+fi

+ 4 - 2
mklive.sh.in

@@ -113,8 +113,10 @@ install_packages() {
     ${XBPS_REMOVE_CMD} -r $ROOTFS $XBPS_CACHEDIR -o >>$LOGFILE 2>&1
 
     # Enable choosen UTF-8 locale and generate it into the target rootfs.
-    sed -e "s/\#\(${LOCALE}.*\)/\1/g" -i $ROOTFS/etc/default/libc-locales
-    xbps-uchroot $ROOTFS xbps-reconfigure -f glibc-locales >>$LOGFILE 2>&1
+    if [ -f $ROOTFS/etc/default/libc-locales ]; then
+        sed -e "s/\#\(${LOCALE}.*\)/\1/g" -i $ROOTFS/etc/default/libc-locales
+        xbps-uchroot $ROOTFS xbps-reconfigure -f glibc-locales >>$LOGFILE 2>&1
+    fi
 
     if [ -x installer.sh ]; then
         install -Dm755 installer.sh $ROOTFS/usr/sbin/void-installer