Browse Source

update minioslib

master
crims0n 5 years ago
parent
commit
aa7f841a26
  1. 177
      linux-live/minioslib

177
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 <<EOF >$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 <<EOF >$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 <<EOF >/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 <<EOF
if [ -f /etc/systemd/system/multi-user.target.wants/grub-initrd-fallback.service ]; then
echo "Disable grub-initrd-fallback.service autostart."
systemctl disable grub-initrd-fallback.service
fi
EOF
chroot $BUILD_DIR mount none -t proc /proc
chroot $BUILD_DIR /linux-live/initrfs
@ -1290,6 +1234,83 @@ function chroot_configure() {
if [ $LIVE_TYPE = "livekit" ]; then
(cd /linux-live/rootcopy-livekit && 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 <<EOF >$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 <<EOF >$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 <<EOF >/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 <<EOF
if [ -f /etc/systemd/system/multi-user.target.wants/grub-initrd-fallback.service ]; then
echo "Disable grub-initrd-fallback.service autostart."
systemctl disable grub-initrd-fallback.service
fi
EOF
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 <<EOF >/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 <<EOF >/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 <<EOF >/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 <<EOF >/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 <<EOF >/etc/NetworkManager/NetworkManager.conf

Loading…
Cancel
Save