Browse Source

added docker support, added support for building from a container based on ubuntu trust, added automatic build

master
crims0n 5 years ago
parent
commit
f07ca72e4b
  1. 3
      autoinstall
  2. 5
      install
  3. 2
      linux-live/config
  4. 67
      linux-live/minioslib

3
autoinstall

@ -11,8 +11,7 @@ ISO_DIR="$(dirname "$SCRIPT_DIR")"/iso
. $SCRIPT_DIR/linux-live/minioslib || exit 1
. $SCRIPT_DIR/linux-live/config || exit 1
OUTPUT="/dev/stdout"
# don't change! use ./install instead
UNATTENDED="1"
CMD=(setup_host build_bootstrap build_chroot build_live build_iso)

5
install

@ -11,11 +11,6 @@ ISO_DIR="$(dirname "$SCRIPT_DIR")"/iso
. $SCRIPT_DIR/linux-live/minioslib || exit 1
. $SCRIPT_DIR/linux-live/config || exit 1
# normal
#OUTPUT="/dev/stdout"
# log
OUTPUT="/var/log/$LIVEKITNAME.log"
# don't change! use ./autoinstall instead
UNATTENDED="0"

2
linux-live/config

@ -33,7 +33,7 @@ DISTRIBUTION_VARIANT="minbase"
DISTRIBUTION_URL="http://ru.archive.ubuntu.com/ubuntu"
#
COMP_TYPE="xz"
COMP_TYPE="lz4"
# Kernel file, will be copied to your Live Kit
# Your kernel must support aufs and squashfs. Debian Jessie's kernel is ready

67
linux-live/minioslib

@ -11,6 +11,15 @@
# =================================================================
function common_variables() {
# default is output to log. you can use OUTPUT="/dev/stdout" if you want to route events to standard output.
#OUTPUT="/var/log/$LIVEKITNAME.log"
OUTPUT="/dev/stdout"
#
if [ -f /.dockerenv ]; then
OUTPUT="/dev/stdout"
CONTAINER="docker"
fi
# if = "1", creates a second iso with a constant filename
# если ="1", создаёт второй iso с постоянным именем файла
BUILD_TEST_ISO="1"
@ -188,7 +197,7 @@ EOF
echo -e "Дополнение команд работает только при использовании команды ${CYAN}$LIVEKITNAME-install${ENDCOLOUR}."
echo -e
else
echo -e "Command ompletion only works when using the ${CYAN}$LIVEKITNAME-install${ENDCOLOUR} command."
echo -e "Command completion only works when using the ${CYAN}$LIVEKITNAME-install${ENDCOLOUR} command."
echo -e
fi
fi
@ -231,7 +240,7 @@ 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
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
@ -252,7 +261,7 @@ function check_mounted() {
function check_build_dir() {
echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..."
if [ $UNATTENDED = "1" ]; then
if [ "$UNATTENDED" = "1" ]; then
#echo -e "${RED}!!!Unattended installation!!!${ENDCOLOUR}"
BUILD_DIR="/build/$DISTRIBUTION"
echo -e "The working directory is ${MAGENTA}$BUILD_DIR${ENDCOLOUR}."
@ -295,8 +304,9 @@ function check_build_dir() {
function setup_build_dir() {
echo -e "=====> the ${CYAN}${FUNCNAME[0]}${ENDCOLOUR} function is executing ..."
if [ $UNATTENDED = "1" ]; then
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
@ -332,7 +342,7 @@ function setup_build_dir() {
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
if [ "$UNATTENDED" = "1" ]; then
check_mounted
rm -rf $BUILD_DIR
if [ -d "$BUILD_DIR" ]; then
@ -362,7 +372,13 @@ function cleanup() {
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
mount --bind /dev $BUILD_DIR/dev
mount --bind /run $BUILD_DIR/run
mount none -t proc $BUILD_DIR/proc
@ -529,7 +545,7 @@ function build_chroot() {
if [ "$OUTPUT"="/$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 "=============== CHROOT LOG ================" >>$BUILD_DIR/$LIVEKITNAME.log 2>&1
echo "===========================================" >>$BUILD_DIR/$LIVEKITNAME.log 2>&1
echo "===========================================" >>$BUILD_DIR/$LIVEKITNAME.log 2>&1
fi
@ -584,8 +600,11 @@ function build_iso() {
check_build_dir
LAST_BUILD_DIR=$(cat "$SCRIPT_DIR/.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
LIVEKITDATA=$(cat $BUILD_DIR/tmp/livekitdata)
@ -676,14 +695,32 @@ function chroot_setup_host() {
function hostreq_pkg_list() {
echo -e "${YELLOW}=====> installing required software for host system ...${ENDCOLOUR}"
$APT_CMD update >>$OUTPUT 2>&1 &&
if [ -f /.dockerenv ]; then
touch /.minios-live
$APT_CMD install -y wget >>$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
fi
$APT_CMD update >>$OUTPUT 2>&1
if [ -f /.dockerenv ]; 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 </usr/share/debootstrap/functions.diff
fi
if [ -f $SCRIPT_DIR/linux-live/pkglists/hostreq.list ]; then
#sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \
$APT_CMD install -y \

Loading…
Cancel
Save