diff --git a/autoinstall b/autoinstall index 6a53f2e..b793df7 100755 --- a/autoinstall +++ b/autoinstall @@ -27,6 +27,10 @@ BUILD_DIR="" common_variables +if [ -f /.dockerenv ] || [ "$container" = "podman" ]; then + new_run +fi + console_colours allow_root_only diff --git a/install b/install index c4c1349..734c3d5 100755 --- a/install +++ b/install @@ -27,6 +27,10 @@ BUILD_DIR="" common_variables +if [ -f /.dockerenv ] || [ "$container" = "podman" ]; then + new_run +fi + console_colours allow_root_only diff --git a/linux-live/minioslib b/linux-live/minioslib index d4039fd..bb06fd6 100644 --- a/linux-live/minioslib +++ b/linux-live/minioslib @@ -463,6 +463,22 @@ function create_backup() { fi } +function new_run() { + DATE=$(date +"%Y.%m.%d %H:%M") + echo "" + echo "=================================================================" >>$OUTPUT 2>&1 + echo "=================================================================" >>$OUTPUT 2>&1 + echo "============================ NEW RUN ============================" >>$OUTPUT 2>&1 + echo "======================== $DATE =======================" >>$OUTPUT 2>&1 + echo "=================================================================" >>$OUTPUT 2>&1 + echo "======= If during the installation you get an error that ========" >>$OUTPUT 2>&1 + echo "=== /dev/stdout is not available, try using a bionic or xenial ==" >>$OUTPUT 2>&1 + echo "================= based container to install. ===================" >>$OUTPUT 2>&1 + echo "=================================================================" >>$OUTPUT 2>&1 + echo "=================================================================" >>$OUTPUT 2>&1 + echo "" +} + # ================================================================= # ================================================================= # ====================== HOST FUNCTIONS =========================== @@ -680,7 +696,7 @@ function build_iso() { VER="$SYSTEMNAME $VER" if [ REMOVE_OLD_ISO = "1" ]; then - rm $ISO_DIR/$LIVEKITNAME-$DISTRIBUTION-$DISTRIBUTION_ARCH-$COMP_TYPE-*.iso + rm $ISO_DIR/$LIVEKITNAME-$DISTRIBUTION-$DISTRIBUTION_ARCH-$COMP_TYPE-*.iso >>$OUTPUT 2>&1 fi if @@ -899,7 +915,23 @@ function chroot_configure() { 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 + systemctl enable ssh-keygen >>$OUTPUT 2>&1 systemctl enable ssh >>$OUTPUT 2>&1 + fi echo "Enable dhclient.service autostart." >>$OUTPUT 2>&1 @@ -945,6 +977,7 @@ function chroot_finish_up() { # clean up useless stuff rm -rf /tmp/* ~/.bash_history >>$OUTPUT 2>&1 find /var/log/ -type f | xargs rm -f >>$OUTPUT 2>&1 + rm -f /etc/ssh/ssh_host* rm -f /var/backups/* >>$OUTPUT 2>&1 rm -f /var/cache/ldconfig/* >>$OUTPUT 2>&1 rm -f /var/cache/debconf/* >>$OUTPUT 2>&1 diff --git a/move_iso.sh b/move_iso.sh new file mode 100755 index 0000000..908047e --- /dev/null +++ b/move_iso.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# ! Не используйте это, если не понимаете, как оно работает. +apt update -y && apt install -y inotify-tools && apt clean +inotifywait -m /build/iso -e close_write | + while read path action file; do + echo "The file '$file' appeared in directory '$path' via '$action'" + if [ $action != "CREATE,ISDIR" ]; then + xhost + >/dev/null 2>/dev/null + #find $path ! -name "$file" -type f -exec rm -f {""} + + cp $path$file /mnt/build/iso/minios.iso + mv $path$file /mnt/build/iso/ + fi + done