diff --git a/.unused/.script_version b/.unused/.script_version deleted file mode 100644 index 8351c19..0000000 --- a/.unused/.script_version +++ /dev/null @@ -1 +0,0 @@ -14 diff --git a/.unused/.unused/cleanup b/.unused/.unused/cleanup deleted file mode 100644 index c5d892a..0000000 --- a/.unused/.unused/cleanup +++ /dev/null @@ -1,15 +0,0 @@ -apt-get clean -#rm -rf /tmp/* -rm -f /etc/ssh/ssh_host* -rm -f /root/.bash_history -rm -f /root/.wget-hsts -rm -rf /root/.cache -rm -rf /root/.config -rm -rf /root/.local -find /var/log/ -type f | xargs rm -f -umount /proc -umount /sys -umount /dev/pts -umount /dev -umount /run -umount /tmp \ No newline at end of file diff --git a/.unused/.unused/copy b/.unused/.unused/copy deleted file mode 100644 index 7a0adaa..0000000 --- a/.unused/.unused/copy +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -(cd rootcopy && cp --parents -afr * /) diff --git a/.unused/cleanup b/.unused/cleanup deleted file mode 100644 index b73d53d..0000000 --- a/.unused/cleanup +++ /dev/null @@ -1,27 +0,0 @@ -# truncate machine id (why??) -truncate -s 0 /etc/machine-id - -# remove diversion (why??) -rm /sbin/initctl -dpkg-divert --rename --remove /sbin/initctl - -# remove ssh config -#rm -f /etc/ssh/ssh_host* - -# clean up useless stuff -rm -rf /tmp/* ~/.bash_history -find /var/log/ -type f | xargs rm -f -rm -f /etc/ssh/ssh_host* -rm -f /var/backups/* -rm -f /var/cache/ldconfig/* -rm -f /var/cache/debconf/* -rm -f /var/cache/fontconfig/* -rm -f /var/cache/apt/archives/*.deb -rm -f /var/cache/apt/*.bin -rm -f /var/cache/debconf/*-old -rm -f /var/lib/apt/extended_states -rm -f /var/lib/apt/lists/*Packages -rm -f /var/lib/apt/lists/*Translation* -rm -f /var/lib/apt/lists/*InRelease -rm -f /var/lib/apt/lists/deb.* -rm -f /var/lib/dpkg/*-old diff --git a/.unused/cloud-config.yml b/.unused/cloud-config.yml deleted file mode 100644 index a3e8622..0000000 --- a/.unused/cloud-config.yml +++ /dev/null @@ -1,99 +0,0 @@ -#cloud-config - -autoinstall: - version: 1 - early-commands: -# delete any old partition data, up to 240MB size, if this was reinstall -# erases partition tables and whole boot partition as well, by erasing 30x8MB=240MB (partition is 200MB) - - dd if=/dev/zero of=/dev/sda bs=8M count=30 -# create new 200MB boot partition and rest as root partition - - (echo o; echo n; echo p; echo 1; echo ""; echo +200M; echo n; echo p; echo 2; echo ''; echo ''; echo a; echo 1; echo p; echo w) | fdisk /dev/sda -# format boot as FAT 32 - - mkfs.fat -F 32 -D 0x80 -M 0xF8 -n BOOT /dev/sda1 -# format rest as ext4 - - mkfs.ext4 -F /dev/sda2 -# create mount points for boot and root - - mkdir /mnt/boot /mnt/root -# don't mount boot yet, as later syslinux requires it unmounted, or mount it here and unmount before syslinux -i -# - mount /dev/sda1 /mnt/boot - - mount /dev/sda2 /mnt/root -# optional commands to see what's mounted, note if you did not mount it, don't ls it because subiquity installer will fail -# - df -h -# - ls -al /mnt -# - ls -al /mnt/boot -# - ls -al /mnt/root -# download ubuntu Base from official repo, we download 20.10 below, this will download to / (root) of ubiquity installer, which means - into memory -# if you want 20.04 or 20.10 or anything else (future releases) just change following these two lines (curl and tar) to reflect that, plus later in script change kernel version - - curl http://cdimage.ubuntu.com/ubuntu-base/releases/20.10/release/ubuntu-base-20.10-base-amd64.tar.gz -o /ubuntu-base-20.10-base-amd64.tar.gz -# extract all files to our sda2, mounted at /mnt/root - - tar -xzvf /ubuntu-base-20.10-base-amd64.tar.gz -C /mnt/root -# create temporary resolv.conf in the new system - - touch /mnt/root/etc/resolv.conf - - echo "nameserver 8.8.8.8" > /mnt/root/etc/resolv.conf -# chroot to /mnt/root and start executing commands one by one -# update apt's package cache - - chroot /mnt/root sh -c "apt-get update" -# install Linux image, which will install kernel and create initrd and all -# you need to install specific version depending on OS, eg 20.04 will use linux-image-5.4.0-42-generic -# we also install: init, dbus, iproute2, sudo, which also pull systemd - to have actually usable system -# additionally install nano to be able to edit confs, you can change that to any other editor - - chroot /mnt/root sh -c "apt-get install -y linux-image-5.8.0-28-generic initramfs-tools init dbus iproute2 sudo nano --no-install-recommends" -# I personally always install openssh-server as well, ping for debugging -# and you may also want to add isc-dhcp-client package to enable networking setup by DHCP server - - chroot /mnt/root sh -c "apt-get install -y openssh-server isc-dhcp-client iputils-ping --no-install-recommends" -# add at least one user, here we add user ubuntu with password ubuntu, change it here or later after first login - - chroot /mnt/root sh -c "useradd -m ubuntu -s '/bin/bash' && echo ubuntu:ubuntu | chpasswd" -# add this new user to correct groups to enable it to be admin and to have sudo access - - chroot /mnt/root sh -c "addgroup ubuntu adm" - - chroot /mnt/root sh -c "addgroup ubuntu sudo" -# this would installs Xubuntu ... or switch to whatever you need... if you install some other package or desktop environment - it will be there after your login -# but it is quite large (2GB) so if ANY package fails or throws ANY error - whole subiquity installer crashes; so I recommend this to be done on first interactive login after reboot -# - chroot /mnt/root sh -c "apt-get install -y xubuntu-core" -# below is syslinux install the easy way, through Ubuntu's official package/repo -# get the syslinux package, note this is not in chroot, this installs just to subiquity memory, so we need to run apt update again - - apt-get update - - apt-get install -y syslinux -# tell syslinux to install itself to your sda1 which is your boot partition -# if you mounted it earlier, unmount boot!! use command below (which is commented out by default) -# - umount /mnt/boot - - syslinux -i /dev/sda1 -# now that syslinux is installed, burn it's mbr.bin (or maybe gptmbr.bin if you plan to use GPT + UEFI) to start of your disk; note we target whole device "sda" - NOT sda1 - - dd if=/usr/lib/syslinux/mbr/mbr.bin of=/dev/sda bs=440 count=1 conv=notrunc -# now we can safely mount boot partition - - mount /dev/sda1 /mnt/boot -# we create syslinux.cfg, I do touch, as if it doesn't exist it will break subiquity again - - touch /mnt/boot/syslinux.cfg -# echo your config to it; explaining -# PROMPT 0 - don't ask use default / 1 - ask for user input (good for diag); DEFAULT - set which label is default so syslinux can autoboot; LABEL - this is config for our Ubuntu Base OS; KERNEL - vmlinuz or eqivalent kernel name; APPEND - to mount your /root partiton as writeable; INITRD - name of your initrd image - - (echo PROMPT 0; echo DEFAULT base; echo LABEL base; echo KERNEL vmlinuz; echo APPEND root=/dev/sda2 rw; echo INITRD initrd.img) > /mnt/boot/syslinux.cfg -# copy vmlinuz & initrd files that you've installed in your chroot, you can specify exact version, just make sure to change syslinux.cfg echo (above) accordingly -# can also copy * to copy all, but all we need is these ones really - - cp /mnt/root/boot/vmlinuz /mnt/boot - - cp /mnt/root/boot/initrd.img /mnt/boot -# setup EFI boot, you can keep both BIOS and UEFI bootloaders at the same time -# install additional package - - apt-get install -y syslinux-efi -# create directories, will create both BOOT and parent EFI folders - - mkdir -p /mnt/boot/EFI/BOOT/ -# copy all files, in order: UEFI bootloader, bootloader's module (required), syslinux config (same as above), kernel and initrd (same as above) - - cp /usr/lib/SYSLINUX.EFI/efi64/syslinux.efi /mnt/boot/EFI/BOOT/BOOTX64.EFI - - cp /usr/lib/syslinux/modules/efi64/ldlinux.e64 /mnt/boot/EFI/BOOT/ - - cp /mnt/boot/syslinux.cfg /mnt/boot/EFI/BOOT/syslinux.cfg - - cp /mnt/root/boot/vmlinuz /mnt/boot/EFI/BOOT/ - - cp /mnt/root/boot/initrd.img /mnt/boot/EFI/BOOT/ -# now we create network config, make sure to change: interface name, IP, gateway - - touch /mnt/root/etc/systemd/network/00-wired.network - - (echo [Match]; echo Name=enp0s10f0; echo [Network]; echo Address=10.10.2.101/24; echo Gateway=10.10.2.99; echo DNS=8.8.8.8) > /mnt/root/etc/systemd/network/00-wired.network -# and enable networkd service so it runs on first boot already - - chroot /mnt/root sh -c "systemctl enable systemd-networkd.service" -# this is optional, but cleans 100+MB from our chroot partition - - chroot /mnt/root sh -c "apt-get clean" -# and finally, I leave this uncommented sometimes, to allow me to do anything in interactive bash shell before final reboot (or to just pause and wait for you if you took coffee and don't want your system to reboot unattended) -# - bash -c "exec bash" -# unmount partitions - - umount /mnt/boot - - umount /mnt/root -# and reboot! - - reboot -# after reboot login with your user (ubuntu/ubuntu in this script) and complete installation and/or configuration -# you can also connect using ssh to this machine, sudo, and install or configure whatever you wish! Congrats! \ No newline at end of file diff --git a/.unused/minioslib.copy b/.unused/minioslib.copy deleted file mode 100644 index 75b26ad..0000000 --- a/.unused/minioslib.copy +++ /dev/null @@ -1,1950 +0,0 @@ -#!/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/.unused/minioslib.test b/.unused/minioslib.test deleted file mode 100644 index a402cb5..0000000 --- a/.unused/minioslib.test +++ /dev/null @@ -1,247 +0,0 @@ -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/.unused/move_iso.sh b/.unused/move_iso.sh deleted file mode 100755 index 908047e..0000000 --- a/.unused/move_iso.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# ! Не используйте это, если не понимаете, как оно работает. -apt update -y && apt install -y inotify-tools && apt clean -inotifywait -m /build/iso -e close_write | - while read path action file; do - echo "The file '$file' appeared in directory '$path' via '$action'" - if [ $action != "CREATE,ISDIR" ]; then - xhost + >/dev/null 2>/dev/null - #find $path ! -name "$file" -type f -exec rm -f {""} + - cp $path$file /mnt/build/iso/minios.iso - mv $path$file /mnt/build/iso/ - fi - done diff --git a/.unused/nii/03-apps/install b/.unused/nii/03-apps/install deleted file mode 100644 index 421ed79..0000000 --- a/.unused/nii/03-apps/install +++ /dev/null @@ -1,37 +0,0 @@ -#!/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/.unused/nii/03-apps/package.list b/.unused/nii/03-apps/package.list deleted file mode 100644 index a360beb..0000000 --- a/.unused/nii/03-apps/package.list +++ /dev/null @@ -1,8 +0,0 @@ -open-vm-tools-desktop -#firefox -#firefox-locale-ru -remmina -parole -recordmydesktop -#compizconfig-settings-manager -#compiz-plugins \ No newline at end of file diff --git a/.unused/nii/03-apps/postinstall b/.unused/nii/03-apps/postinstall deleted file mode 100644 index a462565..0000000 --- a/.unused/nii/03-apps/postinstall +++ /dev/null @@ -1,10 +0,0 @@ -#!/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")")" - -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/.unused/nii/03-apps/rootcopy/etc/cts/registration_number.json b/.unused/nii/03-apps/rootcopy/etc/cts/registration_number.json deleted file mode 100644 index f1660c5..0000000 --- a/.unused/nii/03-apps/rootcopy/etc/cts/registration_number.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "id": " ", - "version": 1 -} \ No newline at end of file diff --git a/.unused/nii/03-apps/rootcopy/etc/cts/settings-general.json b/.unused/nii/03-apps/rootcopy/etc/cts/settings-general.json deleted file mode 100644 index b6e26b2..0000000 --- a/.unused/nii/03-apps/rootcopy/etc/cts/settings-general.json +++ /dev/null @@ -1 +0,0 @@ -{"cert_ask_for_adding":true,"cert_check_against_crl":false,"cert_warning_expiration_days":14,"crl_allowed_expiration_days":0,"crl_auto_update":true,"crl_update_period":24} \ No newline at end of file diff --git a/.unused/nii/03-apps/rootcopy/etc/cts/user_registration_info.json b/.unused/nii/03-apps/rootcopy/etc/cts/user_registration_info.json deleted file mode 100644 index afa8766..0000000 --- a/.unused/nii/03-apps/rootcopy/etc/cts/user_registration_info.json +++ /dev/null @@ -1 +0,0 @@ -{"city":"","configVersion":1,"department":"","email":"","firstName":"","host":"cap","lastName":"","middleName":"","organization":"","protectionClass":"KC1"} \ No newline at end of file diff --git a/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/helpers.rc b/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/helpers.rc deleted file mode 100644 index fc0f325..0000000 --- a/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/helpers.rc +++ /dev/null @@ -1 +0,0 @@ -WebBrowser=google-chrome \ No newline at end of file diff --git a/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/panel/launcher-19/16093657651.desktop b/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/panel/launcher-19/16093657651.desktop deleted file mode 100644 index 19e8d6c..0000000 --- a/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/panel/launcher-19/16093657651.desktop +++ /dev/null @@ -1,15 +0,0 @@ -[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/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/panel/launcher-23/16093659533.desktop b/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/panel/launcher-23/16093659533.desktop deleted file mode 100644 index 0298d34..0000000 --- a/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/panel/launcher-23/16093659533.desktop +++ /dev/null @@ -1,16 +0,0 @@ -[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/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/panel/launcher-24/16093659584.desktop b/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/panel/launcher-24/16093659584.desktop deleted file mode 100644 index 2034e66..0000000 --- a/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/panel/launcher-24/16093659584.desktop +++ /dev/null @@ -1,14 +0,0 @@ -[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/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/panel/whiskermenu-1.rc b/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/panel/whiskermenu-1.rc deleted file mode 100644 index d6d7db6..0000000 --- a/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/panel/whiskermenu-1.rc +++ /dev/null @@ -1,68 +0,0 @@ -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/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml b/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml deleted file mode 100644 index 38aef24..0000000 --- a/.unused/nii/03-apps/rootcopy/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.unused/nii/03-apps/rootcopy/etc/skel/.cts/settings.conf b/.unused/nii/03-apps/rootcopy/etc/skel/.cts/settings.conf deleted file mode 100644 index 921a74b..0000000 --- a/.unused/nii/03-apps/rootcopy/etc/skel/.cts/settings.conf +++ /dev/null @@ -1,4 +0,0 @@ -[settings] -auto_connect=false -auto_disconnect=true -minimize_on_start=true diff --git a/.unused/nii/03-apps/rootcopy/root/cts-4.0.0-104.ks1_amd64.deb b/.unused/nii/03-apps/rootcopy/root/cts-4.0.0-104.ks1_amd64.deb deleted file mode 100644 index 0f13da7..0000000 Binary files a/.unused/nii/03-apps/rootcopy/root/cts-4.0.0-104.ks1_amd64.deb and /dev/null differ diff --git a/.unused/nii/03-apps/rootcopy/usr/share/applications/RDWebAccess.desktop b/.unused/nii/03-apps/rootcopy/usr/share/applications/RDWebAccess.desktop deleted file mode 100644 index 13987ff..0000000 --- a/.unused/nii/03-apps/rootcopy/usr/share/applications/RDWebAccess.desktop +++ /dev/null @@ -1,17 +0,0 @@ -[Desktop Entry] -Version=1.0 -Name=RD Web Access -Name[ru]=Веб-доступ к удаленным рабочим столам -GenericName=Remote Desktop Web Access -GenericName[ru]=Веб-доступ к удаленным рабочим столам -X-GNOME-FullName=Remote Desktop Web -Comment=RemoteApp and Desktop Connection -Comment[ru]=Подключение к удаленным рабочим столам и приложениям RemoteApp -Exec=/opt/google/chrome/google-chrome --profile-directory=Default --app="https://rd.niitnn.tn.corp/RDWeb" -Icon=preferences-desktop-remote-desktop -Terminal=false -Type=Application -Categories=GTK;GNOME;X-GNOME-NetworkSettings;Network; -Keywords=remote desktop;rdp -Path= -StartupNotify=false diff --git a/.unused/nii/03-apps/rootcopy/usr/share/applications/RDWebClient.desktop b/.unused/nii/03-apps/rootcopy/usr/share/applications/RDWebClient.desktop deleted file mode 100644 index 2334052..0000000 --- a/.unused/nii/03-apps/rootcopy/usr/share/applications/RDWebClient.desktop +++ /dev/null @@ -1,17 +0,0 @@ -[Desktop Entry] -Version=1.0 -Name=RD Web Client -Name[ru]=Веб-клиент удаленных рабочих столов -GenericName=Remote Desktop Web Client -GenericName[ru]=Веб-клиент доступа к удаленным рабочим столам -X-GNOME-FullName=Remote Desktop Web -Comment=RemoteApp and Desktop Connection -Comment[ru]=Подключение к удаленным рабочим столам и приложениям RemoteApp -Exec=/opt/google/chrome/google-chrome --profile-directory=Default --app="https://rd.niitnn.tn.corp/RDWeb/WebClient" -Icon=/usr/share/icons/hicolor/apps/microsoft-remote-desktop.png -Terminal=false -Type=Application -Categories=GTK;GNOME;X-GNOME-NetworkSettings;Network; -Keywords=remote desktop;rdp -Path= -StartupNotify=false diff --git a/.unused/nii/03-apps/rootcopy/usr/share/icons/hicolor/apps/microsoft-remote-desktop.png b/.unused/nii/03-apps/rootcopy/usr/share/icons/hicolor/apps/microsoft-remote-desktop.png deleted file mode 100644 index 547cde8..0000000 Binary files a/.unused/nii/03-apps/rootcopy/usr/share/icons/hicolor/apps/microsoft-remote-desktop.png and /dev/null differ diff --git a/.unused/wg-gen-web.yml b/.unused/wg-gen-web.yml deleted file mode 100644 index 95080af..0000000 --- a/.unused/wg-gen-web.yml +++ /dev/null @@ -1,34 +0,0 @@ -version: "3.6" -services: - wg-gen-web: - image: vx3r/wg-gen-web:latest - container_name: wg-gen-web - restart: unless-stopped - expose: - - "8080/tcp" - environment: - - WG_CONF_DIR=/data - - WG_INTERFACE_NAME=wg0.conf - - SMTP_HOST=mail.crims0n.ru - - SMTP_PORT=587 - - SMTP_USERNAME=no-reply@crims0n.ru - - SMTP_PASSWORD=4ys4eUVNcVCuvJ - - SMTP_FROM=Wg Gen Web - - OAUTH2_PROVIDER_NAME=github - - OAUTH2_PROVIDER=https://github.com - - OAUTH2_CLIENT_ID=1347a6c5a942ca0a52ed - - OAUTH2_CLIENT_SECRET=2f1d162b2d8d82bc58f685660e6875d2544d059c - - OAUTH2_REDIRECT_URL=http://140.238.172.15:8080 - - WG_STATS_API=http://10.0.0.2:8182 - volumes: - - /etc/wireguard:/data - ports: - - 8080:8080 - wg-json-api: - image: james/wg-api:latest - container_name: wg-json-api - restart: unless-stopped - cap_add: - - NET_ADMIN - network_mode: "host" - command: wg-api --device wg0 --listen 0.0.0.0:8182 diff --git a/backup b/backup deleted file mode 100755 index 16aa4bf..0000000 --- a/backup +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -DATE=$(date +%Y%m%d_%H%M) -SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -PARENT_DIR="$(dirname "$SCRIPT_DIR")" -mkdir $PARENT_DIR/backup -rm -f $PARENT_DIR/backup/minios-live-current.tar.gz -tar -czf $PARENT_DIR/backup/minios-live-current.tar.gz --exclude .git --exclude "*.log" --exclude .script_version . -cp $PARENT_DIR/backup/minios-live-current.tar.gz $PARENT_DIR/backup/minios-live-$DATE.tar.gz \ No newline at end of file diff --git a/linux-live/modules/03-apps/install b/linux-live/modules/03-apps/install index 36bbbfe..44919dc 100644 --- a/linux-live/modules/03-apps/install +++ b/linux-live/modules/03-apps/install @@ -7,13 +7,13 @@ set -u # treat unset variable as error SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" # opera & onlyoffice & vscode -:'wget -qO - https://deb.opera.com/archive.key | sudo apt-key add - -sudo add-apt-repository 'deb https://deb.opera.com/opera-stable/ stable non-free' -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5 -sudo add-apt-repository 'deb https://download.onlyoffice.com/repo/debian squeeze main' +: 'wget -qO - https://deb.opera.com/archive.key | apt-key add - +add-apt-repository 'deb https://deb.opera.com/opera-stable/ stable non-free' +apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5 +add-apt-repository 'deb https://download.onlyoffice.com/repo/debian squeeze main' wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg -sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/ -sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list' +install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/ +sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" >/etc/apt/sources.list.d/vscode.list' rm -f packages.microsoft.gpg' # install packages