diff --git a/linux-live/buildconfig b/linux-live/buildconfig index 7316b36..f455b4e 100644 --- a/linux-live/buildconfig +++ b/linux-live/buildconfig @@ -10,7 +10,7 @@ OUTPUT="/dev/stdout" # если ="1", создаёт второй iso с постоянным именем файла BUILD_TEST_ISO="1" -# удаляет старые файлы iso для данного типа сборки +# удаляет старые файлы iso для данного типа сборки REMOVE_OLD_ISO="0" # if = "1", creates a copy of minios-live in chroot /opt @@ -29,6 +29,6 @@ APT_CMD="apt-get" APT_OPTIONS="-y" #--no-install-recommends" #LIVE_TYPE="casper" -LIVE_TYPE="casper" +LIVE_TYPE="livekit" -INSTALL_OPTIONAL="1" \ No newline at end of file +INSTALL_OPTIONAL="1" diff --git a/linux-live/casper/core/install b/linux-live/casper/core/install new file mode 100644 index 0000000..52a2330 --- /dev/null +++ b/linux-live/casper/core/install @@ -0,0 +1,16 @@ +#!/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 +if [ -f $SCRIPT_DIR/package.list ]; then + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update >>$OUTPUT 2>&1 && + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/package.list | tr "\n" " ") >>$OUTPUT 2>&1 +fi diff --git a/linux-live/casper/core/package.list b/linux-live/casper/core/package.list new file mode 100644 index 0000000..2cfff7d --- /dev/null +++ b/linux-live/casper/core/package.list @@ -0,0 +1,2 @@ +casper +lupin-casper \ No newline at end of file diff --git a/linux-live/casper/core/postinstall b/linux-live/casper/core/postinstall new file mode 100644 index 0000000..68a7192 --- /dev/null +++ b/linux-live/casper/core/postinstall @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ -f /usr/share/xfce4/backdrops/xubuntu-wallpaper.png ]; then + rm /usr/share/xfce4/backdrops/xubuntu-wallpaper.png +fi +if [ ! -d /usr/share/xfce4/backdrops ]; then + mkdir -p /usr/share/xfce4/backdrops +fi +ln -s /usr/share/backgrounds/MiniOS.png /usr/share/xfce4/backdrops/xubuntu-wallpaper.png diff --git a/linux-live/casper/core/rootcopy/etc/casper.conf b/linux-live/casper/core/rootcopy/etc/casper.conf new file mode 100644 index 0000000..ae7dde1 --- /dev/null +++ b/linux-live/casper/core/rootcopy/etc/casper.conf @@ -0,0 +1,14 @@ +# This file should go in /etc/casper.conf +# Supported variables are: +# USERNAME, USERFULLNAME, HOST, BUILD_SYSTEM, FLAVOUR + +export USERNAME="live" +export USERFULLNAME="Live session user" +export HOST="minios" +export BUILD_SYSTEM="Ubuntu" + +# USERNAME and HOSTNAME as specified above won't be honoured and will be set to +# flavour string acquired at boot time, unless you set FLAVOUR to any +# non-empty string. + +# export FLAVOUR="Ubuntu" diff --git a/linux-live/casper/core/rootcopy/etc/skel/.cts/settings.conf b/linux-live/casper/core/rootcopy/etc/skel/.cts/settings.conf new file mode 100644 index 0000000..921a74b --- /dev/null +++ b/linux-live/casper/core/rootcopy/etc/skel/.cts/settings.conf @@ -0,0 +1,4 @@ +[settings] +auto_connect=false +auto_disconnect=true +minimize_on_start=true diff --git a/linux-live/casper/gui/install b/linux-live/casper/gui/install new file mode 100644 index 0000000..52a2330 --- /dev/null +++ b/linux-live/casper/gui/install @@ -0,0 +1,16 @@ +#!/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 +if [ -f $SCRIPT_DIR/package.list ]; then + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update >>$OUTPUT 2>&1 && + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/package.list | tr "\n" " ") >>$OUTPUT 2>&1 +fi diff --git a/linux-live/pkglists/ubuntu-ubiquity.list b/linux-live/casper/gui/package.list similarity index 100% rename from linux-live/pkglists/ubuntu-ubiquity.list rename to linux-live/casper/gui/package.list diff --git a/linux-live/casper/gui/postinstall b/linux-live/casper/gui/postinstall new file mode 100644 index 0000000..52fbf87 --- /dev/null +++ b/linux-live/casper/gui/postinstall @@ -0,0 +1,41 @@ +#!/bin/bash + +if [ -d /etc/lightdm ]; then + cat </etc/lightdm/lightdm.conf +[Seat:*] +autologin-session=xubuntu +autologin-user=live +autologin-user-timeout=0 +EOF +fi +if [ -d /etc/NetworkManager ]; then + echo "Disable dhclient.service autostart." + systemctl disable dhclient + mkdir -p /etc/netplan + cat </etc/netplan/01-netcfg.yaml +# This file describes the network interfaces available on your system +# For more information, see netplan(5). +# Set and change netplan renderer to NetworkManager GUI tool +network: + version: 2 + renderer: NetworkManager +EOF + cat </etc/NetworkManager/NetworkManager.conf +[main] +rc-manager=resolvconf +plugins=ifupdown,keyfile +dns=dnsmasq +[ifupdown] +managed=false +EOF + + dpkg-reconfigure -f noninteractive network-manager +fi + +if [ -f /usr/share/xfce4/backdrops/xubuntu-wallpaper.png ]; then + rm /usr/share/xfce4/backdrops/xubuntu-wallpaper.png +fi +if [ ! -d /usr/share/xfce4/backdrops ]; then + mkdir -p /usr/share/xfce4/backdrops +fi +ln -s /usr/share/backgrounds/MiniOS.png /usr/share/xfce4/backdrops/xubuntu-wallpaper.png diff --git a/linux-live/livekit/core/install b/linux-live/livekit/core/install new file mode 100644 index 0000000..52a2330 --- /dev/null +++ b/linux-live/livekit/core/install @@ -0,0 +1,16 @@ +#!/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 +if [ -f $SCRIPT_DIR/package.list ]; then + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update >>$OUTPUT 2>&1 && + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/package.list | tr "\n" " ") >>$OUTPUT 2>&1 +fi diff --git a/linux-live/livekit/core/package.list b/linux-live/livekit/core/package.list new file mode 100644 index 0000000..e69de29 diff --git a/linux-live/livekit/core/postinstall b/linux-live/livekit/core/postinstall new file mode 100644 index 0000000..52fbf87 --- /dev/null +++ b/linux-live/livekit/core/postinstall @@ -0,0 +1,41 @@ +#!/bin/bash + +if [ -d /etc/lightdm ]; then + cat </etc/lightdm/lightdm.conf +[Seat:*] +autologin-session=xubuntu +autologin-user=live +autologin-user-timeout=0 +EOF +fi +if [ -d /etc/NetworkManager ]; then + echo "Disable dhclient.service autostart." + systemctl disable dhclient + mkdir -p /etc/netplan + cat </etc/netplan/01-netcfg.yaml +# This file describes the network interfaces available on your system +# For more information, see netplan(5). +# Set and change netplan renderer to NetworkManager GUI tool +network: + version: 2 + renderer: NetworkManager +EOF + cat </etc/NetworkManager/NetworkManager.conf +[main] +rc-manager=resolvconf +plugins=ifupdown,keyfile +dns=dnsmasq +[ifupdown] +managed=false +EOF + + dpkg-reconfigure -f noninteractive network-manager +fi + +if [ -f /usr/share/xfce4/backdrops/xubuntu-wallpaper.png ]; then + rm /usr/share/xfce4/backdrops/xubuntu-wallpaper.png +fi +if [ ! -d /usr/share/xfce4/backdrops ]; then + mkdir -p /usr/share/xfce4/backdrops +fi +ln -s /usr/share/backgrounds/MiniOS.png /usr/share/xfce4/backdrops/xubuntu-wallpaper.png diff --git a/linux-live/livekit/core/rootcopy/etc/hostname b/linux-live/livekit/core/rootcopy/etc/hostname new file mode 100644 index 0000000..42942a9 --- /dev/null +++ b/linux-live/livekit/core/rootcopy/etc/hostname @@ -0,0 +1 @@ +minios diff --git a/linux-live/livekit/core/rootcopy/etc/hosts b/linux-live/livekit/core/rootcopy/etc/hosts new file mode 100644 index 0000000..892092a --- /dev/null +++ b/linux-live/livekit/core/rootcopy/etc/hosts @@ -0,0 +1,7 @@ +127.0.0.1 localhost +127.0.1.1 minios + +# The following lines are desirable for IPv6 capable hosts +::1 localhost ip6-localhost ip6-loopback +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters diff --git a/linux-live/livekit/core/rootcopy/etc/localtime b/linux-live/livekit/core/rootcopy/etc/localtime new file mode 100644 index 0000000..bca5165 --- /dev/null +++ b/linux-live/livekit/core/rootcopy/etc/localtime @@ -0,0 +1 @@ +/usr/share/zoneinfo/Europe/Moscow \ No newline at end of file diff --git a/linux-live/livekit/core/rootcopy/etc/ssh/sshd_config.d/90-minios.conf b/linux-live/livekit/core/rootcopy/etc/ssh/sshd_config.d/90-minios.conf new file mode 100644 index 0000000..33d8862 --- /dev/null +++ b/linux-live/livekit/core/rootcopy/etc/ssh/sshd_config.d/90-minios.conf @@ -0,0 +1,2 @@ +PermitRootLogin yes +PasswordAuthentication yes \ No newline at end of file diff --git a/linux-live/livekit/core/rootcopy/usr/bin/dir2sb b/linux-live/livekit/core/rootcopy/usr/bin/dir2sb new file mode 100755 index 0000000..3ddd64d --- /dev/null +++ b/linux-live/livekit/core/rootcopy/usr/bin/dir2sb @@ -0,0 +1,58 @@ +#!/bin/bash +# Author: Tomas M. + +usage() +{ + echo "" + echo "Convert directory to .sb compressed module" + echo "Usage: $0 [source_directory.sb] [[target_file.sb]]" + echo " If source_directory does not have .sb suffix and it is not 'squashfs-root'," + echo " then the source_directory itself is included in the module and" + echo " then the target_file.sb parameter is required." + echo " If target_file.sb is not specified, the source_directory is erased" + echo " and replaced by the newly generated module file." +} + +P1="$(readlink -f "$1")" +P2="$(readlink -f "$2")" + +if [ "$P1" = "$P2" ]; then + P2="" +fi + +SB=$(echo "$P1" | grep -o "[.]sb/*\$") +if [ "$(echo "$P1" | grep -o "/squashfs-root/*\$")" != "" ]; then + SB="true" +fi + +if [ "$SB" = "" ]; then + KEEP="-keep-as-directory" + if [ "$P2" = "" ]; then + usage + exit 1 + fi +else + KEEP="" +fi + +if [ ! -d "$P1" ]; then + echo "Not a directory: $P1" >&2 + exit 2 +fi + + +if [ "$P2" = "" ]; then + TARGET="$P1".sb + while [ -e "$TARGET" ]; do TARGET="$TARGET"x; done + mksquashfs "$P1" "$TARGET" -comp xz -b 1024K -always-use-fragments $KEEP >/dev/null || exit 3 + umount "$P1" 2>/dev/null + rm -Rf "$P1" + mv "$TARGET" "$P1" +else + if [ -e "$P2" ]; then + echo "Target exists: $P2" >&2 + exit 4 + fi + + mksquashfs "$P1" "$P2" -comp xz -b 1024K -always-use-fragments $KEEP >/dev/null +fi diff --git a/linux-live/livekit/core/rootcopy/usr/bin/pxe b/linux-live/livekit/core/rootcopy/usr/bin/pxe new file mode 100755 index 0000000..3aaff4e --- /dev/null +++ b/linux-live/livekit/core/rootcopy/usr/bin/pxe @@ -0,0 +1,86 @@ +#!/bin/bash +# Rebuild initial ramdisk with full network drivers, +# start DHCP and TFTP server in order to provide PXE service +# +# Author: Tomas M + +LIVE=/run/initramfs +FTPROOT=/var/state/dnsmasq/root + +# find out our own IP address. If more interfaces are available, use the first one +IP="$(hostname -I | cut -d " " -f 1)" +GW=$(ip route show | grep default | grep -o "via.*" | head -n 1 | cut -d " " -f 2) + +# if no IP is assigned to this computer, setup private address randomly +if [ "$IP" = "" ]; then + killall dhclient 2>/dev/null + IP="10."$(($RANDOM/130+1))"."$(($RANDOM/130+1))".1" + ifconfig $(ls -1 /sys/class/net | egrep -v '^lo$' | sort | head -n 1) $IP netmask 255.255.255.0 +fi + +# if gateway is not recognized, lets make our IP a gateway and enable forwarding +if [ "$GW" = "" ]; then + GW="$IP" + echo 1 > /proc/sys/net/ipv4/conf/all/forwarding + echo 1 > /proc/sys/net/ipv6/conf/all/forwarding +fi + +echo Starting PXE server on $IP ... + +# calculate C class range +RANGE=$(echo $IP | cut -d "." -f 1-3) + +# make sure dnsmasq can be started +killall dnsmasq 2>/dev/null +killall busybox 2>/dev/null +rm -Rf $FTPROOT 2>/dev/null +mkdir -p $FTPROOT/{pxelinux.cfg,tmp}/ + +# create root filesystem for ftfp +cd $LIVE +( find . -print | grep -v "memory" + cd / + find /lib/modules/$(uname -r)/kernel/drivers/net | grep -v wireless +) | cpio -pvd $FTPROOT/tmp 2>/dev/null + +cp /lib/modules/$(uname -r)/modules.* $FTPROOT/tmp/lib/modules/$(uname -r) +depmod -b $FTPROOT/tmp +rm $FTPROOT/tmp/lib/initramfs_escaped + +# pack root in initramfs +cd $FTPROOT/tmp +find . -print | cpio -o -H newc 2>/dev/null | gzip -f --fast >../initrfs.img +cd .. +rm -Rf tmp + +# link files here since copying is not necessary +ln -s $(find $LIVE/memory/{data,iso,toram} 2>/dev/null | grep vmlinuz | head -n 1) $FTPROOT/vmlinuz +ln -s $(find $LIVE/memory/{data,iso,toram} 2>/dev/null | grep pxelinux.0 | head -n 1) $FTPROOT/pxelinux.0 +ln -s $(find $LIVE/memory/{data,iso,toram} 2>/dev/null | grep ldlinux.c32 | head -n 1) $FTPROOT/ldlinux.c32 + +find $LIVE/memory/{data,iso,toram} 2>/dev/null | egrep "[.]sb\$" | sort -n | while read LINE; do + BAS="$(basename "$LINE")" + ln -s $LINE "$FTPROOT/$BAS" + echo $BAS >> "$FTPROOT/PXEFILELIST" +done + +echo "This is Slax PXE data server. PXE clients will download file list" > "$FTPROOT/index.html" + +# default pxelinux configuration. Keep xmode selection for clients the same like for the server +echo " +PROMPT 0 +DEFAULT slax +LABEL slax +KERNEL /vmlinuz +IPAPPEND 1 +APPEND initrd=/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 $(cat /proc/cmdline | egrep -o 'slax.flags=[^ ]+' | sed -r 's:[,=]pxe::' | sed -r 's:[,=]toram::') +" > $FTPROOT/pxelinux.cfg/default + +# start the DHCP server and TFTP server +dnsmasq --enable-tftp --tftp-root=/var/state/dnsmasq/root \ +--dhcp-boot=pxelinux.0,"$IP",$IP \ +--dhcp-option=3,$GW \ +--dhcp-range=$RANGE.2,$RANGE.250,infinite --log-dhcp + +# start HTTP server at port 7529 (that are the numbers you type on your phone to write 'slax') +busybox httpd -p 7529 -h /var/state/dnsmasq/root diff --git a/linux-live/livekit/core/rootcopy/usr/bin/rmsbdir b/linux-live/livekit/core/rootcopy/usr/bin/rmsbdir new file mode 100755 index 0000000..42cb449 --- /dev/null +++ b/linux-live/livekit/core/rootcopy/usr/bin/rmsbdir @@ -0,0 +1,17 @@ +#!/bin/bash +# Author: Tomas M. + +if [ ! -e "$1" ]; then + echo + echo "Erase module directory created by sb2dir" + echo "Usage: $0 [source_directory.sb]" + exit 1 +fi + +if [ ! -d "$1" ]; then + echo "Directory does not exist: $1" >&2 + exit +fi + +umount "$1" 2>/dev/null +rm -Rf "$1" diff --git a/linux-live/livekit/core/rootcopy/usr/bin/savechanges b/linux-live/livekit/core/rootcopy/usr/bin/savechanges new file mode 100755 index 0000000..48e9c9e --- /dev/null +++ b/linux-live/livekit/core/rootcopy/usr/bin/savechanges @@ -0,0 +1,46 @@ +#!/bin/bash + +TMP=/tmp/changes$$ +EXCLUDE="^\$|/\$|[.]wh[.][.]wh[.]orph/|^[.]wh[.][.]wh[.]plnk/|^[.]wh[.][.]wh[.]aufs|^var/cache/|^var/backups/|^var/tmp/|^var/log/|^var/lib/apt/|^var/lib/dhcp/|^var/lib/systemd/|^sbin/fsck[.]aufs|^etc/resolv[.]conf|^root/[.]Xauthority|^root/[.]xsession-errors|^root/[.]fehbg|^root/[.]fluxbox/lastwallpaper|^root/[.]fluxbox/menu_resolution|^etc/mtab|^etc/fstab|^boot/|^dev/|^mnt/|^proc/|^run/|^sys/|^tmp/" +CHANGES=/run/initramfs/memory/changes + +if [ "$1" = "" ]; then + echo "" + echo "savechanges - save all changed files in a compressed filesystem bundle" + echo " - excluding some predefined files such as /etc/mtab," + echo " temp & log files, empty directories, apt cache, and such" + echo "" + echo "Usage:" + echo " $0 [ target_file.sb ] [ changes_directory ]" + echo "" + echo "If changes_directory is not specified, /run/initramfs/memory/changes is used." + echo "" + exit 1 +fi + +if [ ! "$2" = "" ]; then + CHANGES="$2" +fi + +# exclude the save_file itself of course +EXCLUDE="$EXCLUDE|^""$(readlink -f "$1" | cut -b 2- | sed -r "s/[.]/[.]/")""\$" + +CWD=$(pwd) + +cd $CHANGES || exit + +mkdir -p $TMP +mount -t tmpfs tmpfs $TMP + +find \( -type d -printf "%p/\n" , -not -type d -print \) \ + | sed -r "s/^[.]\\///" | egrep -v "$EXCLUDE" \ + | while read FILE; do + cp --parents -afr "$FILE" "$TMP" +done + +cd $CWD + +mksquashfs $TMP "$1" -comp xz -b 1024K -always-use-fragments -noappend + +umount $TMP +rmdir $TMP diff --git a/linux-live/livekit/core/rootcopy/usr/bin/sb b/linux-live/livekit/core/rootcopy/usr/bin/sb new file mode 100755 index 0000000..5346f44 --- /dev/null +++ b/linux-live/livekit/core/rootcopy/usr/bin/sb @@ -0,0 +1,29 @@ +#!/bin/bash + +if [ "$1" = "rm" ]; then + shift + rmsbdir "$@" + exit $? +fi + +if [ "$1" = "rmdir" ]; then + shift + rmsbdir "$@" + exit $? +fi + +if [ "$1" = "conv" ]; then + shift +fi + +if [ ! -r "$1" ]; then + echo File not found "$1" + exit 1 +fi + +if [ -d "$1" ]; then + dir2sb "$@" + exit $? +fi + +sb2dir "$@" diff --git a/linux-live/livekit/core/rootcopy/usr/bin/sb2dir b/linux-live/livekit/core/rootcopy/usr/bin/sb2dir new file mode 100755 index 0000000..4f580ec --- /dev/null +++ b/linux-live/livekit/core/rootcopy/usr/bin/sb2dir @@ -0,0 +1,33 @@ +#!/bin/bash +# Author: Tomas M. + +if [ ! -e "$1" ]; then + echo + echo "Convert .sb compressed module into directory with the same name" + echo "Usage: $0 [source_file.sb] [[optional output_directory]]" + echo " If the output_directory is specified, it must exist" + echo " If the output_directory is not specified, the name source_file.sb" + echo " is used and the directory is overmounted with tmpfs" + exit 1 +fi + +if [ ! -r "$1" ]; then + echo "File does not exist: $1" >&2 + exit +fi + +if [ "$2" = "" ]; then + SOURCE="$1".x + while [ -e "$SOURCE" ]; do SOURCE="$SOURCE"x; done + mv "$1" "$SOURCE" || exit + mkdir "$1" + mount -t tmpfs tmpfs "$1" + unsquashfs -f -dest "$1" "$SOURCE" >/dev/null || exit + rm "$SOURCE" +else + if [ ! -d "$2" ]; then + echo "Directory does not exist: $2" >&2 + exit + fi + unsquashfs -f -dest "$2" "$1" >/dev/null +fi diff --git a/linux-live/livekit/core/rootcopy/usr/bin/slax b/linux-live/livekit/core/rootcopy/usr/bin/slax new file mode 100755 index 0000000..a8843ad --- /dev/null +++ b/linux-live/livekit/core/rootcopy/usr/bin/slax @@ -0,0 +1,178 @@ +#!/bin/bash +# Slax management and control script +# Author: Tomas M + +# activate +# deactivate +# list + + +LIVE=/run/initramfs/memory +RAMSTORE=$LIVE/modules + +# Print error message and exit +# $1 = error message +# +die() +{ + echo "$1" >&2 + exit 1 +} + + +print_branches() +{ + local SI BUNDLE LOOP CWD + + SI="/sys/fs/aufs/$(cat /proc/mounts | grep 'aufs / aufs' | egrep -o 'si=([^,) ]+)' | tr = _)" + CWD="$(pwd)" + cd "$SI" + ls -v1 | grep -v xi_path | egrep 'br[0-9]+' | xargs cat | grep memory/bundles | rev | cut -b 4- | rev | while read BUNDLE; do + if mountpoint -q "$BUNDLE"; then + LOOP=$(cat /proc/mounts | fgrep " $BUNDLE squashfs" | cut -d " " -f 1) + echo -n "$BUNDLE" + echo -ne "\t" + losetup $LOOP | sed -r "s:.*[(]|[)].*::g" + fi + done | tac + cd "$CWD" +} + + +# Activate Slax Bundle +# $1 = file to activate +# +activate() +{ + local SB TGT BAS + + SB="$(readlink -f "$1")" + BAS="$(basename "$SB")" + + # check if file exists + if [ ! -r "$SB" ]; then + usage + die "file not found $SB" + fi + + # check if the file is part of aufs union, if yes we need to copy it outside + if df "$SB" | cut -d " " -f 1 | grep -q aufs; then + TGT="$RAMSTORE" + mkdir -p "$TGT" + if [ -r $TGT/$BAS ]; then die "File exists: $TGT/$BAS"; fi + cp -n "$SB" "$TGT/$BAS" + if [ $? -ne 0 ]; then die "Error copying file to $TGT/$BAS. Not enough free RAM or disk space?"; fi + SB="$TGT/$BAS" + fi + + # check if this particular file is already activated + if print_branches | cut -f 2 | fgrep -q "$SB"; then + exit + fi + + # mount remount,add + TGT="$LIVE/bundles/$BAS" + mkdir -p "$TGT" + + mount -n -o loop,ro "$SB" "$TGT" + if [ $? -ne 0 ]; then + die "Error mounting $SB to $TGT, perhaps corrupted download" + fi + + # add current branch to aufs union + mount -t aufs -o remount,add:1:"$TGT" aufs / + if [ $? -ne 0 ]; then + umount "$TGT" + rmdir "$TGT" + die "Error attaching bundle filesystem to Slax" + fi + + echo "Slax Bundle activated: $BAS" +} + + +# Deactivate Slax bundle of the given name +# $1 = path to bundle file, or its name +# +deactivate() +{ + local BUNDLES SB MATCH LOOP LOOPFILE + + BUNDLES=$LIVE/bundles + MODULES=$LIVE/modules + SB="$(basename "$1")" + + rmdir "$BUNDLES/$SB" 2>/dev/null # this fails unless the dir is + rmdir "$BUNDLES/$SB.sb" 2>/dev/null # forgotten there empty. It's safe this way + + if [ ! -d "$BUNDLES/$SB" ]; then + # we don't have real filename match, lets try to add .sb extension + if [ ! -d "$BUNDLES/$SB.sb" ]; then + # no, still no match. Lets use some guesswork + SB=$(print_branches | cut -f 2 | egrep -o "/[0-9]+-$SB.sb\$" | tail -n 1 | xargs -r basename) + else + SB="$SB.sb" + fi + fi + + if [ "$SB" = "" -o ! -d "$BUNDLES/$SB" ]; then + die "can't find active slax bundle $1" + fi + + echo "Attempting to deactivate Slax bundle $SB..." + mount -t aufs -o remount,verbose,del:"$BUNDLES/$SB" aufs / 2>/dev/null + if [ $? -ne 0 ]; then + die "Unable to deactivate Slax Bundle - still in use. See dmesg for more." + fi + + # remember what loop device was the bundle mounted to, it may be needed later + LOOP="$(cat /proc/mounts | fgrep " $BUNDLES/$SB " | cut -d " " -f 1)" + LOOPFILE="$(losetup "$LOOP" | cut -d " " -f 3 | sed -r 's:^.|.$::g')" + + umount "$BUNDLES/$SB" 2>/dev/null + if [ $? -ne 0 ]; then + die "Unable to umount Slax bundle loop-mount $BUNDLES/$SB" + fi + rmdir "$BUNDLES/$SB" + + # free the loop device manually since umount fails to do that if the bundle was activated on boot + losetup -d "$LOOP" 2>/dev/null + + if echo "$LOOPFILE" | grep -q $RAMSTORE; then + rm -f $LOOPFILE + fi + + echo "Slax Bundle deactivated: $SB" +} + + +usage() +{ + echo "Usage: $0 [ activate | deactivate | list ] [ file.sb ]" >&2 + if [ "$1" != "" ]; then + echo "$1" >&2 + fi +} + + +if [ "$1" = "" ]; then + usage + die +fi + +if [ "$1" = "activate" ]; then + activate "$2" +fi + +if [ "$1" = "deactivate" ]; then + deactivate "$2" +fi + +if [ "$1" = "list" ]; then + print_branches +fi + +if [ "$1" = "savechanges" ]; then + shift + savechanges "$@" +fi diff --git a/linux-live/livekit/core/rootcopy/usr/lib/systemd/system/apparmor.service b/linux-live/livekit/core/rootcopy/usr/lib/systemd/system/apparmor.service new file mode 100644 index 0000000..a2df76a --- /dev/null +++ b/linux-live/livekit/core/rootcopy/usr/lib/systemd/system/apparmor.service @@ -0,0 +1,38 @@ +[Unit] +Description=Load AppArmor profiles +DefaultDependencies=no +Before=sysinit.target +After=local-fs.target +After=systemd-journald-audit.socket +RequiresMountsFor=/var/cache/apparmor +AssertPathIsReadWrite=/sys/kernel/security/apparmor/.load +ConditionSecurity=apparmor +Documentation=man:apparmor(7) +Documentation=https://gitlab.com/apparmor/apparmor/wikis/home/ + +# Don't start this unit on the Ubuntu Live CD +ConditionPathExists=!/rofs/etc/apparmor.d + +# Don't start this unit on the Debian Live CD when using overlayfs +ConditionPathExists=!/run/live/overlay/work + +# Don't start this unit on Slax Live CD +ConditionPathExists=!/run/initramfs/lib/livekitlib + +[Service] +Type=oneshot +ExecStart=/lib/apparmor/apparmor.systemd reload +ExecReload=/lib/apparmor/apparmor.systemd reload + +# systemd maps 'restart' to 'stop; start' which means removing AppArmor confinement +# from running processes (and not being able to re-apply it later). +# Upstream systemd developers refused to implement an option that allows overriding +# this behaviour, therefore we have to make ExecStop a no-op to error out on the +# safe side. +# +# If you really want to unload all AppArmor profiles, run aa-teardown +ExecStop=/bin/true +RemainAfterExit=yes + +[Install] +WantedBy=sysinit.target diff --git a/linux-live/livekit/core/rootcopy/usr/lib/systemd/system/dhclient.service b/linux-live/livekit/core/rootcopy/usr/lib/systemd/system/dhclient.service new file mode 100644 index 0000000..2c92a32 --- /dev/null +++ b/linux-live/livekit/core/rootcopy/usr/lib/systemd/system/dhclient.service @@ -0,0 +1,16 @@ +[Unit] +Description=DHCP Client +Documentation=man:dhclient(8) +Wants=network.target +After=network-pre.target systemd-sysctl.service systemd-modules-load.service +Before=network.target shutdown.target network-online.target +ConditionPathExists=!/run/initramfs/net.up.flag + +[Service] +Type=forking +ExecStart=-/bin/sh -c 'udevadm settle && dhclient -nw' +PIDFile=/run/dhclient.pid + +[Install] +WantedBy=multi-user.target +WantedBy=network-online.target diff --git a/linux-live/livekit/core/rootcopy/usr/lib/systemd/system/getty@.service b/linux-live/livekit/core/rootcopy/usr/lib/systemd/system/getty@.service new file mode 100644 index 0000000..3a805ae --- /dev/null +++ b/linux-live/livekit/core/rootcopy/usr/lib/systemd/system/getty@.service @@ -0,0 +1,54 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +[Unit] +Description=Getty on %I +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 + +# If additional gettys are spawned during boot then we should make +# sure that this is synchronized before getty.target, even though +# getty.target didn't actually pull it in. +Before=getty.target +IgnoreOnIsolate=yes + +# IgnoreOnIsolate causes issues with sulogin, if someone isolates +# rescue.target or starts rescue.service from multi-user.target or +# graphical.target. +Conflicts=rescue.service +Before=rescue.service + +# On systems without virtual consoles, don't start any getty. Note +# that serial gettys are covered by serial-getty@.service, not this +# unit. +ConditionPathExists=/dev/tty0 + +[Service] +# the VT is cleared by TTYVTDisallocate +ExecStart=-/sbin/agetty --noclear %I $TERM +Type=idle +Restart=always +RestartSec=0 +UtmpIdentifier=%I +TTYPath=/dev/%I +TTYReset=yes +TTYVHangup=yes +#TM do not clear VT: +TTYVTDisallocate=no +KillMode=process +IgnoreSIGPIPE=no +SendSIGHUP=yes + +# Unset locale for the console getty since the console has problems +# displaying some internationalized messages. +Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION= + +[Install] +WantedBy=getty.target +DefaultInstance=tty1 diff --git a/linux-live/livekit/core/rootcopy/usr/lib/udev/rules.d/90-slax-automount.rules b/linux-live/livekit/core/rootcopy/usr/lib/udev/rules.d/90-slax-automount.rules new file mode 100644 index 0000000..b704f35 --- /dev/null +++ b/linux-live/livekit/core/rootcopy/usr/lib/udev/rules.d/90-slax-automount.rules @@ -0,0 +1,2 @@ +# we don't care about loop* and ram* devices +KERNEL=="[!lr]*", SUBSYSTEM=="block", RUN+="/sbin/slax-automount %r/%k" diff --git a/linux-live/livekit/core/rootcopy/usr/sbin/gtk-bookmarks-update b/linux-live/livekit/core/rootcopy/usr/sbin/gtk-bookmarks-update new file mode 100755 index 0000000..1245bda --- /dev/null +++ b/linux-live/livekit/core/rootcopy/usr/sbin/gtk-bookmarks-update @@ -0,0 +1,23 @@ +#!/bin/bash + +LOCK=/run/lock/gtk-bookmark-update-lock +BOOKMARKS=/root/.gtk-bookmarks + +# make sure to avoid parallel execution by using mkdir as lock +while true; do + mkdir $LOCK 2>/dev/null + if [ $? = 0 ]; then + break + fi +done + +cat $BOOKMARKS | fgrep -v ///media/ | fgrep -v "file:/// /" | egrep -v '^$' > $BOOKMARKS.tmp 2>/dev/null +ls -1 /media | sort | while read LINE; do + echo "file:///media/$LINE $LINE" >> $BOOKMARKS.tmp +done + +echo "file:/// /" >> $BOOKMARKS.tmp # add root at the beginning + +mv -f $BOOKMARKS.tmp $BOOKMARKS + +rmdir $LOCK diff --git a/linux-live/livekit/core/rootcopy/usr/sbin/slax-automount b/linux-live/livekit/core/rootcopy/usr/sbin/slax-automount new file mode 100755 index 0000000..093689c --- /dev/null +++ b/linux-live/livekit/core/rootcopy/usr/sbin/slax-automount @@ -0,0 +1,67 @@ +#!/bin/bash +# Recreate fstab entries in /etc/fstab and make /media directories +# This script is called by udev rules, see /lib/udev/rules.d/ +# +# Author: Tomas M + +# Variables available in udev environment: +# $ACTION (eg: add, remove) +# $DEVNAME (full device node name including path) +# $DEVTYPE (eg: disk) +# $ID_FS_TYPE (eg: ext3) +# $MAJOR and $MINOR numbers +# $SUBSYSTEM (eg: block) + +PATH=$PATH:/usr/bin:/usr/sbin:/bin:/sbin + +BAS="$(basename "$DEVNAME")" +UNIT="media-$BAS.mount" +MNT="/media/$BAS" +TARGET="/etc/systemd/system/$UNIT" + + +# exit if noautomount boot parameter is present +if cat /proc/cmdline | grep -q noautomount; then + exit +fi + +# exit if 'automount' boot parameter is missing +if ! cat /proc/cmdline | grep -q automount; then + exit +fi + + +if [ "$ACTION" = "add" -o "$ACTION" = "change" ]; then + if [ ! -r "$TARGET" ]; then # skip if exists + + if [ "$ID_FS_TYPE" != "" -a "$(cat /proc/filesystems | grep "$ID_FS_TYPE")" != "" ]; then + + mkdir -p "$MNT" + + echo "[Unit]" >$TARGET + echo "Description=Disk $BAS" >>$TARGET + echo "" >>$TARGET + echo "[Mount]" >>$TARGET + echo "What=$DEVNAME" >>$TARGET + echo "Where=$MNT" >>$TARGET + echo "Type=$ID_FS_TYPE" >>$TARGET + echo "Options=defaults" >>$TARGET + echo "" >>$TARGET + echo "[Install]" >>$TARGET + echo "WantedBy=multi-user.target" >>$TARGET + + systemctl enable $UNIT + systemctl start $UNIT + + gtk-bookmarks-update + DISPLAY=:0.0 pcmanfm -n file://$MNT >/dev/null 2>&1 + fi + fi +fi + +if [ "$ACTION" = "remove" ]; then + systemctl disable $UNIT + rm "$TARGET" + rmdir "$MNT" + gtk-bookmarks-update +fi diff --git a/linux-live/livekit/gui/install b/linux-live/livekit/gui/install new file mode 100644 index 0000000..52a2330 --- /dev/null +++ b/linux-live/livekit/gui/install @@ -0,0 +1,16 @@ +#!/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 +if [ -f $SCRIPT_DIR/package.list ]; then + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update >>$OUTPUT 2>&1 && + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/package.list | tr "\n" " ") >>$OUTPUT 2>&1 +fi diff --git a/linux-live/livekit/gui/package.list b/linux-live/livekit/gui/package.list new file mode 100644 index 0000000..8b519c8 --- /dev/null +++ b/linux-live/livekit/gui/package.list @@ -0,0 +1,5 @@ +ubiquity +ubiquity-casper +ubiquity-frontend-gtk +ubiquity-slideshow-xubuntu +ubiquity-ubuntu-artwork \ No newline at end of file diff --git a/linux-live/livekit/gui/postinstall b/linux-live/livekit/gui/postinstall new file mode 100644 index 0000000..52fbf87 --- /dev/null +++ b/linux-live/livekit/gui/postinstall @@ -0,0 +1,41 @@ +#!/bin/bash + +if [ -d /etc/lightdm ]; then + cat </etc/lightdm/lightdm.conf +[Seat:*] +autologin-session=xubuntu +autologin-user=live +autologin-user-timeout=0 +EOF +fi +if [ -d /etc/NetworkManager ]; then + echo "Disable dhclient.service autostart." + systemctl disable dhclient + mkdir -p /etc/netplan + cat </etc/netplan/01-netcfg.yaml +# This file describes the network interfaces available on your system +# For more information, see netplan(5). +# Set and change netplan renderer to NetworkManager GUI tool +network: + version: 2 + renderer: NetworkManager +EOF + cat </etc/NetworkManager/NetworkManager.conf +[main] +rc-manager=resolvconf +plugins=ifupdown,keyfile +dns=dnsmasq +[ifupdown] +managed=false +EOF + + dpkg-reconfigure -f noninteractive network-manager +fi + +if [ -f /usr/share/xfce4/backdrops/xubuntu-wallpaper.png ]; then + rm /usr/share/xfce4/backdrops/xubuntu-wallpaper.png +fi +if [ ! -d /usr/share/xfce4/backdrops ]; then + mkdir -p /usr/share/xfce4/backdrops +fi +ln -s /usr/share/backgrounds/MiniOS.png /usr/share/xfce4/backdrops/xubuntu-wallpaper.png diff --git a/linux-live/minioslib b/linux-live/minioslib index b1c5bef..338ab91 100644 --- a/linux-live/minioslib +++ b/linux-live/minioslib @@ -983,7 +983,7 @@ EOF # create iso image pushd $PARENT_DIR/image - /bin/bash -c "(find . -type f -print0 | xargs -0 md5sum | grep -v -e 'md5sum.txt' -e 'bios.img' -e 'efiboot.img' -e 'isolinux.bin' -e 'boot.cat' > md5sum.txt)" + /bin/bash -c "(find . -type f -print0 | xargs -0 md5sum | grep -v -e 'md5sum.txt' -e 'bios.img' -e 'efiboot.img' -e 'isolinux.bin' -e 'boot.cat' -e 'ldlinux.c32' -e ldlinux.sys > md5sum.txt)" popd fi @@ -1072,6 +1072,22 @@ function build_iso() { exit 0 } +function batch_run() { + current_process + + chroot $1 /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $2 +} + # ================================================================= # ================================================================= # ====================== INSTALL FUNCTIONS ======================== @@ -1167,21 +1183,21 @@ function main_pkg_list() { $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/main.list | tr "\n" " ") >>$OUTPUT 2>&1 fi if [ $LIVE_TYPE = "casper" ]; then - if [ -f $SCRIPT_DIR/pkglists/ubuntu-main.list ]; then + if [ -f $SCRIPT_DIR/pkglists/casper-main.list ]; then sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ $APT_CMD install $APT_OPTIONS \ - $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/ubuntu-main.list | tr "\n" " ") >>$OUTPUT 2>&1 + $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/casper-main.list | tr "\n" " ") >>$OUTPUT 2>&1 fi - if [ -f $SCRIPT_DIR/pkglists/ubuntu-gui.list ]; then + if [ -f $SCRIPT_DIR/pkglists/casper-gui.list ]; then sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ $APT_CMD install $APT_OPTIONS \ - $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/ubuntu-gui.list | tr "\n" " ") >>$OUTPUT 2>&1 + $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/casper-gui.list | tr "\n" " ") >>$OUTPUT 2>&1 #$APT_CMD install $APT_OPTIONS /linux-live/packages/chromium_88.0.4324.96~linuxmint1+ulyssa_amd64.deb >>$OUTPUT 2>&1 fi - if [ -f $SCRIPT_DIR/pkglists/ubuntu-ubiquity.list ]; then + if [ -f $SCRIPT_DIR/pkglists/casper-ubiquity.list ]; then sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ $APT_CMD install $APT_OPTIONS \ - $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/ubuntu-ubiquity.list | tr "\n" " ") >>$OUTPUT 2>&1 + $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/casper-ubiquity.list | tr "\n" " ") >>$OUTPUT 2>&1 fi fi } @@ -1190,13 +1206,85 @@ function other_pkg_list() { echo -e "${YELLOW}=====> installing other packages for chroot system ...${ENDCOLOUR}" if [ $LIVE_TYPE = "casper" ]; then - if [ -f $SCRIPT_DIR/pkglists/ubuntu-other.list ]; then + if [ -f $SCRIPT_DIR/pkglists/casper-other.list ]; then sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ $APT_CMD update >>$OUTPUT 2>&1 && sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ $APT_CMD install $APT_OPTIONS \ - $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/ubuntu-other.list | tr "\n" " ") >>$OUTPUT 2>&1 + $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/casper-other.list | tr "\n" " ") >>$OUTPUT 2>&1 fi + # Install stuff from livekit modules + if [ $INSTALL_OPTIONAL = "1" ]; then + if [ -f /linux-live/modules/03-apps/preinstall ]; then + chmod +x /linux-live/modules/03-apps/preinstall + /usr/bin/env \ + OUTPUT=$OUTPUT \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /linux-live/modules/03-apps/preinstall + fi + if [ "$(ls -A /linux-live/modules/03-apps/rootcopy)" != "" ]; then + (cd /linux-live/modules/03-apps/rootcopy && cp --parents -afr * /) + fi + if [ -f /linux-live/modules/03-apps/install ]; then + chmod +x /linux-live/modules/03-apps/install + /usr/bin/env \ + OUTPUT=$OUTPUT \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /linux-live/modules/03-apps/install + fi + if [ -f /linux-live/modules/03-apps/postinstall ]; then + chmod +x /linux-live/modules/03-apps/postinstall + /usr/bin/env \ + OUTPUT=$OUTPUT \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /linux-live/modules/03-apps/postinstall + fi + + if [ -f /linux-live/modules/04-drivers/preinstall ]; then + chmod +x /linux-live/modules/04-drivers/preinstall + /usr/bin/env \ + OUTPUT=$OUTPUT \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /linux-live/modules/04-drivers/preinstall + fi + if [ "$(ls -A /linux-live/modules/04-drivers/rootcopy)" != "" ]; then + (cd /linux-live/modules/04-drivers/rootcopy && cp --parents -afr * /) + fi + if [ -f /linux-live/modules/04-drivers/install ]; then + chmod +x /linux-live/modules/04-drivers/install + /usr/bin/env \ + OUTPUT=$OUTPUT \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /linux-live/modules/04-drivers/install + fi + + if [ -f /linux-live/modules/04-drivers/postinstall ]; then + chmod +x /linux-live/modules/04-drivers/postinstall + /usr/bin/env \ + OUTPUT=$OUTPUT \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /linux-live/modules/04-drivers/postinstall + fi + fi + fi if [ -f $SCRIPT_DIR/pkglists/other.list ]; then sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ @@ -1409,6 +1497,7 @@ EOF fi if [ $LIVE_TYPE = "casper" ]; then + update-alternatives --install /usr/share/plymouth/themes/default.plymouth default.plymouth /usr/share/plymouth/themes/minios-logo/minios-logo.plymouth 200 update-alternatives --install /usr/share/plymouth/themes/text.plymouth text.plymouth /usr/share/plymouth/themes/minios-text/minios-text.plymouth 200 update-alternatives --config default.plymouth --skip-auto @@ -1418,28 +1507,6 @@ EOF fi update-initramfs -u - if [ $INSTALL_OPTIONAL = "1" ]; then - if [ -f /linux-live/modules/03-apps/package.list ]; then - $APT_CMD update >>$OUTPUT 2>&1 && - sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ - $APT_CMD install $APT_OPTIONS \ - $(grep -vE "^\s*#" /linux-live/modules/03-apps/package.list | tr "\n" " ") >>$OUTPUT 2>&1 - fi - if [ "$(ls -A /linux-live/modules/03-apps/rootcopy)" != "" ]; then - (cd /linux-live/modules/03-apps/rootcopy && cp --parents -afr * /) - fi - if [ -f /linux-live/modules/03-apps/postinstall ]; then - chmod +x /linux-live/modules/03-apps/postinstall - /linux-live/modules/03-apps/postinstall - fi - if [ -f /linux-live/modules/04-drivers/package.list ]; then - $APT_CMD update >>$OUTPUT 2>&1 && - sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ - $APT_CMD install $APT_OPTIONS \ - $(grep -vE "^\s*#" /linux-live/modules/04-drivers/package.list | tr "\n" " ") >>$OUTPUT 2>&1 - fi - fi - fi if [ -f /usr/share/xfce4/backdrops/xubuntu-wallpaper.png ]; then @@ -1694,6 +1761,8 @@ EOF rm -f $MODULE_UPPER_DIR/var/lib/apt/lists/deb.* >>$OUTPUT 2>&1 rm -f $MODULE_UPPER_DIR/var/lib/dpkg/*-old >>$OUTPUT 2>&1 rm -f /preinstall + rm -f /install + rm -f /packages.list rm -f /postinstall } @@ -1741,11 +1810,10 @@ function build_modules_chroot() { APT_CMD=$APT_CMD \ APT_OPTIONS=$APT_OPTIONS \ LIVE_TYPE=$LIVE_TYPE \ - sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ /preinstall >>$OUTPUT 2>&1 fi - # install packages + : '# install packages if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/package.list ]; then if [ -d /opt/minios-live ] || [ -f /.minios-live-container ]; then chroot $MODULE_MERGED_DIR /usr/bin/env \ @@ -1778,13 +1846,32 @@ function build_modules_chroot() { $APT_CMD install $APT_OPTIONS \ $(grep -vE "^\s*#" $SCRIPT_DIR/linux-live/modules/$MODULE/package.list | tr "\n" " ") >>$OUTPUT 2>&1 fi - fi + fi' # copy files if [ "$(ls -A $SCRIPT_DIR/linux-live/modules/$MODULE/rootcopy)" != "" ]; then (cd $SCRIPT_DIR/linux-live/modules/$MODULE/rootcopy && cp --parents -afr * $MODULE_MERGED_DIR/) fi + # run install script + if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/install ]; then + cp $SCRIPT_DIR/linux-live/modules/$MODULE/install $MODULE_MERGED_DIR/install + chmod +x $MODULE_MERGED_DIR/install + if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/package.list ]; then + cp $SCRIPT_DIR/linux-live/modules/$MODULE/package.list $MODULE_MERGED_DIR/package.list + fi + chroot $MODULE_MERGED_DIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /install >>$OUTPUT 2>&1 + fi + # run post-install script if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/postinstall ]; then cp $SCRIPT_DIR/linux-live/modules/$MODULE/postinstall $MODULE_MERGED_DIR/postinstall @@ -1798,7 +1885,6 @@ function build_modules_chroot() { APT_CMD=$APT_CMD \ APT_OPTIONS=$APT_OPTIONS \ LIVE_TYPE=$LIVE_TYPE \ - sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ /postinstall >>$OUTPUT 2>&1 fi @@ -1806,6 +1892,10 @@ function build_modules_chroot() { module_chroot_umount_fs + if [ ! -f $PARENT_DIR/image/$LIVEKITNAME/$MODULE.$BEXT ]; then + build_modules_live + fi + fi done } diff --git a/linux-live/minioslib.copy b/linux-live/minioslib.copy new file mode 100644 index 0000000..75b26ad --- /dev/null +++ b/linux-live/minioslib.copy @@ -0,0 +1,1950 @@ +#!/bin/bash + +# Functions library :: for install scripts +# Author: crims0n. +# + +# ================================================================= +# ================================================================= +# ========================= VARIABLES ============================= +# ================================================================= +# ================================================================= + +function common_variables() { + # + CONTAINER_TYPE="0" + set +u + if [ -z $container ]; then + container="" + fi + set -u + : 'if [ -f /.dockerenv ] || [ "$container" = "podman" ]; then + OUTPUT="/dev/stdout" + #CONTAINER="docker" + fi' + if [ -f /.dockerenv ] || [ "$container" = "podman" ] && [ ! -d /opt/minios-live ] && [ ! -f /.minios-live-container ]; then + CONTAINER_TYPE="1" + fi + if [[ (-f /.dockerenv || "$container" = "podman") && (-d /opt/minios-live || -f /.minios-live-container) ]]; then + CONTAINER_TYPE="2" + fi +} + +# ================================================================= +# ================================================================= +# ===================== COMMON FUNCTIONS ========================== +# ================================================================= +# ================================================================= + +function current_process() { + echo -e "${LIGHTYELLOW}=====> running ${CYAN}${CMD[ii]}${ENDCOLOUR}${LIGHTYELLOW} ...${ENDCOLOUR}" +} + +# ================================================================= +# beautiful console +# красивая консоль +# ================================================================= +function console_colours() { + RED="\e[31m" + GREEN="\e[32m" + YELLOW="\e[33m" + BLUE="\e[34m" + MAGENTA="\e[35m" + CYAN="\e[36m" + LIGHTGRAY="\e[37m" + DARKGRAY="\e[90m" + LIGHTRED="\e[91m" + LIGHTGREEN="\e[92m" + LIGHTYELLOW="\e[93m" + LIGHTBLUE="\e[94m" + LIGHTMAGENTA="\e[95m" + LIGHTCYAN="\e[96m" + BOLD="\e[1m" + DIM="\e[2m" + UNDERLINED="\e[4m" + BLINK="\e[5m" + REVERSE="\e[7m" + HIDDEN="\e[8m" + ENDCOLOUR="\e[0m" +} + +# ================================================================= +# help functions +# функции помощи +# ================================================================= +function help() { + # if $1 is set, use $1 as headline message in help() + if grep 'LANG="ru_RU.UTF-8"' /etc/default/locale >>$OUTPUT; then + if [ -z ${1+x} ]; then + echo -e "${LIGHTYELLOW}Этот скрипт собирает загружаемый ISO образ $SYSTEMNAME.${ENDCOLOUR}" + echo -e + else + echo -e $1 + echo + fi + echo -e "Поддерживаемые команды : ${CYAN}${CMD[*]}${ENDCOLOUR}" + echo -e + echo -e "Синтаксис: ${MAGENTA}$0${ENDCOLOUR} [start_cmd] [-] [end_cmd]" + if [ -L /usr/bin/$LIVEKITNAME-install ] && [ "$0" != "/usr/bin/$LIVEKITNAME-install" ]; then + echo -e "\t${CYAN}$LIVEKITNAME-install${ENDCOLOUR} [start_cmd] [-] [end_cmd]" + fi + echo -e "\tзапуск от start_cmd до end_cmd" + echo -e "\tесли start_cmd опущен, выполняются все команды, начиная с первой" + echo -e "\tесли end_cmd опущен, выполняются все команды до последней" + echo -e "\tвведите одну команду, чтобы запустить определенную команду" + echo -e "\tвведите '-' как единственный аргумент для запуска всех команд" + echo -e "\t" + echo -e "\tПримеры:${LIGHTYELLOW}$0 build_bootstrap - build_chroot${ENDCOLOUR}" + echo -e "\t\t${LIGHTYELLOW}$0 - build_chroot${ENDCOLOUR}" + echo -e "\t\t${LIGHTYELLOW}$0 build_bootstrap -${ENDCOLOUR}" + echo -e "\t\t${LIGHTYELLOW}$0 build_iso${ENDCOLOUR}" + echo -e "\t\t${LIGHTYELLOW}$0 -${ENDCOLOUR}" + exit 0 + else + if [ -z ${1+x} ]; then + echo -e "${LIGHTYELLOW}This script builds bootable $SYSTEMNAME ISO image.${ENDCOLOUR}" + echo -e + else + echo -e $1 + echo + fi + echo -e "Supported commands : ${CYAN}${CMD[*]}${ENDCOLOUR}" + echo -e + echo -e "Syntax: ${MAGENTA}$0${ENDCOLOUR} [start_cmd] [-] [end_cmd]" + if [ -L /usr/bin/$LIVEKITNAME-install ] && [ "$0" != "/usr/bin/$LIVEKITNAME-install" ]; then + echo -e "\t${CYAN}$LIVEKITNAME-install${ENDCOLOUR} [start_cmd] [-] [end_cmd]" + fi + echo -e "\trun from start_cmd to end_cmd" + echo -e "\tif start_cmd is omitted, start from first command" + echo -e "\tif end_cmd is omitted, end with last command" + echo -e "\tenter single cmd to run the specific command" + echo -e "\tenter '-' as only argument to run all commands" + echo -e "\t" + echo -e "\tExamples:${LIGHTYELLOW}$0 build_bootstrap - build_chroot${ENDCOLOUR}" + echo -e "\t\t${LIGHTYELLOW}$0 - build_chroot${ENDCOLOUR}" + echo -e "\t\t${LIGHTYELLOW}$0 build_bootstrap -${ENDCOLOUR}" + echo -e "\t\t${LIGHTYELLOW}$0 build_iso${ENDCOLOUR}" + echo -e "\t\t${LIGHTYELLOW}$0 -${ENDCOLOUR}" + exit 0 + fi +} + +function find_index() { + local ret + local i + for ((i = 0; i < ${#CMD[*]}; i++)); do + if [ "${CMD[i]}" == "$1" ]; then + index=$i + return + fi + done + help "Command not found : $1" +} + +function create_livekitname_install_symlink() { + if [ -L /usr/bin/$LIVEKITNAME-install ]; then + if [ "$(readlink /usr/bin/$LIVEKITNAME-install)" != "$SCRIPT_DIR/install" ]; then + rm -f /usr/bin/$LIVEKITNAME-install + ln -s $SCRIPT_DIR/install /usr/bin/$LIVEKITNAME-install + if grep 'LANG="ru_RU.UTF-8"' /etc/default/locale >>$OUTPUT; then + echo -e "Символическая ссылка ${MAGENTA}/usr/bin/$LIVEKITNAME-install${ENDCOLOUR} была обновлена." + echo -e "Теперь она указывает на ${MAGENTA}$SCRIPT_DIR/install${ENDCOLOUR}." + else + echo -e "The ${MAGENTA}/usr/bin/$LIVEKITNAME-install${ENDCOLOUR} symbolic link has been updated." + echo -e "It now points to ${MAGENTA}$SCRIPT_DIR/install${ENDCOLOUR}." + fi + fi + if [ "$0" != "/usr/bin/$LIVEKITNAME-install" ]; then + if grep 'LANG="ru_RU.UTF-8"' /etc/default/locale >>$OUTPUT; then + echo -e "Вы можете использовать команду ${CYAN}$LIVEKITNAME-install${ENDCOLOUR} для запуска этой программы." + else + echo -e "You can use the ${CYAN}$LIVEKITNAME-install${ENDCOLOUR} command to run this program." + fi + fi + else + ln -s $SCRIPT_DIR/install /usr/bin/$LIVEKITNAME-install + if grep 'LANG="ru_RU.UTF-8"' /etc/default/locale >>$OUTPUT; then + echo -e "Символическая ссылка ${MAGENTA}/usr/bin/$LIVEKITNAME-install${ENDCOLOUR} была добавлена" + echo -e "для ${MAGENTA}$SCRIPT_DIR/install${ENDCOLOUR}." + + else + echo -e "The ${MAGENTA}/usr/bin/$LIVEKITNAME-install${ENDCOLOUR} symbolic link has been added" + echo -e "for ${MAGENTA}$SCRIPT_DIR/install${ENDCOLOUR}." + fi + fi +} + +function create_completion() { + if [ -d /etc/bash_completion.d ]; then + if [ ! -f /etc/bash_completion.d/$LIVEKITNAME-install ] || ! grep "${CMD[*]}" /etc/bash_completion.d/$LIVEKITNAME-install >>$OUTPUT; then + cat </etc/bash_completion.d/$LIVEKITNAME-install +#/usr/bin/env bash +complete -W "${CMD[*]}" $LIVEKITNAME-install +EOF + fi + if [ "$0" != "/usr/bin/$LIVEKITNAME-install" ]; then + if grep 'LANG="ru_RU.UTF-8"' /etc/default/locale >>$OUTPUT; then + echo -e "Дополнение команд работает только при использовании команды ${CYAN}$LIVEKITNAME-install${ENDCOLOUR}." + echo -e + else + echo -e "Command completion only works when using the ${CYAN}$LIVEKITNAME-install${ENDCOLOUR} command." + echo -e + fi + fi + fi +} + +# ================================================================= +# only allow 'root' to run the script +# разрешаем запуск скрипта только пользователю 'root' +# ================================================================= + +function allow_root_only() { + if [ $(id -u) -ne 0 ]; then + echo -e "${BOLD}${RED}This script should be run as 'root'!${ENDCOLOUR}" + exit 1 + fi + + export HOME=/root + export LC_ALL=C +} + +# ================================================================= +# check that we are inside chroot +# проверяем, что мы внутри chroot +# ================================================================= + +function check_is_in_chroot() { + if [ $(stat -c %i /)="2" ]; then + echo -e "${BOLD}${RED}This script should be run inside chroot only!${ENDCOLOUR}" + exit 1 + fi +} + +# ================================================================= +# check if filesystems are unmounted inside chroot +# проверяем, размонтированы ли файловые системы внутри chroot +# ================================================================= + +function check_mounted() { + echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..." + if grep -qs "$BUILD_DIR/dev" /proc/mounts || grep -qs "$BUILD_DIR/run" /proc/mounts || grep -qs "$BUILD_DIR/proc" /proc/mounts || grep -qs "$BUILD_DIR/sys" /proc/mounts || grep -qs "$BUILD_DIR/dev/pts" /proc/mounts || grep -qs "$BUILD_DIR/tmp" /proc/mounts; then + echo -e "${BOLD}${LIGHTYELLOW}Сhroot contains mounted filesystems.${ENDCOLOUR}" + if [ "$UNATTENDED" = "1" ]; then + chroot_umount_fs + else + read -r -p "$(echo -e ""Do you want to ${GREEN}unmount them${ENDCOLOUR}? [${BOLD}${GREEN}Y${ENDCOLOUR}/n])" response + response=${response,,} + if [[ "$response" =~ ^(no|n)$ ]]; then + exit 1 + else + chroot_umount_fs + fi + fi + fi +} + +# ================================================================= +# check if the folder where the installation will be performed is empty +# проверяем, пуста ли папка, в которую будет производиться установка +# ================================================================= + +function check_build_dir() { + echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..." + if [ "$UNATTENDED" = "1" ]; then + #echo -e "${RED}!!!Unattended installation!!!${ENDCOLOUR}" + BUILD_DIR="/build/$DISTRIBUTION" + echo -e "The working directory is ${MAGENTA}$BUILD_DIR${ENDCOLOUR}." + if [ "$(ls -A $BUILD_DIR)" != "" ]; then + cleanup + check_mounted + fi + else + # ▼ должно быть только перенаправление ошибки! + if [ "$(ls -A $BUILD_DIR)" != "" ]; then + echo -e "${MAGENTA}$BUILD_DIR${ENDCOLOUR} is not empty." + cleanup + check_mounted + if [ ! -d "$BUILD_DIR" ]; then + mkdir -p $BUILD_DIR + fi + BUILD_DIR="$( + cd $BUILD_DIR + pwd + )" + echo $BUILD_DIR >$SCRIPT_DIR/.build_dir && chmod 644 $SCRIPT_DIR/.build_dir + echo -e "The working directory is ${MAGENTA}$BUILD_DIR${ENDCOLOUR}." + else + mkdir -p $BUILD_DIR + check_mounted + BUILD_DIR="$( + cd $BUILD_DIR + pwd + )" + echo $BUILD_DIR >$SCRIPT_DIR/.build_dir && chmod 644 $SCRIPT_DIR/.build_dir + echo -e "The working directory is ${MAGENTA}$BUILD_DIR${ENDCOLOUR}." + fi + fi +} + +# ================================================================= +# configure the build folder +# настраиваем папку для сборки +# ================================================================= + +function setup_build_dir() { + echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..." + if [ "$UNATTENDED" = "1" ] && [ "$BUILD_DIR" = "" ]; then + BUILD_DIR="/build/$DISTRIBUTION" + check_build_dir + else + if [ "$BUILD_DIR" = "" ]; then + if [ ! -f "$SCRIPT_DIR/.build_dir" ]; then + echo "Enter the address of the working directory where we will build the system" + read -r -p "$(echo -e "(Default is ${MAGENTA}$PARENT_DIR/$DISTRIBUTION${ENDCOLOUR}): ")" response + BUILD_DIR=${response,,} + if [ "$BUILD_DIR" = "" ]; then + BUILD_DIR=$PARENT_DIR/$DISTRIBUTION + fi + check_build_dir + else + LAST_BUILD_DIR=$(cat "$SCRIPT_DIR/.build_dir") + echo -e "Last time you used the build directory ${MAGENTA}$LAST_BUILD_DIR${ENDCOLOUR}." + read -r -p "$(echo -e ""Do you want to use it again? [${BOLD}${GREEN}Y${ENDCOLOUR}/n])" response + response=${response,,} + if [[ "$response" =~ ^(no|n)$ ]]; then + echo "Enter the address of the working directory where we will build the system" + read -r -p "$(echo -e "(Default is ${MAGENTA}$PARENT_DIR/$DISTRIBUTION${ENDCOLOUR}): ")" response + BUILD_DIR=${response,,} + if [ "$BUILD_DIR" = "" ]; then + BUILD_DIR=$PARENT_DIR/$DISTRIBUTION + fi + check_build_dir + else + BUILD_DIR="$LAST_BUILD_DIR" + check_build_dir + fi + fi + fi + fi +} + +function cleanup() { + echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..." + if [ "${CMD[ii]}" = "setup_host" ] || [ "${CMD[ii]}" = "build_bootstrap" ] || [ "${CMD[ii]}" = "build_chroot" ]; then + if [ "$UNATTENDED" = "1" ]; then + check_mounted + rm -rf $BUILD_DIR + if [ -d "$BUILD_DIR" ]; then + cleanup + fi + else + read -r -p "$(echo -e ""Do you want to ${BOLD}${RED}completely remove content${ENDCOLOUR} of ${MAGENTA}$BUILD_DIR${ENDCOLOUR}? [y/${BOLD}${GREEN}N${ENDCOLOUR}])" response + response=${response,,} + if [[ "$response" =~ ^(yes|y)$ ]]; then + check_mounted + rm -rf $BUILD_DIR + if [ -d "$BUILD_DIR" ]; then + cleanup + fi + else + echo -e "${MAGENTA}$BUILD_DIR${ENDCOLOUR} should be empty to continue." + exit 1 + fi + fi + fi +} + +# ================================================================= +# mount filesystems inside chroot +# монтируем файловые системы внутри chroot +# ================================================================= + +function chroot_mount_fs() { + echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..." + + #if [ ! -d $BUILD_DIR/dev ]; then + # mkdir $BUILD_DIR/dev + #fi + + check_mounted + + : 'if [ -f /.dockerenv ] || [ "$container" = "podman" ]; then + ln -s /dev $BUILD_DIR/dev + ln -s /run $BUILD_DIR/run + ln -s /proc $BUILD_DIR/proc + ln -s /sys $BUILD_DIR/sys + ln -s /tmp $BUILD_DIR/tmp + else' + mount --bind /dev $BUILD_DIR/dev + mount --bind /run $BUILD_DIR/run + mount none -t proc $BUILD_DIR/proc + mount none -t sysfs $BUILD_DIR/sys + mount none -t devpts $BUILD_DIR/dev/pts + mount none -t tmpfs $BUILD_DIR/tmp + #fi +} + +# ================================================================= +# unmount filesystems inside chroot +# размонтируем файловые системы внутри chroot +# ================================================================= + +function chroot_umount_fs() { + echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..." + + : 'if [ -f /.dockerenv ] || [ "$container" = "podman" ]; then + set +e + rm -f $BUILD_DIR/dev >>$OUTPUT 2>&1 + rm -f $BUILD_DIR/run >>$OUTPUT 2>&1 + rm -f $BUILD_DIR/proc >>$OUTPUT 2>&1 + rm -f $BUILD_DIR/sys >>$OUTPUT 2>&1 + rm -f $BUILD_DIR/tmp >>$OUTPUT 2>&1 + set -e + else' + set +e + umount $BUILD_DIR/proc >>$OUTPUT 2>&1 + umount $BUILD_DIR/sys >>$OUTPUT 2>&1 + umount $BUILD_DIR/dev/pts >>$OUTPUT 2>&1 + umount $BUILD_DIR/tmp >>$OUTPUT 2>&1 + umount $BUILD_DIR/dev >>$OUTPUT 2>&1 + umount $BUILD_DIR/run >>$OUTPUT 2>&1 + set -e + #fi + + check_mounted +} + +function remove_log_file() { + echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..." + if [ -f $LOGPATH/$LIVEKITNAME.log ]; then + rm -f $LOGPATH/$LIVEKITNAME.log + fi + if [ -f $BUILD_DIR/$LIVEKITNAME.log ]; then + rm -f $BUILD_DIR/$LIVEKITNAME.log + fi +} + +function create_backup() { + if [ $CREATE_BACKUP = "1" ]; then + echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..." + if [ ! -f $SCRIPT_DIR/.script_version ]; then + cat "1" >$SCRIPT_DIR/.script_version >>$OUTPUT 2>&1 + chmod 644 $SCRIPT_DIR/.script_version >>$OUTPUT 2>&1 + fi + DATE=$(date +%Y%m%d_%H%M) + CHANGED="0" + rm -rf $SCRIPT_DIR/iso >>$OUTPUT 2>&1 + rm -f $SCRIPT_DIR/.build_dir >>$OUTPUT 2>&1 + rm -f $SCRIPT_DIR/*.log >>$OUTPUT 2>&1 + if [ ! -d $PARENT_DIR/minios-live-current ]; then + CHANGED="1" + mkdir -p $PARENT_DIR/minios-live-current + (cd $SCRIPT_DIR && cp --parents -afr * $PARENT_DIR/minios-live-current) + else + for file in $(find $SCRIPT_DIR -path $SCRIPT_DIR/.git -prune -false -o -type f | sed "s,$SCRIPT_DIR/,,g" | sed "s,.script_version,,g"); do + if ! cmp $SCRIPT_DIR/$file $PARENT_DIR/minios-live-current/$file >>$OUTPUT 2>&1; then + CHANGED="1" + echo -e "$file has been modified since last backup." >>$OUTPUT 2>&1 + echo -e "Copying $SCRIPT_DIR/$file to $PARENT_DIR/minios-live-current/$file..." >>$OUTPUT 2>&1 + cp -f $SCRIPT_DIR/$file $PARENT_DIR/minios-live-current/$file >>$OUTPUT 2>&1 + fi + done + fi + if [ $CHANGED = "1" ]; then + SCRIPT_VERSION=$(cat $SCRIPT_DIR/.script_version) + echo $(($SCRIPT_VERSION + 1)) >$SCRIPT_DIR/.script_version + echo $(($SCRIPT_VERSION + 1)) >$PARENT_DIR/minios-live-current/.script_version + cd $SCRIPT_DIR >>$OUTPUT 2>&1 + rm -f $PARENT_DIR/minios-live-current.tar.gz + tar -czf $PARENT_DIR/minios-live-current.tar.gz ./ >>$OUTPUT 2>&1 + cp $PARENT_DIR/minios-live-current.tar.gz $PARENT_DIR/minios-live-v$SCRIPT_VERSION-$DATE.tar.gz >>$OUTPUT 2>&1 + fi + 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 =========================== +# ================================================================= +# ================================================================= + +function create_apt_list() { + echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..." + if [ ! -f $SCRIPT_DIR/linux-live/aptsources/$DISTRIBUTION.list ]; then + cp -f $SCRIPT_DIR/linux-live/aptsources/sources.list $SCRIPT_DIR/linux-live/aptsources/$DISTRIBUTION.list + sed -i "s,distro,$DISTRIBUTION,g" $SCRIPT_DIR/linux-live/aptsources/$DISTRIBUTION.list + sed -i "s,http://ru.archive.ubuntu.com/ubuntu,$DISTRIBUTION_URL,g" $SCRIPT_DIR/linux-live/aptsources/$DISTRIBUTION.list + fi +} + +function build_bootstrap() { + current_process + + if [ $CONTAINER_TYPE = "1" ]; then + if [ ! -f /.minios-live ]; then + setup_host + fi + fi + + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + debootstrap --arch=$DISTRIBUTION_ARCH --variant=$DISTRIBUTION_VARIANT $DISTRIBUTION $BUILD_DIR $DISTRIBUTION_URL >>$OUTPUT 2>>$OUTPUT +} + +function copy_build_scripts() { + echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..." + if [ ! -d $BUILD_DIR/linux-live ]; then + mkdir -p $BUILD_DIR/linux-live + (cd $SCRIPT_DIR/linux-live && cp --parents -afr * $BUILD_DIR/linux-live) + else + #for file in $(ls $SCRIPT_DIR/linux-live -p | grep -v /); do + for file in $(find $SCRIPT_DIR/linux-live -type f | sed "s,$SCRIPT_DIR/linux-live/,,g"); do + if ! cmp $SCRIPT_DIR/linux-live/$file $BUILD_DIR/linux-live/$file >>$OUTPUT 2>&1; then + echo -e "$file has been modified since last build run." >>$OUTPUT 2>&1 + echo -e "Copying $SCRIPT_DIR/linux-live/$file to $BUILD_DIR/linux-live/$file..." >>$OUTPUT 2>&1 + cp -f $SCRIPT_DIR/linux-live/$file $BUILD_DIR/linux-live/$file >>$OUTPUT 2>&1 + fi + done + fi + + chmod +x $BUILD_DIR/linux-live/build + chmod +x $BUILD_DIR/linux-live/install_chroot + + if [ "$DEV_SYSTEM" = "1" ]; then + if [ ! -d $BUILD_DIR/opt/minios-live ]; then + mkdir -p $BUILD_DIR/opt/minios-live + (cd $SCRIPT_DIR && cp --parents -afr * $BUILD_DIR/opt/minios-live) + else + for file in $(find $SCRIPT_DIR -path $SCRIPT_DIR/.git -prune -false -o -type f | sed "s,$SCRIPT_DIR/,,g"); do + if ! cmp $SCRIPT_DIR/$file $BUILD_DIR/opt/minios-live/$file >>$OUTPUT 2>&1; then + echo -e "$file has been modified since last build run." >>$OUTPUT 2>&1 + echo -e "Copying $SCRIPT_DIR/$file to $BUILD_DIR/opt/minios-live/$file..." >>$OUTPUT 2>&1 + cp -f $SCRIPT_DIR/$file $BUILD_DIR/opt/minios-live/$file >>$OUTPUT 2>&1 + fi + done + fi + fi +} + +function preserve_environment_variables() { + if [ -d /opt/minios-live ]; then + chroot $BUILD_DIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE + fi + +} + +function build_chroot() { + current_process + + if [ $CONTAINER_TYPE = "1" ]; then + if [ ! -f /.minios-live ]; then + setup_host + fi + fi + + chroot_mount_fs + + copy_build_scripts + + create_apt_list + + if [ "$OUTPUT"="$LOGPATH/$LIVEKITNAME.log" ] && [ -f /$LIVEKITNAME.log ]; then + mv -f /$LIVEKITNAME.log $BUILD_DIR/$LIVEKITNAME.log + fi + if [ "$OUTPUT"="$LOGPATH/$LIVEKITNAME.log" ] && [ -f $BUILD_DIR/$LIVEKITNAME.log ]; then + echo "===========================================" >>$BUILD_DIR/$LIVEKITNAME.log 2>&1 + echo "===========================================" >>$BUILD_DIR/$LIVEKITNAME.log 2>&1 + echo "=============== CHROOT LOG ================" >>$BUILD_DIR/$LIVEKITNAME.log 2>&1 + echo "===========================================" >>$BUILD_DIR/$LIVEKITNAME.log 2>&1 + echo "===========================================" >>$BUILD_DIR/$LIVEKITNAME.log 2>&1 + fi + + cp -f $SCRIPT_DIR/linux-live/aptsources/$DISTRIBUTION.list $BUILD_DIR/etc/apt/sources.list + + if [ -d /opt/minios-live ] || [ -f /.minios-live-container ]; then + chroot $BUILD_DIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE /linux-live/install_chroot - + else + chroot $BUILD_DIR /linux-live/install_chroot - + fi + + chroot_umount_fs + + if [ "$OUTPUT"="$LOGPATH/$LIVEKITNAME.log" ] && [ -f $BUILD_DIR/$LIVEKITNAME.log ]; then + mv -f $BUILD_DIR/$LIVEKITNAME.log $SCRIPT_DIR/$LIVEKITNAME.log + if [ -f $SCRIPT_DIR/$LIVEKITNAME.log ]; then + echo -e "Installation log was saved to ${MAGENTA}$SCRIPT_DIR/$LIVEKITNAME.log${ENDCOLOUR}" + fi + fi +} + +function build_package() { + current_process + + if [ $CONTAINER_TYPE = "1" ]; then + if [ ! -f /.minios-live ]; then + setup_host + fi + fi + + chroot_mount_fs + + #copy_build_scripts + + if [ -d /opt/minios-live ] || [ -f /.minios-live-container ]; then + chroot $BUILD_DIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update >>$OUTPUT 2>&1 && + chroot $BUILD_DIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/add_pkg.list | tr "\n" " ") >>$OUTPUT 2>&1 + else + chroot $BUILD_DIR sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update >>$OUTPUT 2>&1 && + chroot $BUILD_DIR sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/add_pkg.list | tr "\n" " ") >>$OUTPUT 2>&1 + fi + + chroot_umount_fs + + rm -f $BUILD_DIR/var/lib/apt/extended_states >>$OUTPUT 2>&1 + rm -f $BUILD_DIR/var/lib/apt/lists/*Packages* >>$OUTPUT 2>&1 + rm -f $BUILD_DIR/var/lib/apt/lists/*Translation* >>$OUTPUT 2>&1 + rm -f $BUILD_DIR/var/lib/apt/lists/*InRelease >>$OUTPUT 2>&1 + rm -f $BUILD_DIR/var/lib/apt/lists/deb.* >>$OUTPUT 2>&1 + rm -f $BUILD_DIR/var/lib/dpkg/*-old >>$OUTPUT 2>&1 +} + +function build_initrd() { + current_process + + if [ $CONTAINER_TYPE = "1" ]; then + if [ ! -f /.minios-live ]; then + setup_host + fi + fi + + (cd $SCRIPT_DIR/linux-live/rootcopy-casper && cp --parents -afr * $BUILD_DIR/) + + chroot_mount_fs + + if [ -d /opt/minios-live ] || [ -f /.minios-live-container ]; then + chroot $BUILD_DIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE update-initramfs -u + else + chroot $BUILD_DIR update-initramfs -u + fi + + chroot_umount_fs +} + +function build_live() { + current_process + + if [ $CONTAINER_TYPE = "1" ]; then + if [ ! -f /.minios-live ]; then + setup_host + fi + fi + + remove_log_file + + if [ $LIVE_TYPE = "livekit" ]; then + + copy_build_scripts + + check_build_dir + + #(cd /linux-live/rootcopy && cp --parents -afr * /) + + chroot $BUILD_DIR mount none -t proc /proc + chroot $BUILD_DIR /linux-live/initrfs + chroot $BUILD_DIR umount /proc + + rm -rf $PARENT_DIR/image + mkdir -p $PARENT_DIR/image/$LIVEKITNAME/{boot,changes,modules} + + # copy kernel files + cp $BUILD_DIR/boot/vmlinuz-**-**-generic $PARENT_DIR/image/$LIVEKITNAME/boot/vmlinuz + mv $BUILD_DIR/boot/initrfs.img $PARENT_DIR/image/$LIVEKITNAME/boot/initrfs.img + + cp -r $SCRIPT_DIR/linux-live/bootfiles/* $PARENT_DIR/image/ + + cat <<'EOF' >$PARENT_DIR/image/boot/grub/grub.cfg +set default="0" +set timeout="10" +set hidden_timeout_quiet=false +set gfxmode=auto +insmod efi_gop +insmod efi_uga +insmod gfxterm +terminal_output gfxterm +set color_normal=black/black +set color_highlight=black/white +loadfont /boot/grub/unicode.pf2 +background_image /boot/grub/bootlogo.png + +set default_settings="load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 consoleblank=0 apparmor=0 net.ifnames=0 biosdevname=0" +set perch_settings="slax.flags=perch,automount" +set live_settings="slax.flags=automount" +set ram_settings="slax.flags=toram" +set debug_settings="load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 apparmor=0 debug net.ifnames=0 biosdevname=0" +set linux_64="/minios/boot/vmlinuz" +set initrd_img="/minios/boot/initrfs.img" +set default=0 +set message="Загружаем ядро и рамдиск... Подождите..." + +menuentry "Запуск MiniOS с сохранением изменений"{ + echo $message + search --set -f $linux_64 + linux $linux_64 $default_settings $perch_settings + initrd $initrd_img +} +menuentry "Запуск MiniOS в чистом режиме"{ + echo $message + search --set -f $linux_64 + linux $linux_64 $default_settings $live_settings + initrd $initrd_img +} +menuentry "Запуск MiniOS с загрузкой в RAM"{ + echo $message + search --set -f $linux_64 + linux $linux_64 $default_settings $ram_settings + initrd $initrd_img +} + +menuentry "Запуск MiniOS в режиме отладки"{ + echo $message + search --set -f $linux_64 + linux $linux_64 $debug_settings + initrd $initrd_img +} + +EOF + + cat <<'EOF' | iconv -f 'UTF-8' -t "CP866//TRANSLIT" >$PARENT_DIR/image/boot/syslinux/syslinux.cfg +FONT 866_8x16.psf +DEFAULT vesamenu.c32 +PROMPT 0 +TIMEOUT 90 +ALLOWOPTIONS 0 +ONTIMEOUT default +MENU BACKGROUND bootlogo.png + +MENU COLOR border 30;44 #00000000 #00000000 none +MENU COLOR unsel 37;44 #901E1E1E #00000000 std +MENU COLOR sel 7;37;40 #ff1E1E1E #99006693 all +MENU COLOR hotsel 1;7;37;40 #55555555 #99006693 all + +LABEL default +MENU LABEL Запуск MiniOS с сохранением изменений +KERNEL /minios/boot/vmlinuz +APPEND vga=normal initrd=/minios/boot/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 consoleblank=0 slax.flags=perch,automount apparmor=0 net.ifnames=0 biosdevname=0 + +LABEL live +MENU LABEL Запуск MiniOS в чистом режиме +KERNEL /minios/boot/vmlinuz +APPEND vga=normal initrd=/minios/boot/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 consoleblank=0 slax.flags=automount apparmor=0 net.ifnames=0 biosdevname=0 + +LABEL toram +MENU LABEL Запуск MiniOS с загрузкой в RAM +KERNEL /minios/boot/vmlinuz +APPEND vga=normal initrd=/minios/boot/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 consoleblank=0 slax.flags=toram apparmor=0 net.ifnames=0 biosdevname=0 + +LABEL debug +MENU LABEL Запуск MiniOS в режиме отладки +KERNEL /minios/boot/vmlinuz +APPEND vga=normal initrd=/minios/boot/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 apparmor=0 debug net.ifnames=0 biosdevname=0 +EOF + + # create compressed 01-core.sb + cd $BUILD_DIR + COREFS="" + for i in $MKMOD; do + if [ -d /$i ]; then + COREFS="$COREFS $i" + fi + done + mksquashfs $COREFS $PARENT_DIR/image/$LIVEKITNAME/01-core-$COMP_TYPE.$BEXT -comp $COMP_TYPE -b 1024K -always-use-fragments -keep-as-directory -noappend || exit + + elif [ $LIVE_TYPE = "casper" ]; then + + chroot $BUILD_DIR passwd -l root + if cat $BUILD_DIR/etc/passwd | grep /home/live; then + chroot $BUILD_DIR userdel live + fi + + chroot $BUILD_DIR /bin/bash -x <$PARENT_DIR/image/boot/grub/grub.cfg +set default="0" +set timeout="10" +set gfxmode=auto +insmod efi_gop +insmod efi_uga +insmod gfxterm +terminal_output gfxterm +set color_normal=black/black +set color_highlight=black/white +loadfont /boot/grub/unicode.pf2 +background_image /boot/grub/bootlogo.png + +set default_settings="boot=casper quiet splash net.ifnames=0 biosdevname=0" +set persistent_settings="persistent" +set toram_settings="toram" +set integrity_settings="integrity-check" +set ubiquity_settings="only-ubiquity" +set linux_64="/casper/vmlinuz" +set initrd_img="/casper/initrd" +set message="Загружаем ядро и рамдиск... Подождите..." + +menuentry "Запуск MiniOS с сохранением изменений"{ + echo $message + search --set -f $linux_64 + linux $linux_64 $default_settings $persistent_settings + initrd $initrd_img +} +menuentry "Запуск MiniOS в чистом режиме"{ + echo $message + search --set -f $linux_64 + linux $linux_64 $default_settings + initrd $initrd_img +} +menuentry "Запуск MiniOS с загрузкой в RAM"{ + echo $message + search --set -f $linux_64 + linux $linux_64 $default_settings $toram_settings + initrd $initrd_img +} + +menuentry "Установка MiniOS"{ + echo $message + search --set -f $linux_64 + linux $linux_64 $default_settings $ubiquity_settings + initrd $initrd_img +} +menuentry "Установка MiniOS с загрузкой в RAM"{ + echo $message + search --set -f $linux_64 + linux $linux_64 $default_settings $toram_settings $ubiquity_settings + initrd $initrd_img +} + +menuentry "Проверка диска"{ + echo $message + search --set -f $linux_64 + linux $linux_64 $default_settings $integrity_settings + initrd $initrd_img +} +EOF + + cat <<'EOF' | iconv -f 'UTF-8' -t "CP866//TRANSLIT" >$PARENT_DIR/image/boot/syslinux/syslinux.cfg +FONT 866_8x16.psf +DEFAULT vesamenu.c32 +PROMPT 0 +TIMEOUT 90 +ALLOWOPTIONS 0 +ONTIMEOUT default +MENU BACKGROUND bootlogo.png + +MENU COLOR border 30;44 #00000000 #00000000 none +MENU COLOR unsel 37;44 #901E1E1E #00000000 std +MENU COLOR sel 7;37;40 #ff1E1E1E #99006693 all +MENU COLOR hotsel 1;7;37;40 #55555555 #99006693 all + +LABEL default +MENU LABEL Запуск MiniOS с сохранением изменений +KERNEL /casper/vmlinuz +APPEND vga=normal initrd=/casper/initrd boot=casper quiet splash net.ifnames=0 biosdevname=0 persistent + +LABEL live +MENU LABEL Запуск MiniOS в чистом режиме +KERNEL /casper/vmlinuz +APPEND vga=normal initrd=/casper/initrd boot=casper quiet splash net.ifnames=0 biosdevname=0 + +LABEL toram +MENU LABEL Запуск MiniOS с загрузкой в RAM +KERNEL /casper/vmlinuz +APPEND vga=normal initrd=/casper/initrd boot=casper quiet splash net.ifnames=0 biosdevname=0 toram + +LABEL install +MENU LABEL Установка MiniOS +KERNEL /casper/vmlinuz +APPEND vga=normal initrd=/casper/initrd boot=casper quiet splash net.ifnames=0 biosdevname=0 only-ubiquity + +LABEL toram_install +MENU LABEL Установка MiniOS с загрузкой в RAM +KERNEL /casper/vmlinuz +APPEND vga=normal initrd=/casper/initrd boot=casper quiet splash net.ifnames=0 biosdevname=0 toram only-ubiquity + +LABEL integrity +MENU LABEL Проверка диска +KERNEL /casper/vmlinuz +APPEND vga=normal initrd=/casper/initrd boot=casper quiet splash net.ifnames=0 biosdevname=0 integrity-check +EOF + + # generate manifest + chroot $BUILD_DIR dpkg-query -W --showformat='${Package} ${Version}\n' | tee $PARENT_DIR/image/casper/filesystem.manifest >>$OUTPUT 2>&1 + cp -v $PARENT_DIR/image/casper/filesystem.manifest $PARENT_DIR/image/casper/filesystem.manifest-desktop + sed -i '/ubiquity/d' $PARENT_DIR/image/casper/filesystem.manifest-desktop + sed -i '/casper/d' $PARENT_DIR/image/casper/filesystem.manifest-desktop + sed -i '/discover/d' $PARENT_DIR/image/casper/filesystem.manifest-desktop + sed -i '/laptop-detect/d' $PARENT_DIR/image/casper/filesystem.manifest-desktop + sed -i '/os-prober/d' $PARENT_DIR/image/casper/filesystem.manifest-desktop + + # compress rootfs + mksquashfs $BUILD_DIR $PARENT_DIR/image/casper/filesystem.squashfs -comp $COMP_TYPE -b 1024K -always-use-fragments -noappend || exit + printf $(sudo du -sx --block-size=1 $BUILD_DIR | cut -f1) >$PARENT_DIR/image/casper/filesystem.size + + # create diskdefines + cat <$PARENT_DIR/image/README.diskdefines +#define DISKNAME $SYSTEMNAME +#define TYPE binary +#define TYPEbinary 1 +#define ARCH $DISTRIBUTION_ARCH +#define ARCH$DISTRIBUTION_ARCH 1 +#define DISKNUM 1 +#define DISKNUM1 1 +#define TOTALNUM 0 +#define TOTALNUM0 1 +EOF + + # create iso image + pushd $PARENT_DIR/image + + /bin/bash -c "(find . -type f -print0 | xargs -0 md5sum | grep -v -e 'md5sum.txt' -e 'bios.img' -e 'efiboot.img' -e 'isolinux.bin' -e 'boot.cat' > md5sum.txt)" + + popd + fi +} + +function build_iso() { + current_process + + if [ $CONTAINER_TYPE = "1" ]; then + if [ ! -f /.minios-live ]; then + setup_host + fi + fi + + check_build_dir + + if [ "$UNATTENDED" = "1" ]; then + BUILD_DIR="/build/$DISTRIBUTION" + fi + if [ "$BUILD_DIR" = "" ]; then + LAST_BUILD_DIR=$(cat "$SCRIPT_DIR/.build_dir") >>$OUTPUT 2>&1 + BUILD_DIR=$LAST_BUILD_DIR + fi + + cd $PARENT_DIR/image + if [ ! -d $ISO_DIR ]; then + mkdir -p $ISO_DIR + fi + + mkdir -p $ISO_DIR >>$OUTPUT 2>&1 + VER=$SYSTEMVER + DATE=$(date +%Y%m%d_%H%M) + + DIR=$PARENT_DIR/image + ISO=$ISO_DIR/$LIVEKITNAME-$DISTRIBUTION-$DISTRIBUTION_ARCH-$COMP_TYPE-$LIVE_TYPE-$DATE.iso + + B="-b boot/syslinux/isolinux.bin -c boot/syslinux/boot.cat" + C="-no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot" + # ▼ должно быть только перенаправление ошибки! + if [ -x "$(which xorriso 2>>$OUTPUT)" ]; then + M="xorriso -as mkisofs -isohybrid-mbr $DIR/boot/syslinux/isohdpfx.bin" + D=" -isohybrid-gpt-basdat -e" + # ▼ должно быть только перенаправление ошибки! + elif [ -x "$(which genisoimage 2>>$OUTPUT)" ]; then + M=genisoimage + D="-efi-boot" + else + M=mkisofs + D="-eltorito-platform 0xEF -eltorito-boot" + fi + + E="EFI/boot/efiboot.img -no-emul-boot" + + VER="$SYSTEMNAME $VER" + + if [ REMOVE_OLD_ISO = "1" ]; then + rm $ISO_DIR/$LIVEKITNAME-$DISTRIBUTION-$DISTRIBUTION_ARCH-$COMP_TYPE-$LIVE_TYPE-*.iso >>$OUTPUT 2>&1 + fi + + if + ! $M -hide-rr-moved -f -r -J -l -V "$VER" -A "$VER" \ + $B $C $D $E -o $ISO $DIR + then + exit 1 + fi + + echo ">>> $ISO created" + + # xorriso has hybridization built-in + if [ "$(echo $M | cut -d" " -f1)" != "xorriso" ]; then + # ▼ должно быть только перенаправление ошибки! + if [ -x "$(which isohybrid 2>>$OUTPUT)" ]; then + isohybrid -uefi $ISO + else + echo ">>> No isohybrid to hybridize this ISO" + fi + fi + if [ $BUILD_TEST_ISO = "1" ]; then + if [ -L $ISO_DIR/$LIVEKITNAME.iso ]; then + rm $ISO_DIR/$LIVEKITNAME.iso + fi + if ln -s $LIVEKITNAME-$DISTRIBUTION-$DISTRIBUTION_ARCH-$COMP_TYPE-$LIVE_TYPE-$DATE.iso $ISO_DIR/$LIVEKITNAME.iso; then + echo ">>> $ISO_DIR/$LIVEKITNAME.iso created" + fi + fi + exit 0 +} + +function batch_run() { + current_process + + chroot $1 /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $2 +} + +# ================================================================= +# ================================================================= +# ====================== INSTALL FUNCTIONS ======================== +# ================================================================= +# ================================================================= + +function setup_host() { + current_process + + if [ $CONTAINER_TYPE != "2" ]; then + hostreq_pkg_list + fi +} + +function chroot_setup_host() { + current_process + + echo $LIVEKITNAME >/etc/hostname + + prereq_pkg_list + + #configure machine id + dbus-uuidgen >/etc/machine-id >>$OUTPUT 2>&1 + ln -fs /etc/machine-id /var/lib/dbus/machine-id >>$OUTPUT 2>&1 + + # don't understand why, but multiple sources indicate this + dpkg-divert --local --rename --add /sbin/initctl >>$OUTPUT 2>&1 + ln -s /bin/true /sbin/initctl >>$OUTPUT 2>&1 +} + +function hostreq_pkg_list() { + echo -e "${YELLOW}=====> installing required software for host system ...${ENDCOLOUR}" + $APT_CMD update >>$OUTPUT 2>&1 + + # we need this only for trusty container + : 'if [ $CONTAINER_TYPE = "1" ]; then + touch /.minios-live + $APT_CMD install -y wget patch >>$OUTPUT 2>&1 + cd ~ + wget -c http://ru.archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.123ubuntu2_all.deb >>$OUTPUT 2>&1 + dpkg -i ~/debootstrap_1.0.123ubuntu2_all.deb >>$OUTPUT 2>&1 + cat <<'EOF' >/usr/share/debootstrap/functions.diff +--- functions 2020-10-23 20:42:16.000000000 +0300 ++++ functions.new 2021-01-16 23:22:25.612064306 +0300 +@@ -1176,7 +1176,9 @@ + umount_on_exit /dev/shm + umount_on_exit /proc + umount_on_exit /proc/bus/usb +- umount "$TARGET/proc" 2>/dev/null || true ++ if [ ! -h "$TARGET/proc" ]; then ++ umount "$TARGET/proc" 2>/dev/null || true ++ fi + + # some container environment are used at second-stage, it already treats /proc and so on + if [ -z "$(ls -A "$TARGET/proc")" ]; then + +EOF + cd /usr/share/debootstrap/ + patch >$OUTPUT 2>&1 + else + #sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install -y sudo debootstrap xorriso >>$OUTPUT 2>&1 + fi +} + +function prereq_pkg_list() { + echo -e "${YELLOW}=====> installing prerequested software for chroot system ...${ENDCOLOUR}" + + if [ -f $SCRIPT_DIR/pkglists/prereq.list ]; then + $APT_CMD update >>$OUTPUT 2>&1 && + echo -e "${YELLOW}=====> upgrading chroot system ...${ENDCOLOUR}" && + $APT_CMD upgrade $APT_OPTIONS >>$OUTPUT 2>&1 && + echo -e "${YELLOW}=====> installing packages ...${ENDCOLOUR}" && + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/prereq.list | tr "\n" " ") >>$OUTPUT 2>&1 + fi +} + +function main_pkg_list() { + echo -e "${YELLOW}=====> installing main packages for chroot system ...${ENDCOLOUR}" + + if [ -f $SCRIPT_DIR/pkglists/main.list ]; then + #sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + # $APT_CMD update >>$OUTPUT 2>&1 && + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/main.list | tr "\n" " ") >>$OUTPUT 2>&1 + fi + if [ $LIVE_TYPE = "casper" ]; then + if [ -f $SCRIPT_DIR/pkglists/ubuntu-main.list ]; then + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/ubuntu-main.list | tr "\n" " ") >>$OUTPUT 2>&1 + fi + if [ -f $SCRIPT_DIR/pkglists/ubuntu-gui.list ]; then + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/ubuntu-gui.list | tr "\n" " ") >>$OUTPUT 2>&1 + #$APT_CMD install $APT_OPTIONS /linux-live/packages/chromium_88.0.4324.96~linuxmint1+ulyssa_amd64.deb >>$OUTPUT 2>&1 + fi + if [ -f $SCRIPT_DIR/pkglists/ubuntu-ubiquity.list ]; then + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/ubuntu-ubiquity.list | tr "\n" " ") >>$OUTPUT 2>&1 + fi + fi +} + +function other_pkg_list() { + echo -e "${YELLOW}=====> installing other packages for chroot system ...${ENDCOLOUR}" + + if [ $LIVE_TYPE = "casper" ]; then + if [ -f $SCRIPT_DIR/pkglists/ubuntu-other.list ]; then + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update >>$OUTPUT 2>&1 && + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/ubuntu-other.list | tr "\n" " ") >>$OUTPUT 2>&1 + fi + fi + if [ -f $SCRIPT_DIR/pkglists/other.list ]; then + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update >>$OUTPUT 2>&1 && + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/other.list | tr "\n" " ") >>$OUTPUT 2>&1 + fi +} + +function chroot_pkg_install() { + current_process + + main_pkg_list + + other_pkg_list + + # remove unused + $APT_CMD autoremove $APT_OPTIONS >>$OUTPUT 2>&1 + + # clean up apt cache + $APT_CMD clean $APT_OPTIONS >>$OUTPUT 2>&1 +} + +function chroot_configure() { + current_process + + if [ $LIVE_TYPE = "livekit" ]; then + (cd /linux-live/rootcopy-livekit && cp --parents -afr * /) + + echo "Set up password for user 'root'" >>$OUTPUT 2>&1 + echo root:toor | chpasswd >>$OUTPUT 2>&1 + + echo "Set up user 'live'" >>$OUTPUT 2>&1 + adduser --gecos '' live --disabled-password >>$OUTPUT 2>&1 + echo "Set up password for user 'live'" >>$OUTPUT 2>&1 + echo live:evil | chpasswd >>$OUTPUT 2>&1 + addgroup live adm >>$OUTPUT 2>&1 + addgroup live sudo >>$OUTPUT 2>&1 + + cat </etc/sudoers.d/90-minios +# live user is default user in minios. +# It needs passwordless sudo functionality. +live ALL=(ALL) NOPASSWD:ALL +EOF + + if [ -d /etc/lightdm ]; then + cat </etc/lightdm/lightdm.conf +[Seat:*] +autologin-session=xubuntu +autologin-user=live +autologin-user-timeout=0 +EOF + fi + + if [ ! -d /etc/NetworkManager ]; then + echo "Enable dhclient.service autostart." >>$OUTPUT 2>&1 + cat </lib/systemd/system/dhclient.service +[Unit] +Description=DHCP Client +Documentation=man:dhclient(8) +Wants=network.target +After=network-pre.target systemd-sysctl.service systemd-modules-load.service +Before=network.target shutdown.target network-online.target +ConditionPathExists=!/run/initramfs/net.up.flag + +[Service] +Type=forking +ExecStart=-/bin/sh -c 'udevadm settle && dhclient -nw' +PIDFile=/run/dhclient.pid + +[Install] +WantedBy=multi-user.target +WantedBy=network-online.target +EOF + systemctl enable dhclient >>$OUTPUT 2>&1 + fi + + if [ -f /etc/systemd/system/multi-user.target.wants/grub-initrd-fallback.service ]; then + echo "Disable grub-initrd-fallback.service autostart." + systemctl disable grub-initrd-fallback.service + fi + + 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 + elif [ $LIVE_TYPE = "casper" ]; then + (cd /linux-live/rootcopy-casper && cp --parents -afr * /) + fi + + if [ $DEBIAN_FRONTEND_TYPE = "noninteractive" ]; then + # configure console and keyboard + cat </etc/default/console-setup +# CONFIGURATION FILE FOR SETUPCON + +# Consult the console-setup(5) manual page. + +ACTIVE_CONSOLES="/dev/tty[1-6]" + +CHARMAP="UTF-8" + +CODESET="guess" +FONTFACE="Fixed" +FONTSIZE="8x16" + +VIDEOMODE= + +# The following is an example how to use a braille font +# FONT='lat9w-08.psf.gz brl-8x8.psf' +EOF + cat </etc/default/keyboard +# KEYBOARD CONFIGURATION FILE + +# Consult the keyboard(5) manual page. + +XKBMODEL="pc105" +XKBLAYOUT="us,ru" +XKBVARIANT="," +XKBOPTIONS="grp:alt_shift_toggle,grp_led:scroll" + +BACKSPACE="guess" + +EOF + dpkg-reconfigure -f noninteractive console-setup >>$OUTPUT 2>&1 + + # configure timezone + echo "tzdata tzdata/Areas select Europe" | debconf-set-selections -v >>$OUTPUT 2>&1 + echo "tzdata tzdata/Zones/Europe select Moscow" | debconf-set-selections -v >>$OUTPUT 2>&1 + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704089 + rm -f /etc/localtime /etc/timezone >>$OUTPUT 2>&1 + dpkg-reconfigure -f noninteractive tzdata >>$OUTPUT 2>&1 + + # configure locales + sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen >>$OUTPUT 2>&1 && + sed -i -e 's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/' /etc/locale.gen >>$OUTPUT 2>&1 + # Set system locale + echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8, ru_RU.UTF-8 UTF-8" | debconf-set-selections -v >>$OUTPUT 2>&1 + echo "locales locales/default_environment_locale select ru_RU.UTF-8" | debconf-set-selections -v >>$OUTPUT 2>&1 + dpkg-reconfigure -f noninteractive locales >>$OUTPUT 2>&1 + update-locale LANGUAGE=ru_RU.UTF-8 >>$OUTPUT 2>&1 + update-locale LANG=ru_RU.UTF-8 >>$OUTPUT 2>&1 + update-locale LC_ALL=ru_RU.UTF-8 >>$OUTPUT 2>&1 + if grep localepurge $SCRIPT_DIR/pkglists/main.list >>$OUTPUT 2>&1; then + echo "localepurge localepurge/nopurge debconf-set-selections multiselect en_US.UTF-8, ru_RU.UTF-8" | debconf-set-selections -v >>$OUTPUT 2>&1 + echo "localepurge localepurge/use-dpkg-feature boolean true" | debconf-set-selections -v >>$OUTPUT 2>&1 + dpkg-reconfigure -f noninteractive localepurge >>$OUTPUT 2>&1 + fi + + # configure resolvconf + if grep resolvconf $SCRIPT_DIR/pkglists/main.list >>$OUTPUT 2>&1 || grep resolvconf $SCRIPT_DIR/pkglists/other.list || [ $DISTRIBUTION != "xenial" ] >>$OUTPUT 2>&1; then + echo "resolvconf resolvconf/linkify-resolvconf boolean true" | debconf-set-selections + dpkg-reconfigure -f noninteractive resolvconf >>$OUTPUT 2>&1 + fi + + if [ $LIVE_TYPE = "casper" ]; then + # network manager + cat </etc/NetworkManager/NetworkManager.conf +[main] +rc-manager=resolvconf +plugins=ifupdown,keyfile +dns=dnsmasq +[ifupdown] +managed=false +EOF + dpkg-reconfigure -f noninteractive network-manager >>$OUTPUT 2>&1 + fi + elif [ $DEBIAN_FRONTEND_TYPE = "dialog" ]; then + + #dpkg-reconfigure console-setup + + # configure timezone and locale + #dpkg-reconfigure tzdata + dpkg-reconfigure locales + #dpkg-reconfigure localepurge + #localepurge -v + + # configure resolvconf + if grep resolvconf $SCRIPT_DIR/pkglists/main.list >>$OUTPUT 2>&1 || grep resolvconf $SCRIPT_DIR/pkglists/other.list || [ $DISTRIBUTION != "xenial" ] >>$OUTPUT 2>&1; then + dpkg-reconfigure resolvconf + fi + + if [ $LIVE_TYPE = "casper" ]; then + # network manager + cat </etc/NetworkManager/NetworkManager.conf +[main] +rc-manager=resolvconf +plugins=ifupdown,keyfile +dns=dnsmasq +[ifupdown] +managed=false +EOF + dpkg-reconfigure network-manager >>$OUTPUT 2>&1 + fi + fi + + if [ $LIVE_TYPE = "casper" ]; then + + # Install stuff from livekit modules + if [ $INSTALL_OPTIONAL = "1" ]; then + if [ -f /linux-live/modules/03-apps/preinstall ]; then + chmod +x /linux-live/modules/03-apps/preinstall + /usr/bin/env \ + OUTPUT=$OUTPUT \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /linux-live/modules/03-apps/preinstall + fi + if [ "$(ls -A /linux-live/modules/03-apps/rootcopy)" != "" ]; then + (cd /linux-live/modules/03-apps/rootcopy && cp --parents -afr * /) + fi + if [ -f /linux-live/modules/03-apps/install ]; then + chmod +x /linux-live/modules/03-apps/install + /usr/bin/env \ + OUTPUT=$OUTPUT \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /linux-live/modules/03-apps/install + fi + if [ -f /linux-live/modules/03-apps/postinstall ]; then + chmod +x /linux-live/modules/03-apps/postinstall + /usr/bin/env \ + OUTPUT=$OUTPUT \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /linux-live/modules/03-apps/postinstall + fi + + if [ -f /linux-live/modules/04-drivers/preinstall ]; then + chmod +x /linux-live/modules/04-drivers/preinstall + /usr/bin/env \ + OUTPUT=$OUTPUT \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /linux-live/modules/04-drivers/preinstall + fi + if [ "$(ls -A /linux-live/modules/04-drivers/rootcopy)" != "" ]; then + (cd /linux-live/modules/04-drivers/rootcopy && cp --parents -afr * /) + fi + if [ -f /linux-live/modules/04-drivers/install ]; then + chmod +x /linux-live/modules/04-drivers/install + /usr/bin/env \ + OUTPUT=$OUTPUT \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /linux-live/modules/04-drivers/install + fi + + if [ -f /linux-live/modules/04-drivers/postinstall ]; then + chmod +x /linux-live/modules/04-drivers/postinstall + /usr/bin/env \ + OUTPUT=$OUTPUT \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /linux-live/modules/04-drivers/postinstall + fi + fi + + update-alternatives --install /usr/share/plymouth/themes/default.plymouth default.plymouth /usr/share/plymouth/themes/minios-logo/minios-logo.plymouth 200 + update-alternatives --install /usr/share/plymouth/themes/text.plymouth text.plymouth /usr/share/plymouth/themes/minios-text/minios-text.plymouth 200 + update-alternatives --config default.plymouth --skip-auto + + if [ $COMP_TYPE = "xz" ]; then + sed -i "s,COMPRESS=lz4,COMPRESS=xz,g" /etc/initramfs-tools/initramfs.conf + fi + update-initramfs -u + + fi + + if [ -f /usr/share/xfce4/backdrops/xubuntu-wallpaper.png ]; then + rm /usr/share/xfce4/backdrops/xubuntu-wallpaper.png + fi + if [ ! -d /usr/share/xfce4/backdrops ]; then + mkdir -p /usr/share/xfce4/backdrops + fi + ln -s /usr/share/backgrounds/MiniOS.png /usr/share/xfce4/backdrops/xubuntu-wallpaper.png + +} + +function chroot_finish_up() { + current_process + + # truncate machine id (why??) + truncate -s 0 /etc/machine-id >>$OUTPUT 2>&1 + + # remove diversion (why??) + rm /sbin/initctl >>$OUTPUT 2>&1 + dpkg-divert --rename --remove /sbin/initctl >>$OUTPUT 2>&1 + + # remove ssh config + #rm -f /etc/ssh/ssh_host* + + # clean up useless stuff + rm -rf /tmp/* ~/.bash_history >>$OUTPUT 2>&1 + rm -rf ~/.cache + 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 + rm -f /var/cache/fontconfig/* >>$OUTPUT 2>&1 + rm -f /var/cache/apt/archives/*.deb >>$OUTPUT 2>&1 + rm -f /var/cache/apt/*.bin >>$OUTPUT 2>&1 + rm -f /var/cache/debconf/*-old >>$OUTPUT 2>&1 + rm -f /var/lib/apt/extended_states >>$OUTPUT 2>&1 + rm -f /var/lib/apt/lists/*Packages >>$OUTPUT 2>&1 + rm -f /var/lib/apt/lists/*Translation* >>$OUTPUT 2>&1 + rm -f /var/lib/apt/lists/*InRelease >>$OUTPUT 2>&1 + rm -f /var/lib/apt/lists/deb.* >>$OUTPUT 2>&1 + rm -f /var/lib/dpkg/*-old >>$OUTPUT 2>&1 +} + +# ================================================================= +# ================================================================= +# ======================= MODULE FUNCTIONS ======================== +# ================================================================= +# ================================================================= + +function module_check_mounted() { + echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..." + if grep -qs "$MODULE_MERGED_DIR" /proc/mounts || grep -qs "$MODULE_MERGED_DIR/dev" /proc/mounts || grep -qs "$MODULE_MERGED_DIR/run" /proc/mounts || grep -qs "$MODULE_MERGED_DIR/proc" /proc/mounts || grep -qs "$MODULE_MERGED_DIR/sys" /proc/mounts || grep -qs "$MODULE_MERGED_DIR/dev/pts" /proc/mounts || grep -qs "$MODULE_MERGED_DIR/tmp" /proc/mounts; then + echo -e "${BOLD}${LIGHTYELLOW}Сhroot contains mounted filesystems.${ENDCOLOUR}" + if [ "$UNATTENDED" = "1" ]; then + module_chroot_umount_fs + else + read -r -p "$(echo -e ""Do you want to ${GREEN}unmount them${ENDCOLOUR}? [${BOLD}${GREEN}Y${ENDCOLOUR}/n])" response + response=${response,,} + if [[ "$response" =~ ^(no|n)$ ]]; then + exit 1 + else + module_chroot_umount_fs + fi + fi + fi +} + +function module_check_build_dir() { + echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..." + if [ "$UNATTENDED" = "1" ]; then + #echo -e "${RED}!!!Unattended installation!!!${ENDCOLOUR}" + echo -e "The working directory is ${MAGENTA}$MODULE_UPPER_DIR${ENDCOLOUR}." + if [ "$(ls -A $MODULE_UPPER_DIR)" != "" ]; then + module_cleanup + module_check_mounted + fi + else + # ▼ должно быть только перенаправление ошибки! + if [ "$(ls -A $MODULE_UPPER_DIR)" != "" ]; then + echo -e "${MAGENTA}$MODULE_UPPER_DIR${ENDCOLOUR} is not empty." + module_cleanup + module_check_mounted + echo -e "The working directory is ${MAGENTA}$MODULE_MERGED_DIR${ENDCOLOUR}." + else + module_check_mounted + echo -e "The working directory is ${MAGENTA}$MODULE_MERGED_DIR${ENDCOLOUR}." + fi + fi +} + +function module_chroot_mount_fs() { + echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..." + + local MODULES MODULE_LOWER_DIR + + #if [ ! -d $MODULE_MERGED_DIR/dev ]; then + # mkdir $MODULE_MERGED_DIR/dev + #fi + + module_check_mounted + + MODULES_LIST="" + MODULES=($PARENT_DIR/image/$LIVEKITNAME/*.$BEXT) + for ((i = ${#MODULES[@]} - 1; i >= 0; i--)); do + MODULE_LOWER_DIR=$(basename ${MODULES[$i]} .$BEXT) + mkdir -p $MODULES_DIR/lower/$MODULE_LOWER_DIR-lower + mount ${MODULES[$i]} $MODULES_DIR/lower/$MODULE_LOWER_DIR-lower + MODULES_LIST=$MODULES_LIST":""$MODULES_DIR/lower/$MODULE_LOWER_DIR-lower" + done + MODULES_LIST=${MODULES_LIST:1} + + mkdir -p $MODULE_UPPER_DIR $MODULE_WORK_DIR $MODULE_MERGED_DIR + + mount -t overlay overlay -o lowerdir=$MODULES_LIST,upperdir=$MODULE_UPPER_DIR,workdir=$MODULE_WORK_DIR $MODULE_MERGED_DIR + + if [ ! -d $MODULE_MERGED_DIR/dev ]; then + mkdir -p $MODULE_MERGED_DIR/dev + fi + if [ ! -d $MODULE_MERGED_DIR/run ]; then + mkdir -p $MODULE_MERGED_DIR/run + fi + if [ ! -d $MODULE_MERGED_DIR/proc ]; then + mkdir -p $MODULE_MERGED_DIR/proc + fi + if [ ! -d $MODULE_MERGED_DIR/sys ]; then + mkdir -p $MODULE_MERGED_DIR/sys + fi + if [ ! -d $MODULE_MERGED_DIR/tmp ]; then + mkdir -p $MODULE_MERGED_DIR/tmp + fi + + : 'if [ -f /.dockerenv ] || [ "$container" = "podman" ]; then + ln -s /dev $MODULE_MERGED_DIR/dev + ln -s /run $MODULE_MERGED_DIR/run + ln -s /proc $MODULE_MERGED_DIR/proc + ln -s /sys $MODULE_MERGED_DIR/sys + ln -s /tmp $MODULE_MERGED_DIR/tmp + else' + + mount --bind /dev $MODULE_MERGED_DIR/dev + if [ -f /.dockerenv ] || [ "$container" = "podman" ]; then + mkdir -p $MODULE_MERGED_DIR/run/resolvconf + touch $MODULE_MERGED_DIR/run/resolvconf/resolv.conf + mount --bind /etc/resolv.conf $MODULE_MERGED_DIR/run/resolvconf/resolv.conf + else + mount --bind /run $MODULE_MERGED_DIR/run + fi + mount none -t proc $MODULE_MERGED_DIR/proc + mount none -t sysfs $MODULE_MERGED_DIR/sys + mount none -t devpts $MODULE_MERGED_DIR/dev/pts + mount none -t tmpfs $MODULE_MERGED_DIR/tmp + #fi +} + +function module_chroot_umount_fs() { + echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..." + + local MODULES MODULE_LOWER_DIR + + : 'if [ -f /.dockerenv ] || [ "$container" = "podman" ]; then + set +e + rm -f $MODULE_MERGED_DIR/dev >>$OUTPUT 2>&1 + rm -f $MODULE_MERGED_DIR/run >>$OUTPUT 2>&1 + rm -f $MODULE_MERGED_DIR/proc >>$OUTPUT 2>&1 + rm -f $MODULE_MERGED_DIR/sys >>$OUTPUT 2>&1 + rm -f $MODULE_MERGED_DIR/tmp >>$OUTPUT 2>&1 + set -e + else' + set +e + umount $MODULE_MERGED_DIR/proc >>$OUTPUT 2>&1 + umount $MODULE_MERGED_DIR/sys >>$OUTPUT 2>&1 + umount $MODULE_MERGED_DIR/dev/pts >>$OUTPUT 2>&1 + umount $MODULE_MERGED_DIR/tmp >>$OUTPUT 2>&1 + umount $MODULE_MERGED_DIR/dev >>$OUTPUT 2>&1 + if [ -f /.dockerenv ] || [ "$container" = "podman" ]; then + umount $MODULE_MERGED_DIR/run/resolvconf/resolv.conf >>$OUTPUT 2>&1 + rm -f $MODULE_MERGED_DIR/run/resolvconf/resolv.conf + rmdir -f $MODULE_MERGED_DIR/run/resolvconf + else + umount $MODULE_MERGED_DIR/run >>$OUTPUT 2>&1 + fi + umount $MODULE_MERGED_DIR >>$OUTPUT 2>&1 + set -e + #fi + + MODULES=($PARENT_DIR/image/$LIVEKITNAME/*.$BEXT) + for ((i = ${#MODULES[@]} - 1; i >= 0; i--)); do + MODULE_LOWER_DIR=$(basename ${MODULES[$i]} .$BEXT) + umount $MODULES_DIR/lower/$MODULE_LOWER_DIR-lower + done + + module_check_mounted +} + +function module_cleanup() { + echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..." + if [ "$UNATTENDED" = "1" ]; then + module_check_mounted + rm -rf $MODULE_UPPER_DIR + if [ -d "$MODULE_UPPER_DIR" ]; then + module_cleanup + fi + else + read -r -p "$(echo -e ""Do you want to ${BOLD}${RED}completely remove content${ENDCOLOUR} of ${MAGENTA}$MODULE_UPPER_DIR${ENDCOLOUR}? [y/${BOLD}${GREEN}N${ENDCOLOUR}])" response + response=${response,,} + if [[ "$response" =~ ^(yes|y)$ ]]; then + module_check_mounted + rm -rf $MODULE_UPPER_DIR + if [ -d "$MODULE_UPPER_DIR" ]; then + module_cleanup + fi + else + echo -e "${MAGENTA}$MODULE_UPPER_DIR${ENDCOLOUR} should be empty to continue." + exit 1 + fi + fi +} + +function module_chroot_finish_up() { + current_process + + # truncate machine id (why??) + chroot $MODULE_MERGED_DIR /bin/bash -x <>$OUTPUT 2>&1 + dpkg-divert --rename --remove /sbin/initctl >>$OUTPUT 2>&1 +EOF + + # clean up useless stuff + rm -rf $MODULE_UPPER_DIR/boot $MODULE_UPPER_DIR/dev $MODULE_UPPER_DIR/proc $MODULE_UPPER_DIR/sys $MODULE_UPPER_DIR/rmp $MODULE_UPPER_DIR/run + rm -f $MODULE_UPPER_DIR/root/.bash_history >>$OUTPUT 2>&1 + rm -rf $MODULE_UPPER_DIR/.cache + find $MODULE_UPPER_DIR/var/log/ -type f | xargs rm -f >>$OUTPUT 2>&1 + rm -f $MODULE_UPPER_DIR/etc/ssh/ssh_host* + rm -f $MODULE_UPPER_DIR/var/backups/* >>$OUTPUT 2>&1 + rm -f $MODULE_UPPER_DIR/var/cache/ldconfig/* >>$OUTPUT 2>&1 + #rm -f $MODULE_UPPER_DIR/var/cache/debconf/* >>$OUTPUT 2>&1 + rm -f $MODULE_UPPER_DIR/var/cache/fontconfig/* >>$OUTPUT 2>&1 + rm -f $MODULE_UPPER_DIR/var/cache/apt/archives/*.deb >>$OUTPUT 2>&1 + rm -f $MODULE_UPPER_DIR/var/cache/apt/*.bin >>$OUTPUT 2>&1 + rm -f $MODULE_UPPER_DIR/var/cache/debconf/*-old >>$OUTPUT 2>&1 + rm -f $MODULE_UPPER_DIR/var/lib/apt/extended_states >>$OUTPUT 2>&1 + rm -f $MODULE_UPPER_DIR/var/lib/apt/lists/*Packages >>$OUTPUT 2>&1 + rm -f $MODULE_UPPER_DIR/var/lib/apt/lists/*Translation* >>$OUTPUT 2>&1 + rm -f $MODULE_UPPER_DIR/var/lib/apt/lists/*InRelease >>$OUTPUT 2>&1 + rm -f $MODULE_UPPER_DIR/var/lib/apt/lists/deb.* >>$OUTPUT 2>&1 + rm -f $MODULE_UPPER_DIR/var/lib/dpkg/*-old >>$OUTPUT 2>&1 + rm -f /preinstall + rm -f /install + rm -f /packages.list + rm -f /postinstall +} + +function build_modules_chroot() { + current_process + + if [ $LIVE_TYPE = "casper" ]; then + return 0 + fi + + if [ $CONTAINER_TYPE = "1" ]; then + if [ ! -f /.minios-live ]; then + setup_host + fi + fi + + MODULES_DIR=$PARENT_DIR/modules + + cd $SCRIPT_DIR/linux-live/modules + + for MODULE in *; do + if (ls $PARENT_DIR/image/$LIVEKITNAME/*.$BEXT | grep -q $MODULE 2>/dev/null); then + echo -e "${RED}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!${ENDCOLOUR}" + echo -e "Please remove ${MAGENTA}$PARENT_DIR/image/$LIVEKITNAME/$MODULE.$BEXT${ENDCOLOUR} if you want to build ${MAGENTA}$MODULE${ENDCOLOUR}." + echo -e "${RED}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!${ENDCOLOUR}" + else + MODULE_UPPER_DIR="$MODULES_DIR/$MODULE-upper" + MODULE_WORK_DIR="$MODULES_DIR/$MODULE-work" + MODULE_MERGED_DIR="$MODULES_DIR/$MODULE-merged" + + module_check_build_dir + + module_chroot_mount_fs + + # run pre-install script + if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/preinstall ]; then + cp $SCRIPT_DIR/linux-live/modules/$MODULE/preinstall $MODULE_MERGED_DIR/preinstall + chmod +x $MODULE_MERGED_DIR/preinstall + chroot $MODULE_MERGED_DIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /preinstall >>$OUTPUT 2>&1 + fi + + : '# install packages + if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/package.list ]; then + if [ -d /opt/minios-live ] || [ -f /.minios-live-container ]; then + chroot $MODULE_MERGED_DIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update >>$OUTPUT 2>&1 && + chroot $MODULE_MERGED_DIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/linux-live/modules/$MODULE/package.list | tr "\n" " ") >>$OUTPUT 2>&1 + else + chroot $MODULE_MERGED_DIR sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update >>$OUTPUT 2>&1 && + chroot $MODULE_MERGED_DIR sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/linux-live/modules/$MODULE/package.list | tr "\n" " ") >>$OUTPUT 2>&1 + fi + fi' + + # copy files + if [ "$(ls -A $SCRIPT_DIR/linux-live/modules/$MODULE/rootcopy)" != "" ]; then + (cd $SCRIPT_DIR/linux-live/modules/$MODULE/rootcopy && cp --parents -afr * $MODULE_MERGED_DIR/) + fi + + # run install script + if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/install ]; then + cp $SCRIPT_DIR/linux-live/modules/$MODULE/install $MODULE_MERGED_DIR/install + chmod +x $MODULE_MERGED_DIR/install + if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/package.list ]; then + cp $SCRIPT_DIR/linux-live/modules/$MODULE/package.list $MODULE_MERGED_DIR/package.list + fi + chroot $MODULE_MERGED_DIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /install >>$OUTPUT 2>&1 + fi + + # run post-install script + if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/postinstall ]; then + cp $SCRIPT_DIR/linux-live/modules/$MODULE/postinstall $MODULE_MERGED_DIR/postinstall + chmod +x $MODULE_MERGED_DIR/postinstall + chroot $MODULE_MERGED_DIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /postinstall >>$OUTPUT 2>&1 + fi + + module_chroot_finish_up + + module_chroot_umount_fs + + if [ ! -f $PARENT_DIR/image/$LIVEKITNAME/$MODULE.$BEXT ]; then + build_modules_live + fi + + fi + done +} + +function build_modules_live() { + current_process + + if [ $LIVE_TYPE = "casper" ]; then + return 0 + fi + + if [ $CONTAINER_TYPE = "1" ]; then + if [ ! -f /.minios-live ]; then + setup_host + fi + fi + + MODULES_DIR=$PARENT_DIR/modules + + cd $SCRIPT_DIR/linux-live/modules + + for MODULE in *; do + + if (ls $PARENT_DIR/image/$LIVEKITNAME/*.$BEXT | grep -q $MODULE 2>/dev/null); then + echo -e "${RED}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!${ENDCOLOUR}" + echo -e "Please remove ${MAGENTA}$PARENT_DIR/image/$LIVEKITNAME/$MODULE.$BEXT${ENDCOLOUR} if you want to build ${MAGENTA}$MODULE${ENDCOLOUR}." + echo -e "${RED}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!${ENDCOLOUR}" + else + + MODULE_UPPER_DIR="$MODULES_DIR/$MODULE-upper" + MODULE_WORK_DIR="$MODULES_DIR/$MODULE-work" + MODULE_MERGED_DIR="$MODULES_DIR/$MODULE-merged" + + if [ "$(ls -A $MODULE_UPPER_DIR)" != "" ]; then + + # create compressed 01-core.sb + : 'cd $MODULE_UPPER_DIR + COREFS="" + for i in $MKMOD; do + if [ -d /$i ]; then + COREFS="$COREFS $i" + fi + done + mksquashfs $COREFS $PARENT_DIR/image/$LIVEKITNAME/$MODULE.$BEXT -comp $COMP_TYPE -b 1024K -always-use-fragments -keep-as-directory -noappend || exit' + + mksquashfs $MODULE_UPPER_DIR $PARENT_DIR/image/$LIVEKITNAME/$MODULE-$COMP_TYPE.$BEXT -comp $COMP_TYPE -b 1024K -always-use-fragments -noappend || exit + else + echo -e "${MAGENTA}$BUILD_DIR${ENDCOLOUR} is empty. Nothing to do." + fi + fi + done +} diff --git a/linux-live/minioslib.test b/linux-live/minioslib.test new file mode 100644 index 0000000..a402cb5 --- /dev/null +++ b/linux-live/minioslib.test @@ -0,0 +1,247 @@ +function build_modules_chroot() { + current_process + + if [ $LIVE_TYPE = "casper" ]; then + #return 0 + + chroot_mount_fs + + cd $SCRIPT_DIR/linux-live/modules + + for MODULE in *; do + if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/preinstall ]; then + cp $SCRIPT_DIR/linux-live/modules/$MODULE/preinstall $BUILDDIR/preinstall + chmod +x $BUILDDIR/preinstall + chroot $BUILDDIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /preinstall >>$OUTPUT 2>&1 + fi + + # copy files + if [ "$(ls -A $SCRIPT_DIR/linux-live/modules/$MODULE/rootcopy)" != "" ]; then + (cd $SCRIPT_DIR/linux-live/modules/$MODULE/rootcopy && cp --parents -afr * $BUILDDIR/) + fi + + # run install script + if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/install ]; then + cp $SCRIPT_DIR/linux-live/modules/$MODULE/install $BUILDDIR/install + chmod +x $BUILDDIR/install + if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/package.list ]; then + cp $SCRIPT_DIR/linux-live/modules/$MODULE/package.list $BUILDDIR/package.list + fi + chroot $BUILDDIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /install >>$OUTPUT 2>&1 + fi + + # run post-install script + if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/postinstall ]; then + cp $SCRIPT_DIR/linux-live/modules/$MODULE/postinstall $BUILDDIR/postinstall + chmod +x $BUILDDIR/postinstall + chroot $BUILDDIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /postinstall >>$OUTPUT 2>&1 + fi + + chroot_finish_up + + chroot_umount_fs + done + fi + + if [ $CONTAINER_TYPE = "1" ]; then + if [ ! -f /.minios-live ]; then + setup_host + fi + fi + + MODULES_DIR=$PARENT_DIR/modules + + cd $SCRIPT_DIR/linux-live/modules + + for MODULE in *; do + if (ls $PARENT_DIR/image/$LIVEKITNAME/*.$BEXT | grep -q $MODULE 2>/dev/null); then + echo -e "${RED}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!${ENDCOLOUR}" + echo -e "Please remove ${MAGENTA}$PARENT_DIR/image/$LIVEKITNAME/$MODULE.$BEXT${ENDCOLOUR} if you want to build ${MAGENTA}$MODULE${ENDCOLOUR}." + echo -e "${RED}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!${ENDCOLOUR}" + else + MODULE_UPPER_DIR="$MODULES_DIR/$MODULE-upper" + MODULE_WORK_DIR="$MODULES_DIR/$MODULE-work" + MODULE_MERGED_DIR="$MODULES_DIR/$MODULE-merged" + + module_check_build_dir + + module_chroot_mount_fs + + # run pre-install script + if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/preinstall ]; then + cp $SCRIPT_DIR/linux-live/modules/$MODULE/preinstall $BUILDDIR/preinstall + chmod +x $BUILDDIR/preinstall + chroot $BUILDDIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /preinstall >>$OUTPUT 2>&1 + fi + + : '# install packages + if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/package.list ]; then + if [ -d /opt/minios-live ] || [ -f /.minios-live-container ]; then + chroot $BUILDDIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update >>$OUTPUT 2>&1 && + chroot $BUILDDIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/linux-live/modules/$MODULE/package.list | tr "\n" " ") >>$OUTPUT 2>&1 + else + chroot $BUILDDIR sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update >>$OUTPUT 2>&1 && + chroot $BUILDDIR sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/linux-live/modules/$MODULE/package.list | tr "\n" " ") >>$OUTPUT 2>&1 + fi + fi' + + # copy files + if [ "$(ls -A $SCRIPT_DIR/linux-live/modules/$MODULE/rootcopy)" != "" ]; then + (cd $SCRIPT_DIR/linux-live/modules/$MODULE/rootcopy && cp --parents -afr * $BUILDDIR/) + fi + + # run install script + if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/install ]; then + cp $SCRIPT_DIR/linux-live/modules/$MODULE/install $BUILDDIR/install + chmod +x $BUILDDIR/install + if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/package.list ]; then + cp $SCRIPT_DIR/linux-live/modules/$MODULE/package.list $BUILDDIR/package.list + fi + chroot $BUILDDIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /install >>$OUTPUT 2>&1 + fi + + # run post-install script + if [ -f $SCRIPT_DIR/linux-live/modules/$MODULE/postinstall ]; then + cp $SCRIPT_DIR/linux-live/modules/$MODULE/postinstall $BUILDDIR/postinstall + chmod +x $BUILDDIR/postinstall + chroot $BUILDDIR /usr/bin/env \ + OUTPUT=$OUTPUT \ + LOGPATH=$LOGPATH \ + BUILD_TEST_ISO=$BUILD_TEST_ISO \ + CREATE_BACKUP=$CREATE_BACKUP \ + DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ + APT_CMD=$APT_CMD \ + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE \ + /postinstall >>$OUTPUT 2>&1 + fi + + module_chroot_finish_up + + module_chroot_umount_fs + + if [ ! -f $PARENT_DIR/image/$LIVEKITNAME/$MODULE.$BEXT ]; then + build_modules_live + fi + + fi + done +} + +function build_modules_live() { + current_process + + if [ $LIVE_TYPE = "casper" ]; then + return 0 + fi + + if [ $CONTAINER_TYPE = "1" ]; then + if [ ! -f /.minios-live ]; then + setup_host + fi + fi + + MODULES_DIR=$PARENT_DIR/modules + + cd $SCRIPT_DIR/linux-live/modules + + for MODULE in *; do + + if (ls $PARENT_DIR/image/$LIVEKITNAME/*.$BEXT | grep -q $MODULE 2>/dev/null); then + echo -e "${RED}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!${ENDCOLOUR}" + echo -e "Please remove ${MAGENTA}$PARENT_DIR/image/$LIVEKITNAME/$MODULE.$BEXT${ENDCOLOUR} if you want to build ${MAGENTA}$MODULE${ENDCOLOUR}." + echo -e "${RED}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!${ENDCOLOUR}" + else + + MODULE_UPPER_DIR="$MODULES_DIR/$MODULE-upper" + MODULE_WORK_DIR="$MODULES_DIR/$MODULE-work" + MODULE_MERGED_DIR="$MODULES_DIR/$MODULE-merged" + + if [ "$(ls -A $MODULE_UPPER_DIR)" != "" ]; then + + # create compressed 01-core.sb + : 'cd $MODULE_UPPER_DIR + COREFS="" + for i in $MKMOD; do + if [ -d /$i ]; then + COREFS="$COREFS $i" + fi + done + mksquashfs $COREFS $PARENT_DIR/image/$LIVEKITNAME/$MODULE.$BEXT -comp $COMP_TYPE -b 1024K -always-use-fragments -keep-as-directory -noappend || exit' + + mksquashfs $MODULE_UPPER_DIR $PARENT_DIR/image/$LIVEKITNAME/$MODULE-$COMP_TYPE.$BEXT -comp $COMP_TYPE -b 1024K -always-use-fragments -noappend || exit + else + echo -e "${MAGENTA}$BUILD_DIR${ENDCOLOUR} is empty. Nothing to do." + fi + fi + done +} diff --git a/linux-live/modules/02-xubuntu/install b/linux-live/modules/02-xubuntu/install new file mode 100644 index 0000000..52a2330 --- /dev/null +++ b/linux-live/modules/02-xubuntu/install @@ -0,0 +1,16 @@ +#!/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 +if [ -f $SCRIPT_DIR/package.list ]; then + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update >>$OUTPUT 2>&1 && + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/package.list | tr "\n" " ") >>$OUTPUT 2>&1 +fi diff --git a/linux-live/modules/02-xubuntu/package.list b/linux-live/modules/02-xubuntu/package.list index 17a56cf..225e0e5 100644 --- a/linux-live/modules/02-xubuntu/package.list +++ b/linux-live/modules/02-xubuntu/package.list @@ -10,6 +10,7 @@ blueman ristretto onboard gigolo +engrampa gparted gsmartcontrol xfce4-taskmanager diff --git a/linux-live/modules/03-apps/install b/linux-live/modules/03-apps/install new file mode 100644 index 0000000..421ed79 --- /dev/null +++ b/linux-live/modules/03-apps/install @@ -0,0 +1,37 @@ +#!/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 +if [ -f $SCRIPT_DIR/package.list ]; then + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update >>$OUTPUT 2>&1 && + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/package.list | tr "\n" " ") >>$OUTPUT 2>&1 +fi + +cd /root +#apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5 >>$OUTPUT 2>&1 +#echo "deb https://download.onlyoffice.com/repo/debian squeeze main" >/etc/apt/sources.list.d/onlyoffice.list >>$OUTPUT 2>&1 +wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - >>$OUTPUT 2>&1 +wget -c https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb >>$OUTPUT 2>&1 +sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update +#sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ +# $APT_CMD install $APT_OPTIONS onlyoffice-desktopeditors +sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS /root/google-chrome-stable_current_amd64.deb /root/cts-4.0.0-104.ks1_amd64.deb >>$OUTPUT 2>&1 + +if [ -d /home/live ]; then + mkdir -p /home/live/.cts + cp /etc/skel/.cts/settings.conf /home/live/.cts/ + chmod 755 /home/live/.cts + chown live:live /home/live/.cts + chmod 644 /home/live/.cts/settings.conf + chown live:live /home/live/.cts/settings.conf +fi diff --git a/linux-live/modules/03-apps/package.list b/linux-live/modules/03-apps/package.list index 2b32fcf..057677a 100644 --- a/linux-live/modules/03-apps/package.list +++ b/linux-live/modules/03-apps/package.list @@ -1,4 +1,8 @@ open-vm-tools-desktop #firefox #firefox-locale-ru -remmina \ No newline at end of file +remmina +parole +recordmydesktop +compizconfig-settings-manager +compiz-plugins \ No newline at end of file diff --git a/linux-live/modules/03-apps/postinstall b/linux-live/modules/03-apps/postinstall index de27692..a462565 100644 --- a/linux-live/modules/03-apps/postinstall +++ b/linux-live/modules/03-apps/postinstall @@ -1,12 +1,10 @@ #!/bin/bash -cd /root -apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5 -echo "deb https://download.onlyoffice.com/repo/debian squeeze main" > /etc/apt/sources.list.d/onlyoffice.list -wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - -wget -c https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -apt update -apt install -y onlyoffice-desktopeditors -apt install -y /root/google-chrome-stable_current_amd64.deb -apt install -y /root/cts-4.0.0-104.ks1_amd64.deb -rm -f /root/google-chrome-stable_current_amd64.deb -rm -f /root/cts-4.0.0-104.ks1_amd64.deb \ No newline at end of file + +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")")" + +rm -f /root/google-chrome-stable_current_amd64.deb >>$OUTPUT 2>&1 +rm -f /root/cts-4.0.0-104.ks1_amd64.deb >>$OUTPUT 2>&1 \ No newline at end of file diff --git a/linux-live/modules/03-apps/rootcopy/etc/skel/.cts/settings.conf b/linux-live/modules/03-apps/rootcopy/etc/skel/.cts/settings.conf new file mode 100644 index 0000000..921a74b --- /dev/null +++ b/linux-live/modules/03-apps/rootcopy/etc/skel/.cts/settings.conf @@ -0,0 +1,4 @@ +[settings] +auto_connect=false +auto_disconnect=true +minimize_on_start=true diff --git a/linux-live/modules/04-drivers/install b/linux-live/modules/04-drivers/install new file mode 100644 index 0000000..52a2330 --- /dev/null +++ b/linux-live/modules/04-drivers/install @@ -0,0 +1,16 @@ +#!/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 +if [ -f $SCRIPT_DIR/package.list ]; then + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update >>$OUTPUT 2>&1 && + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/package.list | tr "\n" " ") >>$OUTPUT 2>&1 +fi diff --git a/linux-live/modules/04-drivers/postinstall b/linux-live/modules/04-drivers/postinstall new file mode 100644 index 0000000..f70cc1e --- /dev/null +++ b/linux-live/modules/04-drivers/postinstall @@ -0,0 +1,10 @@ +#!/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")")" + +sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD remove linux-headers-generic-hwe-20.04 $APT_OPTIONS >>$OUTPUT 2>&1 \ No newline at end of file diff --git a/linux-live/pkglists/ubuntu-gui.list b/linux-live/pkglists/casper-gui.list similarity index 100% rename from linux-live/pkglists/ubuntu-gui.list rename to linux-live/pkglists/casper-gui.list diff --git a/linux-live/pkglists/ubuntu-main.list b/linux-live/pkglists/casper-main.list similarity index 100% rename from linux-live/pkglists/ubuntu-main.list rename to linux-live/pkglists/casper-main.list diff --git a/linux-live/pkglists/ubuntu-other.list b/linux-live/pkglists/casper-other.list similarity index 100% rename from linux-live/pkglists/ubuntu-other.list rename to linux-live/pkglists/casper-other.list diff --git a/linux-live/pkglists/casper-ubiquity.list b/linux-live/pkglists/casper-ubiquity.list new file mode 100644 index 0000000..8b519c8 --- /dev/null +++ b/linux-live/pkglists/casper-ubiquity.list @@ -0,0 +1,5 @@ +ubiquity +ubiquity-casper +ubiquity-frontend-gtk +ubiquity-slideshow-xubuntu +ubiquity-ubuntu-artwork \ No newline at end of file diff --git a/linux-live/rootcopy/etc/issue b/linux-live/rootcopy/etc/issue new file mode 100644 index 0000000..7e33ac0 --- /dev/null +++ b/linux-live/rootcopy/etc/issue @@ -0,0 +1,2 @@ +Welcome to MiniOS! \n \l + diff --git a/linux-live/rootcopy/etc/issue.net b/linux-live/rootcopy/etc/issue.net new file mode 100644 index 0000000..7d8f70d --- /dev/null +++ b/linux-live/rootcopy/etc/issue.net @@ -0,0 +1 @@ +MiniOS 2021 diff --git a/linux-live/rootcopy/etc/skel/.config/xfce4/helpers.rc b/linux-live/rootcopy/etc/skel/.config/xfce4/helpers.rc new file mode 100644 index 0000000..fc0f325 --- /dev/null +++ b/linux-live/rootcopy/etc/skel/.config/xfce4/helpers.rc @@ -0,0 +1 @@ +WebBrowser=google-chrome \ No newline at end of file diff --git a/linux-live/rootcopy/etc/skel/.config/xfce4/panel/launcher-19/16093657651.desktop b/linux-live/rootcopy/etc/skel/.config/xfce4/panel/launcher-19/16093657651.desktop new file mode 100644 index 0000000..19e8d6c --- /dev/null +++ b/linux-live/rootcopy/etc/skel/.config/xfce4/panel/launcher-19/16093657651.desktop @@ -0,0 +1,15 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Exec=exo-open --launch FileManager %u +Icon=system-file-manager +StartupNotify=true +Terminal=false +Categories=Utility;X-XFCE;X-Xfce-Toplevel; +OnlyShowIn=XFCE; +X-XFCE-MimeType=inode/directory;x-scheme-handler/trash; +Name=File Manager +Name[ru]=Файловый менеджер +Comment=Browse the file system +Comment[ru]=Просмотреть файловую систему +X-XFCE-Source=file:///usr/share/applications/exo-file-manager.desktop diff --git a/linux-live/rootcopy/etc/skel/.config/xfce4/panel/launcher-23/16093659533.desktop b/linux-live/rootcopy/etc/skel/.config/xfce4/panel/launcher-23/16093659533.desktop new file mode 100644 index 0000000..0298d34 --- /dev/null +++ b/linux-live/rootcopy/etc/skel/.config/xfce4/panel/launcher-23/16093659533.desktop @@ -0,0 +1,16 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Exec=exo-open --launch WebBrowser %u +Icon=web-browser +StartupNotify=true +Terminal=false +Categories=Network;X-XFCE;X-Xfce-Toplevel; +OnlyShowIn=XFCE; +X-XFCE-MimeType=x-scheme-handler/http;x-scheme-handler/https; +Name=Web Browser +Name[ru]=Веб-браузер +Comment=Browse the web +Comment[ru]=Смотреть в Интернете +X-XFCE-Source=file:///usr/share/applications/exo-web-browser.desktop +Path= diff --git a/linux-live/rootcopy/etc/skel/.config/xfce4/panel/launcher-24/16093659584.desktop b/linux-live/rootcopy/etc/skel/.config/xfce4/panel/launcher-24/16093659584.desktop new file mode 100644 index 0000000..2034e66 --- /dev/null +++ b/linux-live/rootcopy/etc/skel/.config/xfce4/panel/launcher-24/16093659584.desktop @@ -0,0 +1,14 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Exec=exo-open --launch TerminalEmulator +Icon=utilities-terminal +StartupNotify=true +Terminal=false +Categories=Utility;X-XFCE;X-Xfce-Toplevel; +OnlyShowIn=XFCE; +Name=Terminal Emulator +Name[ru]=Эмулятор терминала +Comment=Use the command line +Comment[ru]=Использовать командную строку +X-XFCE-Source=file:///usr/share/applications/exo-terminal-emulator.desktop diff --git a/linux-live/rootcopy/etc/skel/.config/xfce4/panel/whiskermenu-1.rc b/linux-live/rootcopy/etc/skel/.config/xfce4/panel/whiskermenu-1.rc new file mode 100644 index 0000000..d6d7db6 --- /dev/null +++ b/linux-live/rootcopy/etc/skel/.config/xfce4/panel/whiskermenu-1.rc @@ -0,0 +1,68 @@ +favorites=RDWebAccess.desktop,RDWebClient.desktop,org.remmina.Remmina.desktop,ctsg.desktop,ctskeyimportg.desktop,ubiquity.desktop +recent= +button-title=Applications Menu +button-icon=MiniOS-white +button-single-row=false +show-button-title=false +show-button-icon=true +launcher-show-name=true +launcher-show-description=false +launcher-show-tooltip=true +item-icon-size=2 +hover-switch-category=false +category-show-name=true +category-icon-size=1 +load-hierarchy=true +recent-items-max=10 +favorites-in-recent=true +display-recent-default=false +position-search-alternate=true +position-commands-alternate=false +position-categories-alternate=false +menu-width=400 +menu-height=500 +menu-opacity=100 +command-settings=xfce4-settings-manager +show-command-settings=true +command-lockscreen=xflock4 +show-command-lockscreen=true +command-switchuser=dm-tool switch-to-greeter +show-command-switchuser=false +command-logout=xfce4-session-logout +show-command-logout=true +command-menueditor=menulibre +show-command-menueditor=true +command-profile=mugshot +show-command-profile=true +search-actions=5 + +[action0] +name=Man-страницы +pattern=# +command=exo-open --launch TerminalEmulator man %s +regex=false + +[action1] +name=Web-поиск +pattern=? +command=exo-open --launch WebBrowser https://duckduckgo.com/?q=%u +regex=false + +[action2] +name=Википедия +pattern=!w +command=exo-open --launch WebBrowser https://en.wikipedia.org/wiki/%u +regex=false + +[action3] +name=Выполнить в терминале +pattern=! +command=exo-open --launch TerminalEmulator %s +regex=false + +[action4] +name=Открыть URI +pattern=^(file|http|https):\\/\\/(.*)$ +command=exo-open \\0 +regex=true + diff --git a/linux-live/rootcopy/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml b/linux-live/rootcopy/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml new file mode 100644 index 0000000..38aef24 --- /dev/null +++ b/linux-live/rootcopy/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/linux-live/rootcopy/etc/timezone b/linux-live/rootcopy/etc/timezone new file mode 100644 index 0000000..b1f078f --- /dev/null +++ b/linux-live/rootcopy/etc/timezone @@ -0,0 +1 @@ +Europe/Moscow \ No newline at end of file diff --git a/linux-live/rootcopy/root/.bashrc b/linux-live/rootcopy/root/.bashrc new file mode 100644 index 0000000..b0879e6 --- /dev/null +++ b/linux-live/rootcopy/root/.bashrc @@ -0,0 +1,140 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color|*-256color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +#force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# colored GCC warnings and errors +#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' + +# some more ls aliases +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' + +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + +apt-get() +{ + if [ -e /var/cache/apt/pkgcache.bin ]; then + /usr/bin/apt-get "$@" + else + /usr/bin/apt-get update + /usr/bin/apt-get "$@" + fi +} + +apt() +{ + if [ -e /var/cache/apt/pkgcache.bin ]; then + /usr/bin/apt "$@" + else + /usr/bin/apt update + /usr/bin/apt "$@" + fi +} + +export -f apt-get +export -f apt \ No newline at end of file diff --git a/linux-live/rootcopy/usr/share/backgrounds/MiniOS.png b/linux-live/rootcopy/usr/share/backgrounds/MiniOS.png new file mode 100644 index 0000000..5716d76 Binary files /dev/null and b/linux-live/rootcopy/usr/share/backgrounds/MiniOS.png differ diff --git a/linux-live/rootcopy/usr/share/pixmaps/MiniOS-white.svg b/linux-live/rootcopy/usr/share/pixmaps/MiniOS-white.svg new file mode 100644 index 0000000..ca13046 --- /dev/null +++ b/linux-live/rootcopy/usr/share/pixmaps/MiniOS-white.svg @@ -0,0 +1,149 @@ + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/default.plymouth b/linux-live/rootcopy/usr/share/plymouth/themes/default.plymouth new file mode 120000 index 0000000..b251b32 --- /dev/null +++ b/linux-live/rootcopy/usr/share/plymouth/themes/default.plymouth @@ -0,0 +1 @@ +/usr/share/plymouth/themes/minios-logo/minios-logo.plymouth \ No newline at end of file diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/details/details.plymouth b/linux-live/rootcopy/usr/share/plymouth/themes/details/details.plymouth new file mode 100644 index 0000000..bd84964 --- /dev/null +++ b/linux-live/rootcopy/usr/share/plymouth/themes/details/details.plymouth @@ -0,0 +1,4 @@ +[Plymouth Theme] +Name=Details +Description=Verbose fallback theme +ModuleName=details diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/fsck-fade.png b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/fsck-fade.png new file mode 100644 index 0000000..3ef161a Binary files /dev/null and b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/fsck-fade.png differ diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/fsck-fade_16bit.png b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/fsck-fade_16bit.png new file mode 100644 index 0000000..3ada9e0 Binary files /dev/null and b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/fsck-fade_16bit.png differ diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/logo.png b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/logo.png new file mode 100644 index 0000000..cb8af2d Binary files /dev/null and b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/logo.png differ diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/logo_16bit.png b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/logo_16bit.png new file mode 100644 index 0000000..fbae9b3 Binary files /dev/null and b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/logo_16bit.png differ diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/minios-logo.plymouth b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/minios-logo.plymouth new file mode 100644 index 0000000..db7715b --- /dev/null +++ b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/minios-logo.plymouth @@ -0,0 +1,8 @@ +[Plymouth Theme] +Name=MiniOS Logo +Description=A theme that features a background with a logo. +ModuleName=script + +[script] +ImageDir=/usr/share/plymouth/themes/minios-logo +ScriptFile=/usr/share/plymouth/themes/minios-logo/minios-logo.script diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/minios-logo.script b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/minios-logo.script new file mode 100644 index 0000000..0f0c1e1 --- /dev/null +++ b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/minios-logo.script @@ -0,0 +1,512 @@ + /************************************************************************** + * + * Copyright (C) 2011 The Xubuntu Community + * Copyright (C) 2009 Canonical Ltd. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Written by: Mad Nick + * + **************************************************************************/ + +/* + * Related to the screen */ + +screen_width = Window.GetWidth(); +screen_height = Window.GetHeight(); +screen_x = Window.GetX(); +screen_y = Window.GetY(); + +/**/ + +/* + * Images, check bits per pixel + * and load images accordingly */ + +background_image = Image("wallpaper.png"); +passw_dialog_input_image = Image("passw-dialog.png"); +bullet_image = Image("test.png"); + +bpp = Window.GetBitsPerPixel(); + +if (bpp == 4) { + + logotype_image = Image("logo_16bit.png"); + progress_meter_image = Image("progress-meter_16bit.png"); + progress_fade_image = Image("progress-fade_16bit.png"); + fsck_progress_meter_image = Image("progress-meter_16bit.png"); + fsck_progress_fade_image = Image("fsck-fade_16bit.png"); + +} +else { + + logotype_image = Image("logo.png"); + progress_meter_image = Image("progress-meter.png"); + progress_fade_image = Image("progress-fade.png"); + fsck_progress_meter_image = Image("progress-meter.png"); + fsck_progress_fade_image = Image("fsck-fade.png"); + +} + +/**/ + +/* + * Sprites */ + +ratio = screen_height / screen_width; +background_ratio = background_image.GetHeight() / background_image.GetWidth(); +factor = 0; + +if (ratio > background_ratio) { + + factor = screen_height / background_image.GetHeight(); + +} +else { + + factor = screen_width / background_image.GetWidth(); + +} + +scaled = background_image.Scale(background_image.GetWidth() * factor, background_image.GetHeight() * factor); +background_sprite = Sprite(scaled); +background_sprite.SetX(screen_x + screen_width / 2 - scaled.GetWidth() / 2); +background_sprite.SetY(screen_y + screen_height / 2 - scaled.GetHeight() / 2); + +logotype_sprite = Sprite(logotype_image); + +fsck_progress_meter_sprite = Sprite(fsck_progress_meter_image); +fsck_progress_fade_sprite = Sprite(fsck_progress_fade_image.Scale(1, fsck_progress_fade_image.GetHeight())); + +passw_dialog_input_sprite = Sprite(passw_dialog_input_image); +passw_lbl_sprite = Sprite(); + +msg_label_sprite = Sprite(); + +/**/ + +/* + * Misc */ + +counter = 0; + +fade_pos_x = (screen_width / 2) - (progress_meter_image.GetWidth() / 2); +fade_dir = 0; /* 0 = right, 1 = left */ + +fsck_running = 0; +fsck_dev_array; +fsck_dev_counter = 0; +fsck_fade_in_counter = 0; +fsck_done_fading = 0; + +stars_array; +stars_n = 0; + +//full_msg = ""; +msgs_line = [NULL,NULL,NULL,NULL,NULL]; + +/**/ + +/* + * Debug related */ + +debug = 0; +debug_sprite = Sprite(); + +fun debugOutput(str) { + + /* + * This will print to the top left corner */ + debug_sprite.SetImage(Image.Text(str)); + +} + +/**/ + +/* + * Setup the graphics properties */ +logotype_sprite.SetPosition(screen_x + (screen_width / 2) - (logotype_image.GetWidth() / 2), screen_y + (screen_height / 2) - (logotype_image.GetHeight() / 2)); +fsck_progress_meter_sprite.SetPosition(screen_x + (screen_width / 2) - (progress_meter_image.GetWidth() / 2), screen_y + (screen_height / 2) + (logotype_image.GetHeight() / 2) + 25); +fsck_progress_fade_sprite.SetPosition(screen_x + (screen_width / 2) - (progress_meter_image.GetWidth() / 2), screen_y + (screen_height / 2) + (logotype_image.GetHeight() / 2) + 25); +fsck_progress_meter_sprite.SetOpacity(0); +fsck_progress_fade_sprite.SetOpacity(0); +passw_dialog_input_sprite.SetPosition(screen_x + (screen_width / 2) - (passw_dialog_input_image.GetWidth() / 2), screen_y + (screen_height / 2) + (logotype_image.GetHeight() / 2) + 70); +passw_dialog_input_sprite.SetOpacity(0); +passw_lbl_sprite.SetOpacity(0); + +spin = 0; + +/* + * this function only goes up to 100 + * because thats all thats needed for + * the progress meter bar */ +fun atoi(str) { + + int = -1; + + for (i = 0; i <= 100; i++) { + + if (i + "" == str) { + + int = i; + + break; + + } + + } + + return int; + +} + +/* + * This handler will/can be invoked + * 50 times per second. + * + * According to the previous author of the + * splash script, without this callback + * the screen is not updated correctly */ +spinner_sprite; +spinner; + +fun refreshHandler() { + + if (spin < 3.14 * 2) { + + spin = spin + 0.1; + + } + else { + + spin = 0; + + } + + /* if fsck is running or the password is prompted, hide the spinner */ + if (fsck_running == 1 || passw_dialog_input_sprite.GetOpacity() == 1) { + + spinner_sprite.SetOpacity(0); + + } else { + + spinner = Image("spinner.png"); + spinner = spinner.Rotate(spin); + spinner_sprite = Sprite(spinner); + spinner_sprite.SetPosition(screen_x + (screen_width / 2) - (spinner.GetWidth() / 2), screen_y + (screen_height / 2) - (spinner.GetHeight() / 2) + 80); + + } + + if (fade_dir == 0) { + + counter++; + + if (counter >= 200) { + + fade_dir = 1; + + } + + } + else { + + counter--; + + if (counter <= 0) { + + fade_dir = 0; + + } + + } + + if ((fsck_running == 1) && (fsck_done_fading == 0)) { + + + fsck_progress_meter_sprite.SetOpacity(fsck_fade_in_counter); + fsck_progress_fade_sprite.SetOpacity(fsck_fade_in_counter); + + if (fsck_fade_in_counter < 1) { + + fsck_fade_in_counter+= 0.025; + + } + else { + + fsck_done_fading = 1; + + } + + } + +} + +Plymouth.SetRefreshFunction (refreshHandler); + +/**/ + +/* + * This function will display the password related information + * when being prompt with entering a password */ +fun showPasswordHandler(prompt, stars) { + + if (passw_dialog_input_sprite.GetOpacity() == 0 && passw_lbl_sprite.GetOpacity() == 0) { + + passw_dialog_input_sprite.SetOpacity(1); + passw_lbl_sprite.SetOpacity(1); + + } + + tmp_prompt_image = Image.Text(prompt, 1, 1, 1); + + passw_lbl_sprite.SetImage(tmp_prompt_image); + passw_lbl_sprite.SetPosition(screen_x + (screen_width / 2) - (tmp_prompt_image.GetWidth() / 2), screen_y + (screen_height / 2) + (logotype_image.GetHeight() / 2) + 50); + + for(i = 0; i < stars_n; i++) { + + stars_array[i] = NULL; + + } + + stars_n = 0; + + for(i = 0; (i < stars) && (i < 15); i++) { + + stars_array[i] = Sprite(bullet_image); + stars_array[i].SetPosition(screen_x + (((screen_width / 2) - (passw_dialog_input_image.GetWidth() / 2)) + (18 * i)) + 2, screen_y + (screen_height / 2) + (logotype_image.GetHeight() / 2) + 75); + stars_n++; + + } + +} + +Plymouth.SetDisplayPasswordFunction(showPasswordHandler); + +/**/ + +fun displayNormalHandler() { + + /* + * Hide the password dialog and the bullets */ + + if (passw_dialog_input_sprite.GetOpacity() == 1) { + + passw_dialog_input_sprite.SetOpacity(0); + + } + + if (passw_lbl_sprite.GetOpacity() == 1) { + + passw_lbl_sprite.SetOpacity(0); + + } + + for(i = 0; i < stars_n; i++) { + + stars_array[i] = NULL; + + } + +} + +Plymouth.SetDisplayNormalFunction(displayNormalHandler); + +fun strlen(string) { + + i = 0; + + while (String(string).CharAt(i)) { + + i++; + + } + + return i; + +} + +/* + * This function will display the most current message */ +fun messageHandler(msg) { + + if ((msg == "") || !msg) { + + return 0; + + } + + if (msg.SubString(0, 5) == "keys:") { + + msg = msg.SubString(5, strlen(msg)); + + } + + # Get the message without the "fsckd-cancel-msg" prefix as we don't support i18n + if (msg.SubString(0, 17) == "fsckd-cancel-msg:") + msg = msg.SubString(17, strlen(msg)); + + //full_msg += msg + " "; + for(i = 4; i > 0; i--) { + + msgs_line[i] = msgs_line[i - 1]; + + } + + msgs_line[0] = Sprite(Image.Text(msg, 1, 1, 1)); + + dist = 1; + + for(i = 0; i < 5; i++) { + + if (msgs_line[i] != NULL) { + + msgs_line[i].SetPosition(screen_x + (screen_width / 2) - (msgs_line[i].GetImage().GetWidth() / 2), screen_y + (screen_height - msgs_line[i].GetImage().GetHeight()) - 20*dist); + dist++; + + } + + } + +} + +Plymouth.SetMessageFunction(messageHandler); + +/**/ + +/* + * Handles the updates passed to the plymouth daemon + * for example the FSCK data */ +fun statusHandler(status) { + + tmp_char; + status_array[0] = ""; + elem_count = 0; + + for (i = 0; String(status).CharAt(i) != ""; i++) { + + tmp_char = String(status).CharAt(i); + + if (tmp_char != ":") { + + status_array[elem_count] += tmp_char; + + } + else { + + elem_count++; + status_array[elem_count] = ""; + + } + + } + + if (status_array[0] == "fsck") { + + already_added = 0; + + if (fsck_running == 0) { + + /* + * use the dedicated message handler for this + * since there is no messages about fsck checks + * currently... */ + messageHandler("Routine disk drive check."); + + fsck_running = 1; + + } + + for(i = 0; i < fsck_dev_counter; i++) { + + /* + * check if the device already exist and update + * the progress only in that case */ + if (fsck_dev_array[i][0] == status_array[1]) { + + fsck_dev_array[i][1] = status_array[2]; /* progress */ + already_added = 1; + + } + + } + + /* + * if the device is not added, then add it */ + if (already_added == 0) { + + fsck_dev_array[fsck_dev_counter][0] = status_array[1]; /* device */ + fsck_dev_array[fsck_dev_counter][1] = status_array[2]; /* progress */ + fsck_dev_counter++; + + } + + /* + * update the progress */ + + total = 0; + + for(i = 0; i < fsck_dev_counter; i++) { + + total += atoi(fsck_dev_array[i][1]); + + } + + if (fsck_dev_counter > 0) { + + /* + * display the total percentage */ + fsck_progress_fade_sprite.SetImage(fsck_progress_fade_image.Scale((fsck_progress_meter_image.GetWidth() / 100) * (total / fsck_dev_counter), fsck_progress_fade_image.GetHeight())); + + } + + /**/ + + /* + * if the total progress is at maximum, + * make the progress meter go away, + * we might want to fade this out... */ + if (total == (100 * fsck_dev_counter)) { + + fsck_progress_meter_sprite.SetOpacity(0); + fsck_progress_fade_sprite.SetOpacity(0); + + } + + } + + # systemd-fsckd pass fsckd::: + if (status_array[0] == "fsckd") { + fsck_running = 1; + + # remove ",x" as we only care about integers + progress_str = status_array[2]; + progress = atoi(progress_str.SubString(0, strlen(progress_str) - 2)); + + fsck_progress_fade_sprite.SetImage(fsck_progress_fade_image.Scale((fsck_progress_meter_image.GetWidth() / 100) * progress, fsck_progress_fade_image.GetHeight())); + + /* + * if the total progress is at maximum, + * make the progress meter go away, + * we might want to fade this out... */ + if (progress == 100) { + fsck_progress_meter_sprite.SetOpacity(0); + fsck_progress_fade_sprite.SetOpacity(0); + } + } + +} + +Plymouth.SetUpdateStatusFunction(statusHandler); + +/**/ diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/passw-dialog.png b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/passw-dialog.png new file mode 100644 index 0000000..9e6a504 Binary files /dev/null and b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/passw-dialog.png differ diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/progress-fade.png b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/progress-fade.png new file mode 100644 index 0000000..ec475f4 Binary files /dev/null and b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/progress-fade.png differ diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/progress-fade_16bit.png b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/progress-fade_16bit.png new file mode 100644 index 0000000..878aec6 Binary files /dev/null and b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/progress-fade_16bit.png differ diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/progress-meter.png b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/progress-meter.png new file mode 100644 index 0000000..4e8b719 Binary files /dev/null and b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/progress-meter.png differ diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/progress-meter_16bit.png b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/progress-meter_16bit.png new file mode 100644 index 0000000..75f8713 Binary files /dev/null and b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/progress-meter_16bit.png differ diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/spinner.png b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/spinner.png new file mode 100644 index 0000000..80944a3 Binary files /dev/null and b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/spinner.png differ diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/test.png b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/test.png new file mode 100644 index 0000000..3d64128 Binary files /dev/null and b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/test.png differ diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/wallpaper.png b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/wallpaper.png new file mode 100644 index 0000000..3a3b82d Binary files /dev/null and b/linux-live/rootcopy/usr/share/plymouth/themes/minios-logo/wallpaper.png differ diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/minios-text/minios-text.plymouth b/linux-live/rootcopy/usr/share/plymouth/themes/minios-text/minios-text.plymouth new file mode 100644 index 0000000..3376c71 --- /dev/null +++ b/linux-live/rootcopy/usr/share/plymouth/themes/minios-text/minios-text.plymouth @@ -0,0 +1,11 @@ +[Plymouth Theme] +Name=MiniOS Text +Description=Text mode theme based on minios-logo theme +ModuleName=ubuntu-text + +[ubuntu-text] +title=MiniOS 2021 +black=0x000000 +white=0xffffff +brown=0x000000 +blue=0xffffff diff --git a/linux-live/rootcopy/usr/share/plymouth/themes/text.plymouth b/linux-live/rootcopy/usr/share/plymouth/themes/text.plymouth new file mode 120000 index 0000000..740f19a --- /dev/null +++ b/linux-live/rootcopy/usr/share/plymouth/themes/text.plymouth @@ -0,0 +1 @@ +/usr/share/plymouth/themes/minios-text/minios-text.plymouth \ No newline at end of file