diff --git a/linux-live/minioslib b/linux-live/minioslib index ba0d7b3..da1a095 100644 --- a/linux-live/minioslib +++ b/linux-live/minioslib @@ -718,62 +718,6 @@ function build_live() { #(cd /linux-live/rootcopy && cp --parents -afr * /) - echo "Set up password for user 'root'" >>$OUTPUT 2>&1 - echo root:toor | chroot $BUILD_DIR chpasswd >>$OUTPUT 2>&1 - - if ! cat $BUILD_DIR/etc/passwd | grep /home/live; then - echo "Set up user 'live'" >>$OUTPUT 2>&1 - chroot $BUILD_DIR adduser --gecos '' live --disabled-password >>$OUTPUT 2>&1 - fi - echo "Set up password for user 'live'" >>$OUTPUT 2>&1 - echo live:evil | chroot $BUILD_DIR chpasswd >>$OUTPUT 2>&1 - chroot $BUILD_DIR addgroup live adm >>$OUTPUT 2>&1 - chroot $BUILD_DIR addgroup live sudo >>$OUTPUT 2>&1 - - cat <$BUILD_DIR/etc/sudoers.d/90-minios -# live user is default user in minios. -# It needs passwordless sudo functionality. -live ALL=(ALL) NOPASSWD:ALL -EOF - - if [ -d $BUILD_DIR/etc/lightdm ]; then - cat <$BUILD_DIR/etc/lightdm/lightdm.conf -[Seat:*] -autologin-session=xubuntu -autologin-user=live -autologin-user-timeout=0 -EOF - fi - - if [ ! -d $BUILD_DIR/etc/NetworkManager ]; then - echo "Enable dhclient.service autostart." >>$OUTPUT 2>&1 - chroot $BUILD_DIR cat </lib/systemd/system/dhclient.service -[Unit] -Description=DHCP Client -Documentation=man:dhclient(8) -Wants=network.target -After=network-pre.target systemd-sysctl.service systemd-modules-load.service -Before=network.target shutdown.target network-online.target -ConditionPathExists=!/run/initramfs/net.up.flag - -[Service] -Type=forking -ExecStart=-/bin/sh -c 'udevadm settle && dhclient -nw' -PIDFile=/run/dhclient.pid - -[Install] -WantedBy=multi-user.target -WantedBy=network-online.target -EOF - chroot $BUILD_DIR systemctl enable dhclient >>$OUTPUT 2>&1 - fi - - chroot $BUILD_DIR /bin/bash -x <>$OUTPUT 2>&1 + echo root:toor | chroot $BUILD_DIR chpasswd >>$OUTPUT 2>&1 + + if ! cat $BUILD_DIR/etc/passwd | grep /home/live; then + echo "Set up user 'live'" >>$OUTPUT 2>&1 + chroot $BUILD_DIR adduser --gecos '' live --disabled-password >>$OUTPUT 2>&1 + fi + echo "Set up password for user 'live'" >>$OUTPUT 2>&1 + echo live:evil | chroot $BUILD_DIR chpasswd >>$OUTPUT 2>&1 + chroot $BUILD_DIR addgroup live adm >>$OUTPUT 2>&1 + chroot $BUILD_DIR addgroup live sudo >>$OUTPUT 2>&1 + + cat <$BUILD_DIR/etc/sudoers.d/90-minios +# live user is default user in minios. +# It needs passwordless sudo functionality. +live ALL=(ALL) NOPASSWD:ALL +EOF + + if [ -d $BUILD_DIR/etc/lightdm ]; then + cat <$BUILD_DIR/etc/lightdm/lightdm.conf +[Seat:*] +autologin-session=xubuntu +autologin-user=live +autologin-user-timeout=0 +EOF + fi + + if [ ! -d $BUILD_DIR/etc/NetworkManager ]; then + echo "Enable dhclient.service autostart." >>$OUTPUT 2>&1 + chroot $BUILD_DIR cat </lib/systemd/system/dhclient.service +[Unit] +Description=DHCP Client +Documentation=man:dhclient(8) +Wants=network.target +After=network-pre.target systemd-sysctl.service systemd-modules-load.service +Before=network.target shutdown.target network-online.target +ConditionPathExists=!/run/initramfs/net.up.flag + +[Service] +Type=forking +ExecStart=-/bin/sh -c 'udevadm settle && dhclient -nw' +PIDFile=/run/dhclient.pid + +[Install] +WantedBy=multi-user.target +WantedBy=network-online.target +EOF + chroot $BUILD_DIR systemctl enable dhclient >>$OUTPUT 2>&1 + fi + + chroot $BUILD_DIR /bin/bash -x <>$OUTPUT 2>&1 || grep openssh-server $SCRIPT_DIR/pkglists/other.list >>$OUTPUT 2>&1; then + echo "Enable ssh.service autostart." >>$OUTPUT 2>&1 + cat </lib/systemd/system/ssh-keygen.service +[Unit] +Description=Generate sshd keys +Before=ssh.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/ssh-keygen -A +RemainAfterExit=true +StandardOutput=journal + +[Install] +WantedBy=multi-user.target +EOF + systemctl enable ssh-keygen >>$OUTPUT 2>&1 + systemctl enable ssh >>$OUTPUT 2>&1 + fi elif [ $LIVE_TYPE = "casper" ]; then (cd /linux-live/rootcopy-casper && cp --parents -afr * /) fi @@ -1358,27 +1379,6 @@ EOF dpkg-reconfigure -f noninteractive resolvconf >>$OUTPUT 2>&1 fi - if [ $LIVE_TYPE = "livekit" ]; then - if grep openssh-server $SCRIPT_DIR/pkglists/main.list >>$OUTPUT 2>&1 || grep openssh-server $SCRIPT_DIR/pkglists/other.list >>$OUTPUT 2>&1; then - echo "Enable ssh.service autostart." >>$OUTPUT 2>&1 - cat </lib/systemd/system/ssh-keygen.service -[Unit] -Description=Generate sshd keys -Before=ssh.service - -[Service] -Type=oneshot -ExecStart=/usr/bin/ssh-keygen -A -RemainAfterExit=true -StandardOutput=journal - -[Install] -WantedBy=multi-user.target -EOF - dpkg-reconfigure -f noninteractive openssh-server >>$OUTPUT 2>&1 - fi - fi - if [ $LIVE_TYPE = "casper" ]; then # network manager cat </etc/NetworkManager/NetworkManager.conf @@ -1406,29 +1406,6 @@ EOF dpkg-reconfigure resolvconf fi - if [ $LIVE_TYPE = "livekit" ]; then - if grep openssh-server $SCRIPT_DIR/pkglists/main.list >>$OUTPUT 2>&1 || grep openssh-server $SCRIPT_DIR/pkglists/other.list >>$OUTPUT 2>&1; then - echo "Enable ssh.service autostart." >>$OUTPUT 2>&1 - cat </lib/systemd/system/ssh-keygen.service -[Unit] -Description=Generate sshd keys -Before=ssh.service - -[Service] -Type=oneshot -ExecStart=/usr/bin/ssh-keygen -A -RemainAfterExit=true -StandardOutput=journal - -[Install] -WantedBy=multi-user.target -EOF - #dpkg-reconfigure openssh-server >>$OUTPUT 2>&1 - systemctl enable ssh-keygen >>$OUTPUT 2>&1 - systemctl enable ssh >>$OUTPUT 2>&1 - fi - fi - if [ $LIVE_TYPE = "casper" ]; then # network manager cat </etc/NetworkManager/NetworkManager.conf