11 changed files with 256 additions and 32 deletions
@ -0,0 +1,153 @@ |
|||
#!/bin/bash |
|||
# |
|||
# Сommand line parsing script. |
|||
# Author: crims0n. <http://minios.ru> |
|||
# |
|||
|
|||
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 <<EOF >/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 <<EOF >/etc/issue |
|||
|
|||
|
|||
\l |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Thank you for using MiniOS. |
|||
Based on Debian GNU/Linux. |
|||
Powered by [1;32mSlax[0;29m. |
|||
|
|||
[1;1m:::: :::: ::::::::::: :::: ::: ::::::::::: :::::::: :::::::: [0;29m |
|||
[1;1m+:+:+: :+:+:+ :+: :+:+: :+: :+: :+: :+: :+: :+: [0;29m |
|||
[1;1m+:+ +:+:+ +:+ +:+ :+:+:+ +:+ +:+ +:+ +:+ +:+ [0;29m |
|||
[1;1m+#+ +:+ +#+ +#+ +#+ +:+ +#+ +#+ +#+ +:+ +#++:++#++ [0;29m |
|||
[1;1m+#+ +#+ +#+ +#+ +#+#+# +#+ +#+ +#+ +#+ [0;29m |
|||
[1;1m#+# #+# #+# #+# #+#+# #+# #+# #+# #+# #+# [0;29m |
|||
[1;1m### ### ########### ### #### ########### ######## ######## [0;29m |
|||
|
|||
Root login name: [1;33mroot[0;29m |
|||
Password: [1;33m$ROOT_PASSWORD[0;29m |
|||
User login name: [1;33m$USER_NAME[0;29m |
|||
Password: [1;33m$USER_PASSWORD[0;29m |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
EOF |
|||
else |
|||
cat <<EOF >/etc/issue |
|||
|
|||
|
|||
\l |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Thank you for using MiniOS. |
|||
Based on Debian GNU/Linux. |
|||
Powered by [1;32mSlax[0;29m. |
|||
|
|||
[1;1m:::: :::: ::::::::::: :::: ::: ::::::::::: :::::::: :::::::: [0;29m |
|||
[1;1m+:+:+: :+:+:+ :+: :+:+: :+: :+: :+: :+: :+: :+: [0;29m |
|||
[1;1m+:+ +:+:+ +:+ +:+ :+:+:+ +:+ +:+ +:+ +:+ +:+ [0;29m |
|||
[1;1m+#+ +:+ +#+ +#+ +#+ +:+ +#+ +#+ +#+ +:+ +#++:++#++ [0;29m |
|||
[1;1m+#+ +#+ +#+ +#+ +#+#+# +#+ +#+ +#+ +#+ [0;29m |
|||
[1;1m#+# #+# #+# #+# #+#+# #+# #+# #+# #+# #+# [0;29m |
|||
[1;1m### ### ########### ### #### ########### ######## ######## [0;29m |
|||
|
|||
User login name set by |
|||
cloud-init. You must use |
|||
your ssh key to login. |
|||
Root login name: [1;33mroot[0;29m |
|||
Password: [1;33m$ROOT_PASSWORD[0;29m |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
EOF |
|||
fi |
|||
|
|||
if [ -f /usr/lib/systemd/system/xorg.service ]; then |
|||
cat <<EOF >/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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -0,0 +1,3 @@ |
|||
#!/bin/bash |
|||
|
|||
rm -f /Oracle_VM_VirtualBox_Extension_Pack-6.1.28.vbox-extpack |
Binary file not shown.
Loading…
Reference in new issue