Browse Source

added ssh keys generation service on startup + bugfixes

master
crims0n 5 years ago
parent
commit
2b42567168
  1. 4
      autoinstall
  2. 4
      install
  3. 35
      linux-live/minioslib
  4. 13
      move_iso.sh

4
autoinstall

@ -27,6 +27,10 @@ BUILD_DIR=""
common_variables
if [ -f /.dockerenv ] || [ "$container" = "podman" ]; then
new_run
fi
console_colours
allow_root_only

4
install

@ -27,6 +27,10 @@ BUILD_DIR=""
common_variables
if [ -f /.dockerenv ] || [ "$container" = "podman" ]; then
new_run
fi
console_colours
allow_root_only

35
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 <<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
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

13
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
Loading…
Cancel
Save