diff --git a/linux-live/basesystem/01-core/rootcopy-install/usr/bin/cmdline_parser b/linux-live/basesystem/01-core/rootcopy-install/usr/bin/cmdline_parser new file mode 100755 index 0000000..a3792a0 --- /dev/null +++ b/linux-live/basesystem/01-core/rootcopy-install/usr/bin/cmdline_parser @@ -0,0 +1,153 @@ +#!/bin/bash +# +# Сommand line parsing script. +# Author: crims0n. +# + +for i in $(cat /proc/cmdline); do + case $i in + user_name=*) + USER_NAME="${i#*=}" + shift # past argument=value + ;; + user_password=*) + USER_PASSWORD="${i#*=}" + shift # past argument=value + ;; + root_password=*) + ROOT_PASSWORD="${i#*=}" + shift # past argument=value + ;; + ssh) + SSH=true + shift # past argument with no value + ;; + cloud) + CLOUD=true + shift # past argument with no value + ;; + *) + # unknown option + ;; + esac +done + +if [ -z "$ROOT_PASSWORD" ]; then + ROOT_PASSWORD="toor" +fi +echo "Set up password for user 'root'" +echo root:$ROOT_PASSWORD | chpasswd + +if [ "$CLOUD" != "true" ]; then + + if [ -z "$USER_NAME" ]; then + USER_NAME="live" + fi + echo "Set up user '$USER_NAME'" + adduser --uid 1000 --gecos '' $USER_NAME --disabled-password + + if [ -z "$USER_PASSWORD" ]; then + USER_PASSWORD="evil" + fi + echo "Set up password for user '$USER_NAME'" + echo $USER_NAME:$USER_PASSWORD | chpasswd + usermod -a -G sudo $USER_NAME + + if [ "$SSH" = "true" ]; then + systemctl enable ssh-keygen + systemctl enable ssh + else + systemctl disable ssh-keygen + systemctl disable ssh + fi + sed -i 's,#PermitRootLogin prohibit-password,PermitRootLogin yes,g' /etc/ssh/sshd_config + sed -i 's,#PasswordAuthentication yes,PasswordAuthentication yes,g' /etc/ssh/sshd_config +else + rm -rf /home/live +fi + +cat </etc/sudoers.d/90-minios +# live user is default user in minios. +# It needs passwordless sudo functionality. +$USER_NAME ALL=(ALL) NOPASSWD:ALL +EOF + +if [ "$CLOUD" != "true" ]; then + cat </etc/issue + + + \l + + + + + + Thank you for using MiniOS. + Based on Debian GNU/Linux. + Powered by Slax. + + :::: :::: ::::::::::: :::: ::: ::::::::::: :::::::: ::::::::  + +:+:+: :+:+:+ :+: :+:+: :+: :+: :+: :+: :+: :+:  + +:+ +:+:+ +:+ +:+ :+:+:+ +:+ +:+ +:+ +:+ +:+  + +#+ +:+ +#+ +#+ +#+ +:+ +#+ +#+ +#+ +:+ +#++:++#++  + +#+ +#+ +#+ +#+ +#+#+# +#+ +#+ +#+ +#+  + #+# #+# #+# #+# #+#+# #+# #+# #+# #+# #+#  + ### ### ########### ### #### ########### ######## ########  + + Root login name: root + Password: $ROOT_PASSWORD + User login name: $USER_NAME + Password: $USER_PASSWORD + + + + + +EOF +else + cat </etc/issue + + + \l + + + + + + Thank you for using MiniOS. + Based on Debian GNU/Linux. + Powered by Slax. + + :::: :::: ::::::::::: :::: ::: ::::::::::: :::::::: ::::::::  + +:+:+: :+:+:+ :+: :+:+: :+: :+: :+: :+: :+: :+:  + +:+ +:+:+ +:+ +:+ :+:+:+ +:+ +:+ +:+ +:+ +:+  + +#+ +:+ +#+ +#+ +#+ +:+ +#+ +#+ +#+ +:+ +#++:++#++  + +#+ +#+ +#+ +#+ +#+#+# +#+ +#+ +#+ +#+  + #+# #+# #+# #+# #+#+# #+# #+# #+# #+# #+#  + ### ### ########### ### #### ########### ######## ########  + + User login name set by + cloud-init. You must use + your ssh key to login. + Root login name: root + Password: $ROOT_PASSWORD + + + + + + +EOF +fi + +if [ -f /usr/lib/systemd/system/xorg.service ]; then + cat </usr/lib/systemd/system/xorg.service +[Unit] +Description=X-Window +ConditionKernelCommandLine=!text +After=systemd-user-sessions.service + +[Service] +ExecStart=/bin/su --login -c "/usr/bin/startx -- :0 vt7 -ac -nolisten tcp" $USERNAME +EOF +fi \ No newline at end of file diff --git a/linux-live/basesystem/01-core/rootcopy-install/usr/lib/systemd/system/cmdline-parser.service b/linux-live/basesystem/01-core/rootcopy-install/usr/lib/systemd/system/cmdline-parser.service new file mode 100644 index 0000000..c7ceff1 --- /dev/null +++ b/linux-live/basesystem/01-core/rootcopy-install/usr/lib/systemd/system/cmdline-parser.service @@ -0,0 +1,12 @@ +[Unit] +Description=Сommand line parsing script +Before=ssh-keygen.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/cmdline_parser +RemainAfterExit=true +StandardOutput=journal + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/linux-live/buildconfig b/linux-live/buildconfig index 365bd43..c727e46 100644 --- a/linux-live/buildconfig +++ b/linux-live/buildconfig @@ -6,7 +6,7 @@ DISTRIBUTION_TYPE="debian" # distribution # дистрибутив -DISTRIBUTION="buster" +DISTRIBUTION="bullseye" # distribution arch # note: stretch only works with amd64 @@ -14,7 +14,7 @@ DISTRIBUTION="buster" # для заметки: stretch работает только с amd64 DISTRIBUTION_ARCH="amd64" -COMP_TYPE="zstd" +COMP_TYPE="xz" # bootstrap variant (used to build Ubuntu) # вариант bootstrap (используется для сборки Ubuntu) diff --git a/linux-live/minioslib b/linux-live/minioslib index 9c519a7..8f10c1f 100644 --- a/linux-live/minioslib +++ b/linux-live/minioslib @@ -41,7 +41,7 @@ function common_variables() { elif [ $DISTRIBUTION_ARCH = "i386" ]; then KERNEL_ARCH="686-pae" #KERNEL_ARCH="686" - PACKAGE_VARIANT="minimal" + #PACKAGE_VARIANT="minimal" elif [ $DISTRIBUTION_ARCH = "arm64" ]; then KERNEL_ARCH="arm64" fi @@ -1514,18 +1514,19 @@ function chroot_pkg_install() { function chroot_configure() { current_process - if [ $CLOUD != "true" ]; then - (cd /linux-live/basesystem/01-core/rootcopy-install && cp --parents -afr * /) - echo "Set up password for user 'root'" >>$OUTPUT 2>&1 - echo root:$ROOT_PASSWORD | chpasswd >>$OUTPUT 2>&1 + (cd /linux-live/basesystem/01-core/rootcopy-install && cp --parents -afr * /) + + # if [ $CLOUD != "true" ]; then + # echo "Set up password for user 'root'" >>$OUTPUT 2>&1 + # echo root:$ROOT_PASSWORD | chpasswd >>$OUTPUT 2>&1 - echo "Set up user '$USER_NAME'" >>$OUTPUT 2>&1 - adduser --uid 1000 --gecos '' $USER_NAME --disabled-password >>$OUTPUT 2>&1 - echo "Set up password for user '$USER_NAME'" >>$OUTPUT 2>&1 - echo $USER_NAME:$USER_PASSWORD | chpasswd >>$OUTPUT 2>&1 - usermod -a -G sudo $USER_NAME + # echo "Set up user '$USER_NAME'" >>$OUTPUT 2>&1 + # adduser --uid 1000 --gecos '' $USER_NAME --disabled-password >>$OUTPUT 2>&1 + # echo "Set up password for user '$USER_NAME'" >>$OUTPUT 2>&1 + # echo $USER_NAME:$USER_PASSWORD | chpasswd >>$OUTPUT 2>&1 + # usermod -a -G sudo $USER_NAME - : 'if [ ! -d /home/$USER_NAME ]; then + : 'if [ ! -d /home/$USER_NAME ]; then mkdir -p /home/$USER_NAME fi cp -r /etc/skel/* /home/$USER_NAME @@ -1533,17 +1534,16 @@ function chroot_configure() { chown $USER_NAME:$USER_NAME /home/$USER_NAME chown -R $USER_NAME:$USER_NAME /home/$USER_NAME' - cat </etc/sudoers.d/90-minios -# live user is default user in minios. -# It needs passwordless sudo functionality. -$USER_NAME ALL=(ALL) NOPASSWD:ALL -EOF - else - echo "Set up password for user 'root'" >>$OUTPUT 2>&1 - echo root:$ROOT_PASSWORD | chpasswd >>$OUTPUT 2>&1 - (cd /linux-live/basesystem/01-core/rootcopy-install && cp --parents -afr * /) - rm -rf /home/live - fi + # cat </etc/sudoers.d/90-minios + # live user is default user in minios. + # It needs passwordless sudo functionality. + #$USER_NAME ALL=(ALL) NOPASSWD:ALL + #EOF + # else + # echo "Set up password for user 'root'" >>$OUTPUT 2>&1 + # echo root:$ROOT_PASSWORD | chpasswd >>$OUTPUT 2>&1 + # rm -rf /home/live + # fi if [ ! -d /etc/NetworkManager ]; then echo "Enable dhclient.service autostart." >>$OUTPUT 2>&1 @@ -1608,12 +1608,12 @@ StandardOutput=journal [Install] WantedBy=multi-user.target EOF - if [ $CLOUD != "true" ]; then - sed -i 's,#PermitRootLogin prohibit-password,PermitRootLogin yes,g' /etc/ssh/sshd_config - sed -i 's,#PasswordAuthentication yes,PasswordAuthentication yes,g' /etc/ssh/sshd_config - fi - systemctl enable ssh-keygen >>$OUTPUT 2>&1 - systemctl enable ssh >>$OUTPUT 2>&1 + #if [ $CLOUD != "true" ]; then + # sed -i 's,#PermitRootLogin prohibit-password,PermitRootLogin yes,g' /etc/ssh/sshd_config + # sed -i 's,#PasswordAuthentication yes,PasswordAuthentication yes,g' /etc/ssh/sshd_config + #fi + #systemctl enable ssh-keygen >>$OUTPUT 2>&1 + #systemctl enable ssh >>$OUTPUT 2>&1 fi if [ ! -f /usr/share/sudo ]; then @@ -1632,7 +1632,7 @@ echo "Sudo is not installed. Run the command as root or install sudo." EOF fi - if [ $CLOUD != "true" ]; then +: ' if [ $CLOUD != "true" ]; then cat </etc/issue @@ -1698,7 +1698,7 @@ EOF EOF - fi + fi' } # ================================================================= diff --git a/linux-live/modules/06-virtmanager/install b/linux-live/modules/06-virtmanager/install new file mode 100644 index 0000000..edea612 --- /dev/null +++ b/linux-live/modules/06-virtmanager/install @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e # exit on error +set -o pipefail # exit on pipeline error +set -u # treat unset variable as error + +SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" + +# install packages +$APT_CMD update >>$OUTPUT 2>&1 && + $APT_CMD install $APT_OPTIONS \ + qemu-kvm \ + libvirt-clients \ + libvirt-daemon-system \ + bridge-utils \ + virt-manager \ + gir1.2-spiceclientgtk-3.0 >>$OUTPUT 2>&1 + +usermod -aG libvirt live diff --git a/linux-live/modules/06-virtmanager/postinstall b/linux-live/modules/06-virtmanager/postinstall new file mode 100644 index 0000000..6cc29b5 --- /dev/null +++ b/linux-live/modules/06-virtmanager/postinstall @@ -0,0 +1,4 @@ +#!/bin/bash + +rm -Rf /usr/share/icons/hicolor/256x256 >>$OUTPUT 2>&1 +rm -Rf /usr/share/icons/gnome/256x256 >>$OUTPUT 2>&1 diff --git a/modules/06-virtualbox/install b/modules/06-virtualbox/install new file mode 100644 index 0000000..d9964b0 --- /dev/null +++ b/modules/06-virtualbox/install @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e # exit on error +set -o pipefail # exit on pipeline error +set -u # treat unset variable as error + +SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" + +apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A2F683C52980AECF + +echo "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian $DISTRIBUTION contrib" >/etc/apt/sources.list.d/virtualbox.list + +# install packages +$APT_CMD update >>$OUTPUT 2>&1 && + $APT_CMD install $APT_OPTIONS linux-headers-amd64 gcc make >>$OUTPUT 2>&1 + +# install packages +$APT_CMD install $APT_OPTIONS virtualbox-6.1 >>$OUTPUT 2>&1 diff --git a/modules/06-virtualbox/postinstall b/modules/06-virtualbox/postinstall new file mode 100644 index 0000000..98d2a1c --- /dev/null +++ b/modules/06-virtualbox/postinstall @@ -0,0 +1,6 @@ +#!/bin/bash + +$APT_CMD autoremove $APT_OPTIONS $APT_OPTIONS2 \ + linux-headers-amd64 gcc make >>$OUTPUT 2>&1 + +rm -Rf /usr/share/icons/gnome/256x256 >>$OUTPUT 2>&1 diff --git a/modules/07-vboxextpack/install b/modules/07-vboxextpack/install new file mode 100644 index 0000000..63b76cc --- /dev/null +++ b/modules/07-vboxextpack/install @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e # exit on error +set -o pipefail # exit on pipeline error +set -u # treat unset variable as error + +SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" + +VBoxManage extpack install --replace /Oracle_VM_VirtualBox_Extension_Pack-6.1.28.vbox-extpack \ No newline at end of file diff --git a/modules/07-vboxextpack/postinstall b/modules/07-vboxextpack/postinstall new file mode 100644 index 0000000..059a2af --- /dev/null +++ b/modules/07-vboxextpack/postinstall @@ -0,0 +1,3 @@ +#!/bin/bash + +rm -f /Oracle_VM_VirtualBox_Extension_Pack-6.1.28.vbox-extpack diff --git a/modules/07-vboxextpack/rootcopy-install/Oracle_VM_VirtualBox_Extension_Pack-6.1.28.vbox-extpack b/modules/07-vboxextpack/rootcopy-install/Oracle_VM_VirtualBox_Extension_Pack-6.1.28.vbox-extpack new file mode 100644 index 0000000..acafbca Binary files /dev/null and b/modules/07-vboxextpack/rootcopy-install/Oracle_VM_VirtualBox_Extension_Pack-6.1.28.vbox-extpack differ