crims0n 4 years ago
parent
commit
58201ca309
  1. 36
      linux-live/basesystem/01-core/rootcopy-install/etc/issue
  2. 1
      linux-live/basesystem/01-core/rootcopy-install/usr/lib/systemd/system/getty@.service
  3. 2
      linux-live/initramfs/init
  4. 1
      linux-live/initramfs/initramfs_create
  5. 161
      linux-live/initramfs/static/cmdline_parser
  6. 142
      linux-live/livekitlib

36
linux-live/basesystem/01-core/rootcopy-install/etc/issue

@ -6,26 +6,22 @@
Thank you for using MiniOS.
Based on Debian GNU/Linux.
Powered by Slax.
:::: :::: ::::::::::: :::: ::: ::::::::::: :::::::: :::::::: 
+:+:+: :+:+:+ :+: :+:+: :+: :+: :+: :+: :+: :+: 
+:+ +:+:+ +:+ +:+ :+:+:+ +:+ +:+ +:+ +:+ +:+ 
+#+ +:+ +#+ +#+ +#+ +:+ +#+ +#+ +#+ +:+ +#++:++#++ 
+#+ +#+ +#+ +#+ +#+#+# +#+ +#+ +#+ +#+ 
#+# #+# #+# #+# #+#+# #+# #+# #+# #+# #+# 
### ### ########### ### #### ########### ######## ######## 
: :
: Root login name: root :
: Password: toor :
: User login name: live :
: Password: evil :
Thank you for using MiniOS.
Based on Debian GNU/Linux.
Powered by Slax.
:::: :::: ::::::::::: :::: ::: ::::::::::: :::::::: :::::::: 
+:+:+: :+:+:+ :+: :+:+: :+: :+: :+: :+: :+: :+: 
+:+ +:+:+ +:+ +:+ :+:+:+ +:+ +:+ +:+ +:+ +:+ 
+#+ +:+ +#+ +#+ +#+ +:+ +#+ +#+ +#+ +:+ +#++:++#++ 
+#+ +#+ +#+ +#+ +#+#+# +#+ +#+ +#+ +#+ 
#+# #+# #+# #+# #+#+# #+# #+# #+# #+# #+# 
### ### ########### ### #### ########### ######## ######## 
Root login name: root
Password: toor
User login name: live
Password: evil

1
linux-live/basesystem/01-core/rootcopy-install/usr/lib/systemd/system/getty@.service

@ -11,7 +11,6 @@ Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=http://0pointer.de/blog/projects/serial-console.html
After=systemd-user-sessions.service plymouth-quit-wait.service
After=rc-local.service
After=cmdline-parser.service
# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though

2
linux-live/initramfs/init

@ -56,7 +56,7 @@ copy_rootcopy_content "$DATA" "$UNION"
# configure
minios_configure "$UNION"
debug_shell
debug_shell
# create fstab
fstab_create "$UNION" "$DATAMNT"
debug_shell

1
linux-live/initramfs/initramfs_create

@ -53,6 +53,7 @@ cp static/mount.dynfilefs $INITRAMFS/bin/@mount.dynfilefs
cp static/mount.httpfs2 $INITRAMFS/bin/@mount.httpfs2
cp static/mount.ntfs-3g $INITRAMFS/bin/@mount.ntfs-3g
cp static/blkid $INITRAMFS/bin
cp static/cmdline_parser $INITRAMFS/bin
chmod a+x $INITRAMFS/bin/*
$INITRAMFS/bin/busybox | grep , | grep -v Copyright | tr "," " " | while read LINE; do

161
linux-live/initramfs/static/cmdline_parser

@ -0,0 +1,161 @@
#!/bin/bash
#
# Сommand line parsing script.
# Author: crims0n. <http://minios.ru>
#
for i in $(cat /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
echo "USER_NAME=$USER_NAME"
echo "USER_PASSWORD=$USER_PASSWORD"
echo "ROOT_PASSWORD=$ROOT_PASSWORD"
echo "SSH=$SSH"
echo "CLOUD=$CLOUD"
sleep 5
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
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
if [ "$SSH" = "true" ]; then
systemctl enable ssh-keygen
systemctl enable ssh
else
systemctl disable ssh-keygen
systemctl disable ssh
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 Slax.
:::: :::: ::::::::::: :::: ::: ::::::::::: :::::::: :::::::: 
+:+:+: :+:+:+ :+: :+:+: :+: :+: :+: :+: :+: :+: 
+:+ +:+:+ +:+ +:+ :+:+:+ +:+ +:+ +:+ +:+ +:+ 
+#+ +:+ +#+ +#+ +#+ +:+ +#+ +#+ +#+ +:+ +#++:++#++ 
+#+ +#+ +#+ +#+ +#+#+# +#+ +#+ +#+ +#+ 
#+# #+# #+# #+# #+#+# #+# #+# #+# #+# #+# 
### ### ########### ### #### ########### ######## ######## 
Root login name: root
Password: $ROOT_PASSWORD
User login name: $USER_NAME
Password: $USER_PASSWORD
EOF
else
cat <<EOF >/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 <<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

142
linux-live/livekitlib

@ -779,143 +779,15 @@ fstab_create() {
minios_configure() {
debug_log "minios_configure" "$*"
USER_NAME=$(cmdline_value user_name)
USER_PASSWORD=$(cmdline_value user_password)
ROOT_PASSWORD=$(cmdline_value root_password)
cp /bin/cmdline_parser $1/
cat /proc/cmdline >$1/cmdline
ls -la $1/
sleep 5
if grep -vq ssh /proc/cmdline; then
SSH="true"
fi
if grep -vq cloud /proc/cmdline; then
CLOUD="true"
fi
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'"
chroot $1 /bin/bash -c "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'"
chroot $1 /bin/bash -c "echo $USER_NAME:$USER_PASSWORD | chpasswd"
chroot $1 /bin/bash -c "usermod -a -G sudo $USER_NAME"
chroot $1 /bin/bash -c "sed -i 's,#PermitRootLogin prohibit-password,PermitRootLogin yes,g' /etc/ssh/sshd_config"
chroot $1 /bin/bash -c "sed -i 's,#PasswordAuthentication yes,PasswordAuthentication yes,g' /etc/ssh/sshd_config"
else
chroot $1 /bin/bash -c "rm -rf /home/live"
fi
if [ "$SSH" = "true" ]; then
sleep 3
chroot $1 /bin/bash -c "systemctl enable ssh-keygen"
echo "ssh-keygen is enabled"
sleep 3
chroot $1 /bin/bash -c "systemctl enable ssh"
echo "ssh is enabled"
sleep 3
else
chroot $1 /bin/bash -c "systemctl disable ssh-keygen"
chroot $1 /bin/bash -c "systemctl disable ssh"
fi
cat <<EOF >$1/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 >$1/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 <<EOF >$1/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 $1/usr/lib/systemd/system/xorg.service ]; then
cat <<EOF >$1/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
chroot $1 /bin/bash -c "/cmdline_parser"
rm -f $1/cmdline
rm -f $1/cmdline_parser
}
# Change root and execute init

Loading…
Cancel
Save