diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..4a35eff --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,25 @@ +name: Release + +on: push + +defaults: + run: + shell: bash + +jobs: + release: + runs-on: ubuntu-latest + name: Get a working Release. + outputs: + output_1: ${{ steps.gen_output.outputs.output_1 }} + steps: + - name: Checkout + uses: actions/checkout@v4.2.2 + - name: Create Zip + run: zip -r lhroot.zip ./* + - name: Upload Artifact + uses: actions/upload-artifact@v4.4.3 + with: + name: lhroot Release + path: ./lhroot.zip + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f38e00d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: Upload To Release +on: + workflow_dispatch: +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4.2.2 + - name: 'Download latest successful build artifact' + run: | + gh_last_success_run_id=$(gh run list -w $WORKFLOW --json conclusion,headBranch,databaseId --jq 'first(.[] | select(.conclusion | contains("success"))) | .databaseId') + [ -z "$gh_last_success_run_id" ] && echo "No successful run found" && exit 1 || true + gh run download $gh_last_success_run_id -n $ARTIFACT_NAME -D $OUTPUT_DIR + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + WORKFLOW: .github/workflows/main.yaml + ARTIFACT_NAME: lhroot Release + OUTPUT_DIR: . + - name: Upload to release + uses: JasonEtco/upload-to-release@master + with: + args: ./* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.scripts/zip-all b/.scripts/zip-all new file mode 100644 index 0000000..737547f --- /dev/null +++ b/.scripts/zip-all @@ -0,0 +1,10 @@ +#!$PATH/bash +if [ $(for i in $(ls $CWD); do if [ $i == zip-all ]; then echo yes; break; fi; done) == "yes" ]; then + version="$(cat ../module.prop | grep -w version | cut -d= -f2 -s)" + zip -0 -r "lhroot-${version}-release.zip" ../* +elif [ $(for i in $(ls $CWD); do if [ $i == module.prop ]; then echo yes; break; fi; done) == "yes" ]; then + version="$(cat module.prop | grep -w version | cut -d= -f2 -s)" + zip -0 -r "lhroot-${version}-release.zip" ./* +else + echo "[E] Did not detect either zip-all nor module.prop. Make sure you're running this in the lhroot repo." +fi diff --git a/README.md b/README.md index 531bab9..809672a 100644 --- a/README.md +++ b/README.md @@ -8,20 +8,34 @@ Systemless Linux chroot installer and Linux chroot boot script - Modded by ***SC - coreutils for make_image - mke2fs for make_image - This module +- Termux (For Debian) ![Manjaro-Linux-Android](https://i.ibb.co/gdpw8QG/lhroot.png) ## NOTICE -~~Due to many cases like [this](https://github.com/FerryAr/lhroot/issues/18) and [this](https://github.com/FerryAr/lhroot/issues/21). Please make sure ALL mountpoint on chroot folder is UNMOUNTED before removing chroot folder. I don't responsible for lost all data, phone bricking, etc. You can check this repository that all the code I wrote, doesn't intentionally remove your data or bricking your phone.~~ This is fixed, because `killlinux` is called after exiting. Use this module if you are familiar about Linux Enviroment. DWYOR! +~~Due to many cases like [this](https://github.com/FerryAr/lhroot/issues/18) and [this](https://github.com/FerryAr/lhroot/issues/21). Please make sure ALL mountpoint on chroot folder is UNMOUNTED before removing chroot folder. I don't responsible for lost all data, phone bricking, etc. You can check this repository that all the code I wrote, doesn't intentionally remove your data or bricking your phone.~~ +This is fixed, because `killlinux` is called after exiting. Use this module if you are familiar about Linux Enviroment. DWYOR! + +## Downloads + +To download, look at the latest available artifact made by going to [this link.](https://github.com/SCOS100/lhroot/actions) ## Usage +*If you're running this on Termux, remember to install root-repo and tsu, and append `sudo` before each command.* + ```console lhroot ``` -and follow the instructions +and follow the instructions. + +## + +### Warning before proceeding: +Due to a new feature, the `bootlinux` command now starts all /etc/init.d files. Because of this, remember to use `bootlinux_origin` if you have elogind, seatd, or SysVInit installed, or your phone will shutdown once exited. +## After installation to boot into Linux Chroot use : ```console @@ -40,7 +54,7 @@ To unmount bind directory use : killlinux ``` -***Note***: You don't need to do this anymore, after the exit command is supplied or KILL signal is executed. +***Note***: You don't need to do this anymore, after the exit command is executed. To terminate specific instance, just pass chroot folder, e.g. @@ -80,6 +94,9 @@ mount_image ## TODO - [ ] Built in Audio support +- [x] Add debootstrap to bins +- [ ] Add debootstrap for every distro +- [x] Auto-Config of resolv.conf and hosts ## Credits - [mod-util](https://github.com/veez21/mod-util) by @veez21 diff --git a/customize.sh b/customize.sh index 681c5a4..fec4eaa 100644 --- a/customize.sh +++ b/customize.sh @@ -6,3 +6,9 @@ set_perm $MODPATH/system/bin/lhroot 0 0 0777 set_perm $MODPATH/system/bin/bootlinux 0 0 0755 set_perm $MODPATH/mod-util.sh 0 0 0777 set_perm $MODPATH/system/bin/killlinux 0 0 0755 +set_perm $MODPATH/system/bin/pkgdetails 0 0 0755 +set_perm $MODPATH/system/bin/debootstrap 0 0 0755 +set_perm $MODPATH/system/usr/share/debootstrap 0 9997 0770 +set_perm $MODPATH/system/usr/share/debootstrap/functions 0 9997 0770 +set_perm $MODPATH/system/usr/share/debootstrap/scripts 0 9997 0770 +set_perm $MODPATH/system/usr/share/debootstrap/scripts/* 0 9997 0770 diff --git a/mod-util.sh b/mod-util.sh index 9bac919..2f04ac6 100644 --- a/mod-util.sh +++ b/mod-util.sh @@ -6,8 +6,8 @@ ########################################################################################## # Versions -MODUTILVER=v2.6 -MODUTILVCODE=262 +MODUTILVER=v2.6.1 +MODUTILVCODE=261 # Check A/B slot if [ -d /system_root ]; then @@ -72,7 +72,6 @@ set_perm() { chmod $4 $1 || return 1 (if [ -z $5 ]; then case $1 in - *"/bin/"*) chcon 'u:object_r:system_file:s0' $1;; *"system/vendor/app/"*) chcon 'u:object_r:vendor_app_file:s0' $1;; *"system/vendor/etc/"*) chcon 'u:object_r:vendor_configs_file:s0' $1;; *"system/vendor/overlay/"*) chcon 'u:object_r:vendor_overlay_file:s0' $1;; @@ -177,12 +176,10 @@ div="${Bl}$(printf '%*s' "${character_no}" '' | tr " " "=")${N}" # title_div [-c] # based on $div with <title> title_div() { - set +x [ "$1" == "-c" ] && local character_no=$2 && shift 2 [ -z "$1" ] && { local message=; no=0; } || { local message="$@ "; local no=$(echo "$@" | wc -c); } - [ $character_no -gt $no ] && local extdiv=$((character_no-no)) || { echo "Invalid!"; return; } + [ $character_no -gt $no ] && local extdiv=$(( ${character_no} - ${no} )) echo "${W}$message${N}${Bl}$(printf '%*s' "$extdiv" '' | tr " " "=")${N}" - set -x 2>>$VERLOG } # set_file_prop <property> <value> <prop.file> @@ -204,7 +201,7 @@ ProgressBar() { # Determine Screen Size if [[ "$COLUMNS" -le "57" ]]; then local var1=2 - local var2=20 + local var2=20 else local var1=4 local var2=40 @@ -241,7 +238,6 @@ printf "\r${@} [${_indicator}]" # cmd & spinner <message> e_spinner() { - set +x PID=$! h=0; anim='-\|/'; while [ -d /proc/$PID ]; do @@ -249,7 +245,6 @@ e_spinner() { sleep 0.02 printf "\r${@} [${anim:$h:1}]" done - set -x 2>>$VERLOG } # test_connection @@ -266,6 +261,7 @@ test_connection() { ) && echo " - OK" || { echo " - Error"; false; } } + # Log files will be uploaded to termbin.com # Logs included: VERLOG LOG oldVERLOG oldLOG upload_logs() { @@ -276,11 +272,16 @@ upload_logs() { [ -s $oldVERLOG ] && oldverUp=$(cat $oldVERLOG | nc termbin.com 9999) || oldverUp=none [ -s $LOG ] && logUp=$(cat $LOG | nc termbin.com 9999) || logUp=none [ -s $oldLOG ] && oldlogUp=$(cat $oldLOG | nc termbin.com 9999) || oldlogUp=none + [ -s $stdoutLOG ] && stdoutUp=$(cat $stdoutLOG | nc termbin.com 9999) || stdoutUp=none + [ -s $oldstdoutLOG ] && oldstdoutUp=$(cat $oldstdoutLOG | nc termbin.com 9999) || oldstdoutUp=none echo -n "Link: " echo "$MODEL ($DEVICE) API $API\n$ROM\n$ID\n O_Verbose: $oldverUp Verbose: $verUp + O_STDOUT: $oldstdoutUp + STDOUT: $stdoutUp + O_Log: $oldlogUp Log: $logUp" | nc termbin.com 9999 } || echo "Busybox not found!" diff --git a/module.prop b/module.prop index 4532273..f831dbb 100644 --- a/module.prop +++ b/module.prop @@ -3,4 +3,4 @@ name=Linux Chroot Installer version=v2.2.1M versionCode=2 author=FerryAr - Mod by SCOS100 -description=Systemless linux chroot installer and chroot boot script - Modded version. +description=Systemless Linux chroot Installer and chroot Boot Script. diff --git a/service.sh b/service.sh new file mode 100644 index 0000000..4469530 --- /dev/null +++ b/service.sh @@ -0,0 +1,20 @@ +# This script makes sure that debootstrap works as intended by linking /system/usr/ with a new directory called /usr/ + +mount -o rw,remount / + +if [ -e /usr/ ]; then + if [ -e /system/usr/share/debootstrap/ ]; then + mount -w /system/usr/ /usr/ + else + sleep 10 + mount -w /system/usr/ /usr/ + fi +else + mkdir /usr + if [ -e /system/usr/share/debootstrap/ ]; then + mount -w /system/usr/ /usr/ + else + sleep 10 + mount -w /system/usr/ /usr/ + fi +fi diff --git a/system/bin/bootlinux b/system/bin/bootlinux index 29b4443..b1a5343 100644 --- a/system/bin/bootlinux +++ b/system/bin/bootlinux @@ -1,12 +1,24 @@ #!/system/bin/sh +exec 2>/dev/null + ######### IMPORT BOOTLINUX ENVIRONMENT ######### SCRIPT_PATH=$(readlink -f $0) . ${SCRIPT_PATH%/*}/bootlinux_env +######### STARTING run-parts ######### echo "Checking is there are files inside /etc/init.d to start." if [ -e $mnt/etc/init.d/ ]; then + echo "Found executables, sleeping 3 seconds before starting." + sleep 3s $busybox chroot $mnt run-parts -a start /etc/init.d/ fi + +######### STARTING ACTUAL BOOTLINUX ENVIROMENT ######### $busybox chroot $mnt /usr/bin/env su -l -killlinux + +######### SHUTTING DOWN BOOTLINUX ENVIROMENT ######### +$busybox chroot $mnt run-parts -a stop /etc/init.d/ +. ${SCRIPT_PATH%/*}/killlinux $1 + +exec 2>&1 diff --git a/system/bin/bootlinux_debug b/system/bin/bootlinux_debug new file mode 100644 index 0000000..6d0cfa6 --- /dev/null +++ b/system/bin/bootlinux_debug @@ -0,0 +1,25 @@ +#!/system/bin/sh + +######### IMPORT BOOTLINUX ENVIRONMENT ######### +SCRIPT_PATH=$(readlink -f $0) +. ${SCRIPT_PATH%/*}/bootlinux_env > /sdcard/log.1.txt + +######### STARTING run-parts ######### +if [ -e $mnt/etc/init.d/ ]; then + echo "Found executables in init.d, sleeping 3 seconds before starting." + sleep 3s + read -r choice?'Run /etc/init.d scripts? (Y/N)--> ' + echo "" + if [ $choice = "Y" ] + $busybox chroot $mnt run-parts -a start /etc/init.d/; clear; env su -l + $busybox chroot $mnt run-parts -a stop /etc/init.d/ > /sdcard/log.2.txt + else + $busybox chroot $mnt /usr/bin/env su -l + fi +else + ######### STARTING ACTUAL BOOTLINUX ENVIROMENT ######### + $busybox chroot $mnt /usr/bin/env su -l +fi + +######### SHUTTING DOWN BOOTLINUX ENVIROMENT ######### +. ${SCRIPT_PATH%/*}/killlinux $1 > /sdcard/log.3.txt diff --git a/system/bin/bootlinux_env b/system/bin/bootlinux_env index efedf82..9be584f 100644 --- a/system/bin/bootlinux_env +++ b/system/bin/bootlinux_env @@ -1,5 +1,7 @@ #!/system/bin/sh +exec 2>/dev/null + ######### IMPORT BOOTLINUX INITIALIZATION ######### SCRIPT_PATH=$(readlink -f $0) . ${SCRIPT_PATH%/*}/bootlinux_log @@ -25,5 +27,7 @@ export DEX2OATBOOTCLASSPATH=/apex/com.android.art/javalib/core-oj.jar:/apex/com. unset LD_PRELOAD unset PREFIX +exec 2>&1 + ######### TERMINAL SETUP ######### clear diff --git a/system/bin/bootlinux_init b/system/bin/bootlinux_init index da4fd3a..e10c38d 100644 --- a/system/bin/bootlinux_init +++ b/system/bin/bootlinux_init @@ -1,5 +1,7 @@ #!/system/bin/sh +exec 2>/dev/null + if [ -x /system/xbin/busybox ]; then busybox=/system/xbin/busybox elif [ -x /system/bin/busybox ]; then @@ -150,6 +152,7 @@ mount_linux_chroot() { done cd - 2>&1 > /dev/null fi + exec 2>/dev/null mkdir -p $mnt/data/data mkdir -p $mnt/data/dalvik-cache mkdir -p $mnt/vendor @@ -165,14 +168,6 @@ mount_linux_chroot() { # ln -s /dev/tun /dev/net/tun 2> /dev/null ######### SET DNS ######## - - # setup - rm $mnt/etc/resolv.conf - touch $mnt/etc/resolv.conf - - # add two public dns entries - echo "nameserver 1.1.1.1" >> $mnt/etc/resolv.conf - echo "nameserver 1.0.0.1" >> $mnt/etc/resolv.conf chmod 644 $mnt/etc/resolv.conf ######### MOUNTING FILESYSTEM IN CHROOT ######### @@ -192,7 +187,7 @@ mount_linux_chroot() { [ ! -d $mnt/dev/pts ] && mkdir -p $mnt/dev/pts $busybox mount -t devpts devpts $mnt/dev/pts && bllog "[+] mounted /dev/pts" fi - + ######### MOUNT DEV SHM ######## if [ ! "$(mountpoint $mnt/dev/shm 2> /dev/null | grep 'is a')" ]; then [ ! -d $mnt/dev/shm ] && mkdir -p $mnt/dev/shm @@ -279,9 +274,6 @@ mount_linux_chroot() { # NETWORK SETTINGS # $busybox sysctl -w net.ipv4.ip_forward=1 - echo "127.0.0.1 localhost linux" > $mnt/etc/hosts - echo "::1 localhost ip6-localhost ip6-loopback" >> $mnt/etc/hosts - echo "linux" > $mnt/proc/sys/kernel/hostname echo "The Linux chroot has been started." if [ -f /sdcard/debug ]; then echo " [!] Everytime you mount the linux chroot, please press ENTER to continue. (If chroot is already mounted, this won't prompt.)" @@ -302,3 +294,5 @@ else echo "Missing required folder, exit now...." exit 1 fi + +exec 2>&1 diff --git a/system/bin/bootlinux_origin b/system/bin/bootlinux_origin new file mode 100644 index 0000000..b3e272b --- /dev/null +++ b/system/bin/bootlinux_origin @@ -0,0 +1,26 @@ +#!/system/bin/sh + +exec 2>/dev/null + +echo "Warning: You're running origin mode of bootlinux, this means that the autostart of init.d items is suspended." + +######### IMPORT BOOTLINUX ENVIRONMENT ######### +SCRIPT_PATH=$(readlink -f $0) +. ${SCRIPT_PATH%/*}/bootlinux_env + +######### STARTING run-parts ######### +# echo "Checking is there are files inside /etc/init.d to start." +# if [ -e $mnt/etc/init.d/ ]; then +# echo "Found executables, sleeping 3 seconds before starting." +# sleep 3s +# $busybox chroot $mnt run-parts -a start /etc/init.d/ +# fi + +######### STARTING ACTUAL BOOTLINUX ENVIROMENT ######### +$busybox chroot $mnt /usr/bin/env su -l + +######### SHUTTING DOWN BOOTLINUX ENVIROMENT ######### +# $busybox chroot $mnt run-parts -a stop /etc/init.d/ +. ${SCRIPT_PATH%/*}/killlinux $1 + +exec 2>&1 diff --git a/system/bin/debootstrap b/system/bin/debootstrap new file mode 100644 index 0000000..8352db1 --- /dev/null +++ b/system/bin/debootstrap @@ -0,0 +1,856 @@ +#!/bin/sh +set -e + +VERSION='1.0.128-meefik' + +unset TMP TEMP TMPDIR || true + +# might not be exported if we're running from init=/bin/sh or similar +export PATH + +########################################################################### + +if [ -z "$DEBOOTSTRAP_DIR" ]; then + if [ -x /debootstrap/debootstrap ]; then + DEBOOTSTRAP_DIR=/debootstrap + else + DEBOOTSTRAP_DIR=/system/usr/share/debootstrap + fi +fi + +. "$DEBOOTSTRAP_DIR/functions" +exec 4>&1 + +LANG=C +EXTRA_SUITES="" +USE_COMPONENTS=main +KEYRING="" +DISABLE_KEYRING="" +FORCE_KEYRING="" +VARIANT="" +MERGED_USR="" +ARCH="" +HOST_ARCH="" +HOST_OS="" +KEEP_DEBOOTSTRAP_DIR="" +USE_DEBIANINSTALLER_INTERACTION="" +SECOND_STAGE_ONLY="" +CHROOTDIR="" +MAKE_TARBALL="" +EXTRACTOR_OVERRIDE="" +UNPACK_TARBALL="" +ADDITIONAL="" +EXCLUDE="" +EXCLUDE_DEPENDENCY="" +VERBOSE="" +CERTIFICATE="" +CHECKCERTIF="" +PRIVATEKEY="" +CACHE_DIR="" +INRELEASE_PATH="" + +DEF_MIRROR="http://deb.debian.org/debian" +DEF_HTTPS_MIRROR="https://deb.debian.org/debian" + +export LANG USE_COMPONENTS +umask 022 + +########################################################################### + +## phases: +## finddebs dldebs printdebs save_variables first_stage second_stage + +RESOLVE_DEPS=true + +WHAT_TO_DO="finddebs dldebs save_variables first_stage second_stage" +am_doing_phase () { + # usage: if am_doing_phase finddebs; then ...; fi + local x; + for x in "$@"; do + if echo " $WHAT_TO_DO " | grep -q " $x "; then return 0; fi + done + return 1 +} + +########################################################################### + +usage_err() +{ + info USAGE1 "usage: [OPTION]... <suite> <target> [<mirror> [<script>]]" + info USAGE2 "Try \`${0##*/} --help' for more information." + error "$@" +} + +usage() +{ + echo "Usage: ${0##*/} [OPTION]... <suite> <target> [<mirror> [<script>]]" + echo "Bootstrap a Debian base system into a target directory." + echo + cat <<EOF + --help display this help and exit + --version display version information and exit + --verbose don't turn off the output of wget + + --download-only download packages, but don't perform installation + --print-debs print the packages to be installed, and exit + + --arch=A set the architecture to install (use if no dpkg) + [ --arch=powerpc ] + + --include=A,B,C adds specified names to the list of base packages + --exclude=A,B,C removes specified packages from the list + --extra-suites=A,B,C also use packages from the listed suites of the + archive + --components=A,B,C use packages from the listed components of the + archive + --variant=X use variant X of the bootstrap scripts + (currently supported variants: buildd, fakechroot, + minbase) + --no-merged-usr do not make /{bin,sbin,lib}/ symlinks to /usr/ + --keyring=K check Release files against keyring K + --no-check-gpg avoid checking Release file signatures + --force-check-gpg force checking Release file signatures + (also disables automatic fallback to HTTPS in case + of a missing keyring), aborting otherwise + --no-resolve-deps don't try to resolve dependencies automatically + --log-extra-deps record extra dependency info in debootstrap.log + --cache-dir=DIR Use specified directory as package cache directory + + --unpack-tarball=T acquire .debs from a tarball instead of http + --make-tarball=T download .debs and create a gzipped tarball + --second-stage-target=DIR + Run second stage in a subdirectory instead of root + (can be used to create a foreign chroot) + (requires --second-stage) + --extractor=TYPE override automatic .deb extractor selection + (supported: $EXTRACTORS_SUPPORTED) + --debian-installer used for internal purposes by debian-installer + --private-key=file read the private key from file + --certificate=file use the client certificate stored in file (PEM) + --no-check-certificate do not check certificate against certificate authorities + + --inrelease-path determine the path to the InRelease file of the main + archive relative to the normal position of an InRelease + file +EOF +} + +########################################################################### + +if [ -z "$PKGDETAILS" ]; then + error 1 NO_PKGDETAILS "No pkgdetails available; either install perl, or build pkgdetails.c from the base-installer source package" +fi + +########################################################################### + +if [ $# != 0 ] ; then + while true ; do + case "$1" in + --help) + usage + exit 0 + ;; + --version) + echo "debootstrap $VERSION" + exit 0 + ;; + --debian-installer) + if ! (echo -n "" >&3) 2>/dev/null; then + error 1 ARG_DIBYHAND "If running debootstrap by hand, don't use --debian-installer" + fi + USE_DEBIANINSTALLER_INTERACTION=yes + shift + ;; + --foreign) + check_conflicting_option "$1" + if [ -n "$LOOSEN_CONFLICTING_RESTRICTION" ]; then + WHAT_TO_DO="first_stage" + else + WHAT_TO_DO="finddebs dldebs save_variables first_stage" + fi + shift + ;; + --second-stage) + check_conflicting_option "$1" + WHAT_TO_DO="second_stage" + SECOND_STAGE_ONLY=true + shift + ;; + --second-stage-target|--second-stage-target=?*) + if [ "$SECOND_STAGE_ONLY" != "true" ] ; then + error 1 STAGE2ONLY "option %s only applies in the second stage" "$1" + fi + if [ "$1" = "--second-stage-target" ] && [ -n "$2" ] ; then + CHROOTDIR="$2" + shift 2 + elif [ "$1" != "${1#--second-stage-target=}" ]; then + CHROOTDIR="${1#--second-stage-target=}" + shift + else + error 1 NEEDARG "option requires an argument: %s" "$1" + fi + ;; + --print-debs) + check_conflicting_option "$1" + WHAT_TO_DO="finddebs printdebs kill_target" + shift + ;; + --download-only) + check_conflicting_option "$1" + WHAT_TO_DO="finddebs dldebs" + shift + ;; + --make-tarball|--make-tarball=?*) + check_conflicting_option "$1" + WHAT_TO_DO="finddebs dldebs save_variables maketarball kill_target" + if [ "$1" = "--make-tarball" ] && [ -n "$2" ] ; then + MAKE_TARBALL="$2" + shift 2 + elif [ "$1" != "${1#--make-tarball=}" ]; then + MAKE_TARBALL="${1#--make-tarball=}" + shift + else + error 1 NEEDARG "option requires an argument %s" "$1" + fi + ;; + --resolve-deps) + # redundant, but avoids breaking compatibility + RESOLVE_DEPS=true + shift + ;; + --no-resolve-deps) + RESOLVE_DEPS=false + shift + ;; + --log-extra-deps) + LOG_EXTRA_DEPS=true + shift + ;; + --keep-debootstrap-dir) + KEEP_DEBOOTSTRAP_DIR=true + shift + ;; + --arch|--arch=?*) + if [ "$1" = "--arch" ] && [ -n "$2" ] ; then + ARCH="$2" + shift 2 + elif [ "$1" != "${1#--arch=}" ]; then + ARCH="${1#--arch=}" + shift + else + error 1 NEEDARG "option requires an argument %s" "$1" + fi + ;; + --extractor|--extractor=?*) + if [ "$1" = "--extractor" ] && [ -n "$2" ] ; then + EXTRACTOR_OVERRIDE="$2" + shift 2 + elif [ "$1" != "${1#--extractor=}" ]; then + EXTRACTOR_OVERRIDE="${1#--extractor=}" + shift + else + error 1 NEEDARG "option requires an argument %s" "$1" + fi + if valid_extractor "$EXTRACTOR_OVERRIDE"; then + if ! in_path "$EXTRACTOR_OVERRIDE"; then + error 1 MISSINGEXTRACTOR "The selected extractor cannot be found: %s" "$EXTRACTOR_OVERRIDE" + fi + else + error 1 BADEXTRACTOR "%s: unknown extractor" "$EXTRACTOR_OVERRIDE" + fi + ;; + --unpack-tarball|--unpack-tarball=?*) + if [ "$1" = "--unpack-tarball" ] && [ -n "$2" ] ; then + check_conflicting_option "$1" + if [ -n "$LOOSEN_CONFLICTING_RESTRICTION" ]; then + WHAT_TO_DO="first_stage" + else + WHAT_TO_DO="first_stage second_stage" + fi + UNPACK_TARBALL="$2" + shift 2 + elif [ "$1" != "${1#--unpack-tarball=}" ]; then + check_conflicting_option "$1" + if [ -n "$LOOSEN_CONFLICTING_RESTRICTION" ]; then + WHAT_TO_DO="first_stage" + else + WHAT_TO_DO="first_stage second_stage" + fi + UNPACK_TARBALL="${1#--unpack-tarball=}" + shift + else + error 1 NEEDARG "option requires an argument %s" "$1" + fi + if [ ! -f "$UNPACK_TARBALL" ] ; then + error 1 NOTARBALL "%s: No such file or directory" "$UNPACK_TARBALL" + fi + ;; + --include|--include=?*) + if [ "$1" = "--include" ] && [ -n "$2" ]; then + ADDITIONAL="$2" + shift 2 + elif [ "$1" != "${1#--include=}" ]; then + ADDITIONAL="${1#--include=}" + shift 1 + else + error 1 NEEDARG "option requires an argument %s" "$1" + fi + ADDITIONAL="$(echo "$ADDITIONAL" | tr , " ")" + ;; + --exclude|--exclude=?*) + if [ "$1" = "--exclude" ] && [ -n "$2" ]; then + EXCLUDE="$2" + shift 2 + elif [ "$1" != "${1#--exclude=}" ]; then + EXCLUDE="${1#--exclude=}" + shift 1 + else + error 1 NEEDARG "option requires an argument %s" "$1" + fi + EXCLUDE="$(echo "$EXCLUDE" | tr , " ")" + ;; + --verbose) + VERBOSE=true + export VERBOSE + shift 1 + ;; + --extra-suites|--extra-suites=?*) + if [ "$1" = "--extra-suites" ] && [ -n "$2" ]; then + EXTRA_SUITES="$2" + shift 2 + elif [ "$1" != "${1#--extra-suites=}" ]; then + EXTRA_SUITES="${1#--extra-suites=}" + shift 1 + else + error 1 NEEDARG "option requires an argument %s" "$1" + fi + EXTRA_SUITES="$(echo "$EXTRA_SUITES" | tr , " ")" + ;; + --components|--components=?*) + if [ "$1" = "--components" ] && [ -n "$2" ]; then + USE_COMPONENTS="$2" + shift 2 + elif [ "$1" != "${1#--components=}" ]; then + USE_COMPONENTS="${1#--components=}" + shift 1 + else + error 1 NEEDARG "option requires an argument %s" "$1" + fi + USE_COMPONENTS="$(echo "$USE_COMPONENTS" | tr , "|")" + ;; + --variant|--variant=?*) + if [ "$1" = "--variant" ] && [ -n "$2" ]; then + VARIANT="$2" + shift 2 + elif [ "$1" != "${1#--variant=}" ]; then + VARIANT="${1#--variant=}" + shift 1 + else + error 1 NEEDARG "option requires an argument %s" "$1" + fi + ;; + --cache-dir|--cache-dir=?*) + # Okay, let's check user's option + if [ "$1" = "--cache-dir" ] && [ -n "$2" ] ; then + CACHE_DIR="$2" + shift 2 + elif [ "$1" != "${1#--cache-dir=}" ]; then + CACHE_DIR="${1#--cache-dir=}" + shift + else + error 1 NEEDARG "option requires an argument %s" "$1" + fi + if [ ! -z "${CACHE_DIR##/*}" ]; then + error 1 NOTABSOLUTEPATH "cache directory should be specified with an absolute path" + fi + if [ ! -d "$CACHE_DIR" ] ; then + error 1 NOCACHEDIR "%s: No such directory" "$CACHE_DIR" + fi + ;; + --merged-usr) + MERGED_USR=yes + shift + ;; + --no-merged-usr) + MERGED_USR=no + shift + ;; + --keyring|--keyring=?*) + if ! gpgv --version >/dev/null 2>&1; then + error 1 NEEDGPGV "gpgv not installed, but required for Release verification" + fi + if [ "$1" = "--keyring" ] && [ -n "$2" ]; then + KEYRING="$2" + shift 2 + elif [ "$1" != "${1#--keyring=}" ]; then + KEYRING="${1#--keyring=}" + shift 1 + else + error 1 NEEDARG "option requires an argument %s" "$1" + fi + if [ ! -e "$KEYRING" ]; then + error 1 KEYRING "specified keyring file ($KEYRING) not found" + fi + ;; + --no-check-gpg) + shift 1 + DISABLE_KEYRING=1 + ;; + --force-check-gpg) + shift 1 + FORCE_KEYRING=1 + ;; + --certificate|--certificate=?*) + if [ "$1" = "--certificate" ] && [ -n "$2" ]; then + CERTIFICATE="--certificate=$2" + shift 2 + elif [ "$1" != "${1#--certificate=}" ]; then + CERTIFICATE="--certificate=${1#--certificate=}" + shift 1 + else + error 1 NEEDARG "option requires an argument %s" "$1" + fi + ;; + --private-key|--private-key=?*) + if [ "$1" = "--private-key" ] && [ -n "$2" ]; then + PRIVATEKEY="--private-key=$2" + shift 2 + elif [ "$1" != "${1#--private-key=}" ]; then + PRIVATEKEY="--private-key=${1#--private-key=}" + shift 1 + else + error 1 NEEDARG "option requires an argument %s" "$1" + fi + ;; + --no-check-certificate) + CHECKCERTIF="--no-check-certificate" + shift + ;; + --inrelease-path|--inrelease-path=?*) + if [ "$1" = "--inrelease-path" ] && [ -n "$2" ]; then + INRELEASE_PATH="$2" + shift 2 + elif [ "$1" != "${1#--inrelease-path=}" ]; then + INRELEASE_PATH=${1#--inrelease-path=} + shift 1 + else + error 1 NEEDARG "option requires an argument %s" "$1" + fi + ;; + -*) + error 1 BADARG "unrecognized or invalid option %s" "$1" + ;; + *) + break + ;; + esac + done +fi + +########################################################################### +# do auto proxy discovery +AUTOPROXY="" +if ! doing_variant fakechroot && command -v apt-config >/dev/null; then + eval "$(apt-config shell AUTOPROXY Acquire::http::Proxy-Auto-Detect)" + if [ -z "$AUTOPROXY" ]; then + eval "$(apt-config shell AUTOPROXY Acquire::http::ProxyAutoDetect)" + fi + if [ -z "$http_proxy" ] && [ -x "$AUTOPROXY" ]; then + http_proxy="$($AUTOPROXY)" + if [ -n "$http_proxy" ]; then + info AUTOPROXY "Using auto-detected proxy: $http_proxy" + export http_proxy + fi + fi +fi + +########################################################################### +if [ -n "$DISABLE_KEYRING" ] && [ -n "$FORCE_KEYRING" ]; then + error 1 BADARG "Both --no-check-gpg and --force-check-gpg specified, please pick one (at most)" +fi + +########################################################################### + +if [ "$SECOND_STAGE_ONLY" = "true" ]; then + SUITE=$(cat "$DEBOOTSTRAP_DIR/suite") + if [ -e "$DEBOOTSTRAP_DIR/extra-suites" ]; then + EXTRA_SUITES=$(cat "$DEBOOTSTRAP_DIR/extra-suites") + fi + ARCH=$(cat "$DEBOOTSTRAP_DIR/arch") + USER_MIRROR=$(cat "$DEBOOTSTRAP_DIR/mirror") + if [ -e "$DEBOOTSTRAP_DIR/variant" ]; then + VARIANT=$(cat "$DEBOOTSTRAP_DIR/variant") + SUPPORTED_VARIANTS="$VARIANT" + fi + if [ -z "$CHROOTDIR" ]; then + TARGET=/ + else + TARGET=$CHROOTDIR + fi + SCRIPT="$DEBOOTSTRAP_DIR/suite-script" +else + if ! in_path wget; then + error 1 NEEDWGET "You must install wget to download packages." + fi + if [ -z "$1" ] || [ -z "$2" ]; then + usage_err 1 NEEDSUITETARGET "You must specify a suite and a target." + fi + SUITE="$1" + TARGET="$2" + USER_MIRROR="$3" + TARGET="${TARGET%/}" + if [ "${TARGET#/}" = "${TARGET}" ]; then + if [ "${TARGET%/*}" = "$TARGET" ] ; then + TARGET="$(pwd)/$TARGET" + else + TARGET="$(cd "${TARGET%/*}"; echo "$(pwd)/${TARGET##*/}")" + fi + fi + + SCRIPT="$DEBOOTSTRAP_DIR/scripts/$1" + if [ -n "$VARIANT" ] && [ -e "${SCRIPT}.${VARIANT}" ]; then + SCRIPT="${SCRIPT}.${VARIANT}" + SUPPORTED_VARIANTS="$VARIANT" + fi + if [ "$4" != "" ]; then + if [ -e "$DEBOOTSTRAP_DIR/scripts/$4" ]; then + SCRIPT="$DEBOOTSTRAP_DIR/scripts/$4" + else + SCRIPT="$4" + fi + fi +fi + +########################################################################### + +if am_doing_phase kill_target; then + # Require empty target when we are going to remove it afterwards + if [ -d "$TARGET" ] && [ -n "$(ls -A "$TARGET")" ] && \ + [ "$KEEP_DEBOOTSTRAP_DIR" != "true" ]; then + error 1 BADTARGET "Target directory '$TARGET' is not empty and it would be wiped" + fi +fi + +########################################################################### + +if in_path dpkg && \ + dpkg --print-architecture >/dev/null 2>&1; then + HOST_ARCH=$(/usr/bin/dpkg --print-architecture) +elif in_path udpkg && \ + udpkg --print-architecture >/dev/null 2>&1; then + HOST_ARCH=$(/usr/bin/udpkg --print-architecture) +elif [ -e "$DEBOOTSTRAP_DIR/arch" ]; then + HOST_ARCH=$(cat "$DEBOOTSTRAP_DIR/arch") +fi +HOST_OS="$HOST_ARCH" +# basic host OS guessing for non-Debian systems +if [ -z "$HOST_OS" ]; then + case $(uname) in + Linux) + HOST_OS=linux + ;; + GNU/kFreeBSD) + HOST_OS=kfreebsd + ;; + GNU) + HOST_OS=hurd + ;; + FreeBSD*) + HOST_OS=freebsd + ;; + esac +fi + +if [ -z "$ARCH" ]; then + ARCH="$HOST_ARCH" +fi + +if [ -z "$ARCH" ] || [ -z "$HOST_OS" ]; then + error 1 WHATARCH "Couldn't work out current architecture" + +fi + +if [ "$HOST_OS" = "kfreebsd" ] || [ "$HOST_OS" = "freebsd" ]; then + for module in linprocfs fdescfs tmpfs linsysfs; do + kldstat -m "$module" > /dev/null 2>&1 || warning SANITYCHECK "Probably required module %s is not loaded" "$module" + done +fi + +if [ "$TARGET" = "/" ]; then + CHROOT_CMD="" +else + CHROOT_CMD="chroot \"$TARGET\"" +fi + +# fakeroot cannot check /proc/1/environ +if [ "$HOST_OS" = Linux ] && ! doing_variant fakechroot && [ "$CONTAINER" = "lxc-libvirt" ]; then + CHROOT_CMD="unshare --net $CHROOT_CMD" +fi + +if [ -z "$SHA_SIZE" ]; then + SHA_SIZE=256 +fi +if ! in_path "sha${SHA_SIZE}sum" && ! in_path "sha${SHA_SIZE}"; then + warning SHA_SIZE "Cannot find binary for checking sha%s checksums, falling back to sha1" "${SHA_SIZE}" + SHA_SIZE=1 +fi +DEBOOTSTRAP_CHECKSUM_FIELD="SHA$SHA_SIZE" + +export ARCH SUITE EXTRA_SUITES TARGET CHROOT_CMD SHA_SIZE DEBOOTSTRAP_CHECKSUM_FIELD + +if [ ! -e "$SCRIPT" ]; then + error 1 NOSCRIPT "No such script: %s" "$SCRIPT" +fi + +########################################################################### + +if [ "$TARGET" != "" ]; then + mkdir -p "$TARGET/debootstrap" +fi + +########################################################################### + +# Use of fd's by functions/scripts: +# +# stdin/stdout/stderr: used normally +# fd 4: I:/W:/etc information +# fd 5,6: spare for functions +# fd 7,8: spare for scripts + +if [ "$USE_DEBIANINSTALLER_INTERACTION" = yes ]; then + # stdout=stderr: full log of debootstrap run + # fd 3: I:/W:/etc information + exec 4>&3 +elif am_doing_phase printdebs; then + # stderr: I:/W:/etc information + # stdout: debs needed + exec 4>&2 +else + # stderr: used in exceptional circumstances only + # stdout: I:/W:/etc information + # $TARGET/debootstrap/debootstrap.log: full log of debootstrap run + exec 4>&1 + exec >>"$TARGET/debootstrap/debootstrap.log" + exec 2>&1 +fi + +########################################################################### + +if [ -x /usr/bin/arch-test ] && am_doing_phase second_stage; then + if doing_variant fakechroot; then + ret=0; arch-test "$ARCH" || ret=$? + # Avoid failure with old arch-test package + elif arch-test --version > /dev/null 2>&1; then + ret=0; arch-test -c "$TARGET" "$ARCH" || ret=$? + else + ret=3 + fi + + case $ret in + 0) info ARCHEXEC "Target architecture can be executed" ;; + 1) error 1 ARCHNOTEXEC "Unable to execute target architecture" ;; + *) info ARCHEXECUNKNOWN "Can't verify that target arch works" ;; + esac +fi + +########################################################################### + + + +if [ "$UNPACK_TARBALL" ]; then + if [ "${UNPACK_TARBALL#/}" = "$UNPACK_TARBALL" ]; then + error 1 TARPATH "Tarball must be given an absolute path" + fi + if [ "${UNPACK_TARBALL%.tar}" != "$UNPACK_TARBALL" ]; then + (cd "$TARGET" && tar -xf "$UNPACK_TARBALL") + elif [ "${UNPACK_TARBALL%.tar.[g|x]z}" != "$UNPACK_TARBALL" ]; then + (cd "$TARGET" && tar -xf "$UNPACK_TARBALL") + elif [ "${UNPACK_TARBALL%.tgz}" != "$UNPACK_TARBALL" ]; then + (cd "$TARGET" && zcat "$UNPACK_TARBALL" | tar -xf -) + else + error 1 NOTTAR "Unknown tarball: must be .tar.[gz,xz], .tar or .tgz" + fi +fi + +########################################################################### + +. "$SCRIPT" + +MIRRORS="$DEF_MIRROR" +if [ "$USER_MIRROR" != "" ]; then + MIRRORS="${USER_MIRROR%/}" +fi + +export MIRRORS + +ok=false +for v in $SUPPORTED_VARIANTS; do + if doing_variant "$v"; then ok=true; fi +done +if ! "$ok"; then + error 1 UNSUPPVARIANT "unsupported variant" +fi + +########################################################################### + +if am_doing_phase finddebs; then + if [ "$FINDDEBS_NEEDS_INDICES" = "true" ] || \ + [ "$RESOLVE_DEPS" = "true" ]; then + download_indices + GOT_INDICES=true + fi + + work_out_debs + + base=$(without "$base $ADDITIONAL" "$EXCLUDE") + required=$(without "$required" "$EXCLUDE") + + if [ "$RESOLVE_DEPS" = true ]; then + requiredX=$(echo "$required" | tr ' ' '\n' | sort | uniq) + baseX=$(echo "$base" | tr ' ' '\n' | sort | uniq) + + info RESOLVEREQ "Resolving dependencies of required packages..." + required=$(resolve_deps "$requiredX") + info RESOLVEBASE "Resolving dependencies of base packages..." + base=$(resolve_deps "$baseX") + base=$(without "$base" "$required") + + if [ "$LOG_EXTRA_DEPS" = true ]; then + baseN=$(without "$baseX" "$requiredX") + baseU=$(without "$baseX" "$baseN") + + if [ "$baseU" != "" ]; then + info REDUNDANTBASE "Found packages in base already in required: %s" "$baseU" + fi + + requiredX=$(without "$required" "$requiredX") + baseX=$(without "$base" "$baseX") + if [ "$requiredX" != "" ]; then + info NEWREQUIRED "Found additional required dependencies: %s" "$requiredX" + fi + if [ "$baseX" != "" ]; then + info NEWBASE "Found additional base dependencies: %s" "$baseX" + fi + fi + fi + + all_debs="$required $base" +fi + +if am_doing_phase printdebs; then + echo "$all_debs" +fi + +if am_doing_phase dldebs; then + if [ "$GOT_INDICES" != "true" ]; then + download_indices + fi + download "$all_debs" +fi + +if am_doing_phase save_variables; then + cp "$DEBOOTSTRAP_DIR/debootstrap" "$TARGET/debootstrap/debootstrap" + cp "$DEBOOTSTRAP_DIR/functions" "$TARGET/debootstrap/functions" + cp "$SCRIPT" "$TARGET/debootstrap/suite-script" + # pick up common setting scripts + cp "$DEBOOTSTRAP_DIR"/scripts/*-common "$TARGET/debootstrap/" + echo "$ARCH" >"$TARGET/debootstrap/arch" + echo "$SUITE" >"$TARGET/debootstrap/suite" + echo "$USER_MIRROR" >"$TARGET/debootstrap/mirror" + [ "" = "$EXTRA_SUITES" ] || + echo "$EXTRA_SUITES" >"$TARGET/debootstrap/extra-suites" + [ "" = "$VARIANT" ] || + echo "$VARIANT" >"$TARGET/debootstrap/variant" + echo "$required" >"$TARGET/debootstrap/required" + echo "$base" >"$TARGET/debootstrap/base" + + chmod 755 "$TARGET/debootstrap/debootstrap" +fi + +if am_doing_phase maketarball; then + (cd "$TARGET"; + tar czf - var/lib/apt var/cache/apt debootstrap) >"$MAKE_TARBALL" +fi + +if am_doing_phase first_stage; then + choose_extractor + + if [ -n "$UNPACK_TARBALL" ]; then + required=$(cat "$TARGET/debootstrap/required") + base=$(cat "$TARGET/debootstrap/base") + all_debs="$required $base" + fi + + # first stage sets up the chroot -- no calls should be made to + # "chroot $TARGET" here; but they should be possible by the time it's + # finished + first_stage_install + + if ! am_doing_phase second_stage; then + cp "$DEBOOTSTRAP_DIR/debootstrap" "$TARGET/debootstrap/debootstrap" + cp "$DEBOOTSTRAP_DIR/functions" "$TARGET/debootstrap/functions" + cp "$SCRIPT" "$TARGET/debootstrap/suite-script" + # pick up common setting scripts + cp "$DEBOOTSTRAP_DIR"/scripts/*-common "$TARGET/debootstrap/" + echo "$ARCH" >"$TARGET/debootstrap/arch" + echo "$SUITE" >"$TARGET/debootstrap/suite" + [ "" = "$EXTRA_SUITES" ] || + echo "$EXTRA_SUITES" >"$TARGET/debootstrap/extra-suites" + echo "$USER_MIRROR" >"$TARGET/debootstrap/mirror" + [ "" = "$VARIANT" ] || + echo "$VARIANT" >"$TARGET/debootstrap/variant" + echo "$required" >"$TARGET/debootstrap/required" + echo "$base" >"$TARGET/debootstrap/base" + + chmod 755 "$TARGET/debootstrap/debootstrap" + fi + + # create sources.list + if [ "${MIRRORS#http*://}" != "$MIRRORS" ]; then + setup_apt_sources "${MIRRORS%% *}" + else + setup_apt_sources "$DEF_MIRROR" + fi +fi + +if am_doing_phase second_stage; then + if [ "$SECOND_STAGE_ONLY" = true ]; then + required=$(cat "$DEBOOTSTRAP_DIR/required") + base=$(cat "$DEBOOTSTRAP_DIR/base") + all_debs="$required $base" + fi + + # second stage uses the chroot to clean itself up -- has to be able to + # work from entirely within the chroot (in case we've booted into it, + # possibly over NFS eg) + second_stage_install + + if [ -e "$TARGET/debootstrap/debootstrap.log" ]; then + if [ "$KEEP_DEBOOTSTRAP_DIR" = true ]; then + cp "$TARGET/debootstrap/debootstrap.log" "$TARGET/var/log/bootstrap.log" + else + # debootstrap.log is still open as stdout/stderr and needs + # to remain so, but after unlinking it some NFS servers + # implement this by a temporary file in the same directory, + # which makes it impossible to rmdir that directory. + # Moving it instead works around the problem. + mv "$TARGET/debootstrap/debootstrap.log" "$TARGET/var/log/bootstrap.log" + fi + fi + sync + + if [ "$KEEP_DEBOOTSTRAP_DIR" = true ]; then + if [ -x "$TARGET/debootstrap/debootstrap" ]; then + chmod 644 "$TARGET/debootstrap/debootstrap" + fi + else + rm -rf "$TARGET/debootstrap" + fi +fi + +if am_doing_phase kill_target; then + if [ "$KEEP_DEBOOTSTRAP_DIR" != true ]; then + info KILLTARGET "Deleting target directory" + rm -rf "$TARGET" + fi +fi diff --git a/system/bin/killlinux b/system/bin/killlinux index e34d870..1986714 100644 --- a/system/bin/killlinux +++ b/system/bin/killlinux @@ -1,5 +1,7 @@ #!/system/bin/sh +exec 2>/dev/null + if [ -x /system/xbin/busybox ]; then busybox=/system/xbin/busybox elif [ -x /system/bin/busybox ]; then @@ -41,7 +43,7 @@ fi ########## Kill all running linux services and processes ########## kill_pids() { - bllog "[!] Killing all running linux services .." + echo "[!] Killing all running linux services .." local lsof_full=$($busybox lsof | awk '{print $1}' | grep -c '^lsof') if [ "${lsof_full}" -eq 0 ]; then local pids=$($busybox lsof | grep "$mnt" | awk '{print $1}' | uniq) @@ -49,7 +51,7 @@ kill_pids() { local pids=$($busybox lsof | grep "$mnt" | awk '{print $2}' | uniq) fi if [ -n "${pids}" ]; then - kill -9 ${pids} 2> /dev/null + kill -9 ${pids} 2>/dev/null return $? fi return 0 @@ -65,13 +67,13 @@ unset LD_PRELOAD echo "Shutting down SSH Server" $busybox chmod 666 /dev/null -$busybox chroot $mnt /etc/init.d/sshd stop +$busybox chroot $mnt /etc/init.d/sshd stop > /dev/null echo "Shutting down Postgresql" -$busybox chroot $mnt /etc/init.d/postgresql stop +$busybox chroot $mnt /etc/init.d/postgresql stop > /dev/null echo "Shutting down Apache2" -$busybox chroot $mnt /etc/init.d/apache2 stop +$busybox chroot $mnt /etc/init.d/apache2 stop > /dev/null echo "Kill all Linux services and processes" kill_pids @@ -80,21 +82,24 @@ kill_pids echo "Removing all Linux mounts" $busybox umount $mnt/dev/pts && echo "unmounted pts" -$busybox umount $mnt/dev && echo "unmounted dev" +/system/bin/toybox umount -l $mnt/dev && echo "unmounted dev" $busybox umount $mnt/proc && echo "unmounted proc" $busybox umount $mnt/sys && echo "unmounted sys" $busybox umount $mnt/system && echo "unmounted system" $busybox umount $mnt/sdcard && echo "unmounted sdcard" -$busybox umount $mnt/external_sd && echo "unmounted external_sd" +$busybox umount $mnt/external_sd > /dev/null && echo "unmounted external_sd" $busybox umount $mnt/data/data && echo "unmounted data/data" $busybox umount $mnt/data/dalvik-cache && echo "unmounted data/dalvik-cache" $busybox umount $mnt/linkerconfig && echo "unmounted linkerconfig" cd "$mnt/apex" for f in *; do - $busybox umount "$mnt/apex/$f" && echo "unmounted apex/$f" + /system/bin/toybox umount "$mnt/apex/$f" && echo "unmounted apex/$f" done cd - 2>&1 > /dev/null +exec 2>/dev/null export PATH=$PRESERVED_PATH +echo "[i] Hey, before you try to rm -rf the whole distro, remember to close the app you're running this command on completely, then you can do whatever you want." +exec 2>&1 diff --git a/system/bin/lhroot b/system/bin/lhroot index 6b2af43..dadc710 100644 --- a/system/bin/lhroot +++ b/system/bin/lhroot @@ -32,6 +32,10 @@ void="/data/void" tmp="/data/local/tmp" +# Set default options +custom_dir=false +custom_rootfs=false + # Load mod-util.sh . $MODDIR/mod-util.sh || exit $? @@ -58,6 +62,29 @@ set -x 2>$VERLOG # > You can add functions, variables & etc. # > Rather than editing the default vars above. +config () { + if [ ! -e $folder/etc ]; then + mkdir $folder/etc + fi + if [ ! -e $folder/sys/kernel ]; then + mkdir $folder/sys/kernel + fi + echo "[i] Setting up network..." + echo "nameserver 8.8.8.8" > $folder/etc/resolv.conf + echo "127.0.0.1 localhost" > $folder/etc/hosts +} + +folder_setup () { + if [ $custom_dir = "1" ]; then + echo "$div" + title_div "Select dir name" + echo "$div" + read -r dir?'-->' + echo "" + folder="/data/linux/${dir}" + fi +} + checkdir () { if [ -d "$1" ]; then first=1 @@ -67,6 +94,7 @@ checkdir () { alpine () { folder=$alpine + folder_setup tarball="$tmp/alpine.tar.gz" archurl= checkdir "$folder" @@ -92,6 +120,7 @@ alpine () { echo "Decompressing Rootfs..." tar xf ${tarball} 2> /dev/null||: cd $HOME + config fi echo "Removing rootfs tarball for some space" rm $tarball @@ -100,50 +129,44 @@ alpine () { debian () { folder=$debian + folder_setup checkdir "$folder" - tarball="$tmp/debian.tar.xz" archurl= if [ "$first" != 1 ]; then - if [ ! -f $tarball ]; then - echo "Downloading Rootfs, please wait..." - case $ARCH in - arm) - archurl="armhf" ;; - arm64) - archurl="arm64" ;; - x86) - archurl="i386" ;; - x64) - archurl="amd64" ;; - *) - abort "unknown arch" ;; - esac - wget "https://raw.githubusercontent.com/FerryAr/lhroot-repo/main/Rootfs/Debian/${archurl}/debian-rootfs-${archurl}.tar.xz" -qO $tarball & e_spinner - fi - mkdir -p "$folder" - cd "$folder" - echo "Decompressing Rootfs..." - tar xfJ ${tarball} 2> /dev/null||: + echo "Downloading Rootfs, please wait..." + case $ARCH in + arm) + archurl="armhf" ;; + arm64) + archurl="arm64" ;; + x86) + archurl="i386" ;; + x64) + archurl="amd64" ;; + *) + abort "unknown arch" ;; + esac + debootstrap --arch=$archurl --extractor=ar stable $folder & e_spinner && echo "Done." cd $HOME + config fi - echo "Removing rootfs tarball for some space" - rm $tarball echo "You can now launch Debian with the bootlinux script" } ubuntu () { folder=$ubuntu + folder_setup checkdir "$folder" - tarball="$tmp/ubuntu.tar.xz" + tarball="$tmp/ubuntu.tar.gz" archurl= - echo "$div" - echo "Type distro version or codename." - echo "$div" - echo "Latest as I'm writing this: 24.10/oracular" - echo "$div" - echo "" - read -r choice?'--> ' if [ "$first" != 1 ]; then + echo "$div" + echo "Type distro version or codename." + echo "$div" + echo "Latest as I'm writing this: 24.10/oracular" + echo "$div" + echo "" + read -r choice?'--> ' if [ ! -f $tarball ]; then echo "Downloading Rootfs, please wait..." case $ARCH in @@ -158,13 +181,14 @@ ubuntu () { *) abort "unknown arch" esac - wget "https://cdimage.ubuntu.com/ubuntu-base/releases/${choice/releases}/ubuntu-base-${choice}-base-${archurl}.tar.xz" -qO $tarball & e_spinner + wget "https://cdimage.ubuntu.com/ubuntu-base/releases/${choice}/release/ubuntu-base-${choice}-base-${archurl}.tar.gz" -qO $tarball & e_spinner fi mkdir -p "$folder" cd "$folder" echo "Decompressing Rootfs..." - tar xfJ ${tarball} 2> /dev/null||: + tar xfz ${tarball} 2> /dev/null||: cd $HOME + config fi echo "Removing rootfs tarball for some space" rm $tarball @@ -173,6 +197,7 @@ ubuntu () { void () { folder=$void + folder_setup checkdir "$folder" tarball="$tmp/void.tar.xz" archurl= @@ -198,6 +223,7 @@ void () { echo "Decompressing Rootfs..." tar xfJ ${tarball} 2> /dev/null||: cd $HOME + config fi echo "Removing rootfs tarball for some space" rm $tarball @@ -206,6 +232,7 @@ void () { arch_arm () { folder=$arch + folder_setup checkdir "$folder" tarball="$tmp/arch.tar.gz" if [ "$first" != 1 ]; then @@ -227,6 +254,7 @@ arch_arm () { echo "Decompressing Rootfs..." tar xf ${tarball} 2> /dev/null||: cd $HOME + config fi echo "Removing rootfs tarball for some space" rm $tarball @@ -235,6 +263,7 @@ arch_arm () { arch_64 () { folder=$arch + folder_setup checkdir "$folder" tarball="$tmp/arch.tar.gz" if [ "$first" != 1 ]; then @@ -254,6 +283,7 @@ arch_64 () { echo "Decompressing Rootfs..." tar xf ${tarball} 2> /dev/null||: cd $HOME + config fi echo "Removing rootfs tarball for some space" rm $tarball @@ -261,7 +291,8 @@ arch_64 () { } manjaro () { - folder="/data/manjaro" + folder=$manjaro + folder_setup checkdir "$folder" tarball="$tmp/manjaro.tar.xz" if [ "$first" != 1 ]; then @@ -280,6 +311,7 @@ manjaro () { echo "Decompressing Rootfs..." tar xf ${tarball} 2> /dev/null||: cd $HOME + config fi echo "Removing rootfs tarball for some space" rm $tarball @@ -287,7 +319,8 @@ manjaro () { } kali () { - folder="/data/kali" + folder=$kali + folder_setup checkdir "$folder" tarball="$tmp/kali.tar.xz" if [ "$first" != 1 ]; then @@ -313,6 +346,7 @@ kali () { echo "Decompressing Rootfs..." tar xfJ ${tarball} 2> /dev/null||: cd $HOME + config fi echo "Removing rootfs tarball for some space" rm $tarball @@ -320,7 +354,8 @@ kali () { } fedora () { - folder="/data/fedora" + folder=$fedora + folder_setup checkdir "$folder" tarball="$tmp/fedora.tar.xz" if [ "$first" != 1 ]; then @@ -343,6 +378,7 @@ fedora () { echo "Decompressing Rootfs..." tar xfJ ${tarball} 2> /dev/null||: cd $HOME + config fi echo "Removing rootfs tarball for some space..." rm $tarball @@ -411,7 +447,7 @@ remove_chroot () { installed=true lmount=$arch ;; - 3) + 3) installed=true lmount=$alpine ;; @@ -464,6 +500,57 @@ remove_chroot () { fi done } +options () { + while true; do + clear + echo "$div" + title_div "Select Option" + echo "$div" + echo "0. Back" + echo -n "${BL}1. Custom Directory for installation (Debian and Ubuntu Only):"; if $custom_dir; then echo -n "$G $custom_dir $N \n"; else echo -n "$R $custom_dir $N \n"; fi + echo -n "${BL}2. Custom Rootfs for installation:"; if $custom_rootfs; then echo -n "$G $custom_rootfs $N \n"; else echo -n "$R $custom_rootfs $N \n"; fi + read -r choice?'--> ' + echo " " + case $choice in + 1) if $custom_dir; then custom_dir=false; custom_rootfs=false; else warning "dir"; fi ;; + 2) if $custom_rootfs; then custom_rootfs=false; else warning "rootfs"; fi ;; + 0) break ;; + esac + done +} +warning () { + echo "$div" + title_div "${R}Warning!${N}" + echo "$div" + echo "Before proceeding remember this:" + if [ "$1" = "dir" ]; then + echo "If you install a chroot with custom partitions," + echo "it will install to /data/linux/(custom name without spaces)" + echo "and not to /data/. Wanna Continue? (Y-yes/N-no)" + read -r choice?'--> ' + echo "" + case $choice in + Y) custom_dir=true ;; + N) ;; + esac + elif [ "$1" = "rootfs" ]; then + echo "If you install a custom chroot, you must have the file (tar.xz only)" + echo "and it will be installed to /data/linux/(custom name without spaces)" + echo "and not on /data/. I'm not responsible for virus filled chroots" + echo "or other malicus software that might break your phone." + echo "Wanna continue? (Y-yes/N-no)" + read -r choice?'--> ' + echo "" + case $choice in + Y) custom_dir=true; custom_rootfs=true ;; + N) ;; + esac + else + clear + echo "[${R}E${N}] Could not detect correct warning." + sleep 5 + fi +} mod_head echo " " @@ -472,19 +559,27 @@ test_connection || abort "This module requires internet for running!" while true; do clear + echo "$R# # # ##### #### #### ##### $N" + echo "$G# # # # # # # # # # $N" + echo "$B# ###### # # # # # # # $N" + echo "$Y# # # ##### # # # # # $N" + echo "$C# # # # # # # # # # $N" + echo "$V###### # # # # #### #### # $N" echo "$div" - title_div "Chroot Installer - Mod by SCOS100" + title_div "lhroot - Mod by SCOS100" echo "$div" title_div "Choose Option" echo "$div" echo "1. Install Chroot" echo "2. Remove Chroot" + echo "3. Options" echo "q. quit" read -r choice?'--> ' echo " " case $choice in 1) install_chroot ;; 2) remove_chroot ;; + 3) options ;; q) exit 0 ;; esac done diff --git a/system/bin/pkgdetails b/system/bin/pkgdetails new file mode 100644 index 0000000..912cae7 Binary files /dev/null and b/system/bin/pkgdetails differ diff --git a/system/usr/share/debootstrap/functions b/system/usr/share/debootstrap/functions new file mode 100644 index 0000000..7546299 --- /dev/null +++ b/system/usr/share/debootstrap/functions @@ -0,0 +1,1709 @@ +############################################################### smallutils + +smallyes() { + YES="${1-y}" + while echo "$YES" 2>/dev/null ; do : ; done +} + +in_path () { + local OLD_IFS="$IFS" + local dir + IFS=":" + for dir in $PATH; do + if [ -x "$dir/$1" ]; then + IFS="$OLD_IFS" + return 0 + fi + done + IFS="$OLD_IFS" + return 1 +} + +############################################################### interaction + +error () { + # <error code> <name> <string> <args> + local err name fmt x + err="$1" + name="$2" + fmt="$3" + shift; shift; shift + if [ "$USE_DEBIANINSTALLER_INTERACTION" ]; then + (echo "E: $name" + for x in "$@"; do echo "EA: $x"; done + echo "EF: $fmt") >&4 + else + (printf "E: $fmt\n" "$@") >&4 + fi + exit "$err" +} + +warning () { + # <name> <string> <args> + local name fmt x + name="$1" + fmt="$2" + shift; shift + if [ "$USE_DEBIANINSTALLER_INTERACTION" ]; then + (echo "W: $name" + for x in "$@"; do echo "WA: $x"; done + echo "WF: $fmt") >&4 + else + printf "W: $fmt\n" "$@" >&4 + fi +} + +info () { + # <name> <string> <args> + local name fmt x + name="$1" + fmt="$2" + shift; shift + if [ "$USE_DEBIANINSTALLER_INTERACTION" ]; then + (echo "I: $name" + for x in "$@"; do echo "IA: $x"; done + echo "IF: $fmt") >&4 + else + printf "I: $fmt\n" "$@" >&4 + fi +} + +PROGRESS_NOW=0 +PROGRESS_END=0 +PROGRESS_NEXT="" +PROGRESS_WHAT="" + +progress_next () { + PROGRESS_NEXT="$1" +} + +wgetprogress () { + [ ! "$VERBOSE" ] && QSWITCH="-q" + local ret=0 + if [ "$USE_DEBIANINSTALLER_INTERACTION" ] && [ "$PROGRESS_NEXT" ]; then + # The exit status of a pipeline is that of the last command in + # the pipeline, so wget's exit status must be saved in the + # pipeline's first command. Since commands in a pipeline run in + # subshells, we have to print the exit status (on a file + # descriptor other than standard output, which is used by the + # pipeline itself) and then assign it to $ret outside of the + # pipeline. The "||" is necessary due to "set -e"; otherwise, a + # non-zero exit status would cause the echo command to be + # skipped. If wget succeeds, $ret will be "", so it then has to + # be set to a default value of 0. + ret=$({ { wget $@ 2>&1 >/dev/null || echo $? >&2; } | "$PKGDETAILS" "WGET%" "$PROGRESS_NOW" "$PROGRESS_NEXT" "$PROGRESS_END" >&3; } 2>&1) + : ${ret:=0} + else + wget ${QSWITCH:+"$QSWITCH"} "$@" + ret=$? + fi + return $ret +} + +progress () { + # <now> <end> <name> <string> <args> + local now end name fmt x + now="$1" + end="$2" + name="$3" + fmt="$4" + shift; shift; shift; shift + if [ "$USE_DEBIANINSTALLER_INTERACTION" ]; then + PROGRESS_NOW="$now" + PROGRESS_END="$end" + PROGRESS_NEXT="" + (echo "P: $now $end $name" + for x in "$@"; do echo "PA: $x"; done + echo "PF: $fmt") >&3 + fi +} + +dpkg_progress () { + # <now> <end> <name> <desc> UNPACKING|CONFIGURING + local now end name desc action expect + now="$1" + end="$2" + name="$3" + desc="$4" + action="$5" + expect="" + + if [ "$action" = UNPACKING ]; then + expect=half-installed + elif [ "$action" = CONFIGURING ]; then + expect=half-configured + fi + + dp () { + now=$(($now + ${1:-1})) + } + + exitcode=0 + while read status pkg qstate; do + if [ "$status" = "EXITCODE" ]; then + exitcode="$pkg" + continue + fi + [ "$qstate" = "$expect" ] || continue + case $qstate in + half-installed) + dp; progress "$now" "$end" "$name" "$desc" + info "$action" "Unpacking %s..." "${pkg%:}" + expect="unpacked" + ;; + unpacked) + expect="half-installed" + ;; + half-configured) + dp; progress "$now" "$end" "$name" "$desc" + info "$action" "Configuring %s..." "${pkg%:}" + expect="installed" + ;; + installed) + expect="half-configured" + ;; + esac + done + return "$exitcode" +} + +############################################################# set variables + +default_mirror () { + DEF_MIRROR="$1" +} + +FINDDEBS_NEEDS_INDICES="false" +finddebs_style () { + case "$1" in + hardcoded) + ;; + from-indices) + FINDDEBS_NEEDS_INDICES="true" + ;; + *) + error 1 BADFINDDEBS "unknown finddebs style" + ;; + esac +} + +mk_download_dirs () { + if [ "$DLDEST" = "apt_dest" ]; then + mkdir -p "$TARGET/$APTSTATE/lists/partial" + mkdir -p "$TARGET/var/cache/apt/archives/partial" + fi +} + +download_style () { + case "$1" in + apt) + if [ "$2" = "var-state" ]; then + APTSTATE="var/state/apt" + else + APTSTATE="var/lib/apt" + fi + DLDEST="apt_dest" + export APTSTATE DLDEST DEBFOR + ;; + *) + error 1 BADDLOAD "unknown download style" + ;; + esac +} + +keyring () { + # avoid unnecessary warning with --second-stage + if [ -z "$KEYRING" ] && [ "$SECOND_STAGE_ONLY" != true ]; then + if [ -e "$1" ]; then + KEYRING="$1" + elif [ -z "$DISABLE_KEYRING" ]; then + if [ -n "$DEF_HTTPS_MIRROR" ] && [ -z "$USER_MIRROR" ] && [ -z "$FORCE_KEYRING" ]; then + info KEYRING "Keyring file not available at %s; switching to https mirror %s" "$1" "$DEF_HTTPS_MIRROR" + USER_MIRROR="$DEF_HTTPS_MIRROR" + else + warning KEYRING "Cannot check Release signature; keyring file not available %s" "$1" + if [ -n "$FORCE_KEYRING" ]; then + error 1 KEYRING "Keyring-based check was requested; aborting accordingly" + fi + fi + fi + fi +} + +########################################################## variant handling + +doing_variant () { + if [ "$1" = "$VARIANT" ]; then return 0; fi + if [ "$1" = "-" ] && [ "$VARIANT" = "" ]; then return 0; fi + return 1 +} + +SUPPORTED_VARIANTS="-" +variants () { + local v + SUPPORTED_VARIANTS="$*" + for v in $*; do + if doing_variant "$v"; then return 0; fi + done + error 1 UNSUPPVARIANT "unsupported variant" +} + +########################################################### option handling +check_conflicting_option () { + if ( [ "$set_what_to_do" = --foreign ] && [ "${1%%=*}" = --unpack-tarball ] ) || \ + ( [ "${set_what_to_do%%=*}" = "--unpack-tarball" ] && [ "$1" = --foreign ] ); then + LOOSEN_CONFLICTING_RESTRICTION="true" + elif [ -n "$set_what_to_do" ]; then + error 1 ARG_CONFLICTING "$set_what_to_do is specified with $1, please use only one of those options." + fi + set_what_to_do="$1" +} + +################################################# work out names for things + +mirror_style () { + case "$1" in + release) + DOWNLOAD_INDICES="download_release_indices" + DOWNLOAD_DEBS="download_release" + ;; + main) + DOWNLOAD_INDICES="download_main_indices" + DOWNLOAD_DEBS="download_main" + ;; + *) + error 1 BADMIRROR "unknown mirror style" + ;; + esac + export DOWNLOAD_INDICES + export DOWNLOAD_DEBS +} + +force_md5 () { + DEBOOTSTRAP_CHECKSUM_FIELD=MD5SUM + export DEBOOTSTRAP_CHECKSUM_FIELD +} + +verify_checksum () { + # args: dest checksum size + local expchecksum="$2" + local expsize="$3" + if [ "$DEBOOTSTRAP_CHECKSUM_FIELD" = "MD5SUM" ]; then + if in_path md5sum; then + relchecksum=$(md5sum < "$1" | sed 's/ .*$//') + elif in_path md5; then + relchecksum=$(md5 < "$1") + else + error 1 SIGCHECK "Cannot check md5sum" + fi + else + if in_path "sha${SHA_SIZE}sum"; then + relchecksum="$(sha${SHA_SIZE}sum < "$1" | sed 's/ .*$//')" + elif in_path "sha${SHA_SIZE}"; then + relchecksum="$(sha${SHA_SIZE} < "$1")" + else + error 1 SIGCHECK "Cannot check sha${SHA_SIZE}sum" + fi + fi + relsize="$(wc -c < "$1")" + if [ "$expsize" -ne "$relsize" ] || [ "$expchecksum" != "$relchecksum" ]; then + return 1 + fi + return 0 +} + +get () { + # args: from dest 'nocache' + # args: from dest [checksum size] [alt {checksum size type}] + # args: from dest 'byhash' [checksum size] [alt {checksum size type}] + local displayname + local versionname + local from_base + local dest_base + local nocache="" + local byhash="" + local a + from_base="$1"; shift + dest_base="$1"; shift + if [ "$1" = "nocache" ]; then + nocache="true"; shift + elif [ "$1" = "byhash" ]; then + byhash="true"; shift + fi + if [ "${dest_base%.deb}" != "$dest_base" ]; then + displayname="$(echo "$dest_base" | sed 's,^.*/,,;s,_.*$,,')" + versionname="$(echo "$dest_base" | sed 's,^.*/,,' | cut -d_ -f2 | sed 's/%3a/:/')" + else + displayname="$(echo "$from_base" | sed 's,^.*/,,')" + fi + + if [ -e "$dest_base" ]; then + if [ -z "$1" ]; then + return 0 + elif [ -n "$nocache" ]; then + rm -f "$dest_base" + else + info VALIDATING "Validating %s %s" "$displayname" "$versionname" + if verify_checksum "$dest_base" "$1" "$2"; then + return 0 + else + rm -f "$dest_base" + fi + fi + fi + + if [ "$#" -gt 3 ]; then + local st=1 + if [ "$3" = "-" ]; then st=4; fi + local order="$(a=$st; while [ "$a" -le $# ]; do eval echo \"\${$(($a+1))}\" $a; + a=$(($a + 3)); done | sort -n | sed 's/.* //')" + else + local order=1 + fi + for a in $order; do + local checksum siz typ from dest iters + checksum="$(eval echo \${$a})" + siz="$(eval echo \${$(( $a+1 ))})" + typ="$(eval echo \${$(( $a+2 ))})" + iters="0" + + case "$typ" in + xz) from="$from_base.xz"; dest="$dest_base.xz" ;; + bz2) from="$from_base.bz2"; dest="$dest_base.bz2" ;; + gz) from="$from_base.gz"; dest="$dest_base.gz" ;; + *) from="$from_base"; dest="$dest_base" ;; + esac + + if [ ! -z "$CACHE_DIR" ]; then + dest="${dest%%*/}" + elif [ "${dest#/}" = "$dest" ]; then + dest="./$dest" + fi + local dest2="$dest" + if [ -d "${dest2%/*}/partial" ]; then + dest2="${dest2%/*}/partial/${dest2##*/}" + fi + + while [ "$iters" -lt 10 ]; do + local from2="" + info RETRIEVING "Retrieving %s %s" "$displayname" "$versionname" + if [ "$checksum" != "" ] && [ "$byhash" != "" ]; then + # assume we don't mix acquire-by-hash and md5 + from2="$(dirname "$from")/by-hash/SHA${SHA_SIZE}/$checksum" + fi + if [ ! -e "$dest2" ]; then + if [ -z "$from2" ] || ! just_get "$from2" "$dest2"; then + if ! just_get "$from" "$dest2"; then continue 1; fi + fi + fi + if [ "$checksum" != "" ]; then + info VALIDATING "Validating %s %s" "$displayname" "$versionname" + if verify_checksum "$dest2" "$checksum" "$siz"; then + checksum="" + fi + fi + if [ -z "$checksum" ]; then + [ "$dest2" = "$dest" ] || mv "$dest2" "$dest" + case "$typ" in + gz) gunzip "$dest" ;; + bz2) bunzip2 "$dest" ;; + xz) unxz "$dest" ;; + esac + return 0 + else + rm -f "$dest2" + warning RETRYING "Retrying failed download of %s" "$from" + iters=$(($iters + 1)) + fi + done + warning CORRUPTFILE "%s was corrupt" "$from" + done + return 1 +} + +just_get () { + # args: from dest + local from="$1" + local dest="$2" + mkdir -p "${dest%/*}" + if [ "${from#null:}" != "$from" ]; then + error 1 NOTPREDL "%s was not pre-downloaded" "${from#null:}" + elif [ "${from#http://}" != "$from" ] || [ "${from#https://}" != "$from" ] || [ "${from#ftp://}" != "$from" ]; then + # http/https/ftp mirror + if wgetprogress ${CHECKCERTIF:+"$CHECKCERTIF"} ${CERTIFICATE:+"$CERTIFICATE"} ${PRIVATEKEY:+"$PRIVATEKEY"} -O "$dest" "$from"; then + return 0 + else + rm -f "$dest" + return 1 + fi + elif [ "${from#file:}" != "$from" ]; then + local base="${from#file:}" + if [ "${base#//}" != "$base" ]; then + base="/${from#file://*/}" + fi + if [ -e "$base" ]; then + cp "$base" "$dest" + return 0 + else + return 1 + fi + elif [ "${from#ssh:}" != "$from" ]; then + local ssh_dest="$(echo "$from" | sed -e 's#ssh://##' -e 's#/#:/#')" + if [ -n "$ssh_dest" ]; then + scp "$ssh_dest" "$dest" + return 0 + else + return 1 + fi + else + error 1 UNKNOWNLOC "unknown location %s" "$from" + fi +} + +download () { + mk_download_dirs + "$DOWNLOAD_DEBS" "$(echo "$@" | tr ' ' '\n' | sort)" +} + +download_indices () { + mk_download_dirs + "$DOWNLOAD_INDICES" "$(echo "$@" | tr ' ' '\n' | sort)" +} + +debfor () { + (while read pkg path; do + for p in "$@"; do + [ "$p" = "$pkg" ] || continue; + echo "$path" + done + done <"$TARGET/debootstrap/debpaths" + ) +} + +apt_dest () { + # args: + # deb package version arch mirror path + # pkg suite component arch mirror path + # rel suite mirror path + case "$1" in + deb) + echo "/var/cache/apt/archives/${2}_${3}_${4}.deb" | sed 's/:/%3a/' + ;; + pkg) + local m="$5" + printf "%s" "$APTSTATE/lists/" + echo "${m}_$6" | sed -e 's,^[^:]*://,,' -e 's/\//_/g' + ;; + rel) + local m="$3" + printf "%s" "$APTSTATE/lists/" + echo "${m}_$4" | sed -e 's,^[^:]*://,,' -e 's/\//_/g' + ;; + esac +} + +################################################################## download + +get_release_checksum () { + local reldest path + reldest="$1" + path="$2" + if [ "$DEBOOTSTRAP_CHECKSUM_FIELD" = MD5SUM ]; then + local match="^[Mm][Dd]5[Ss][Uu][Mm]" + else + local match="^[Ss][Hh][Aa]$SHA_SIZE:" + fi + sed -n "/$match/,/^[^ ]/p" < "$reldest" | \ + while read a b c; do + if [ "$c" = "$path" ]; then echo "$a $b"; fi + done | head -n 1 +} + +extract_release_components () { + local c + local reldest="$1"; shift + TMPCOMPONENTS="$(sed -n 's/Components: *//p' "$reldest")" + for c in $TMPCOMPONENTS ; do + case " $COMPONENTS " in + *" $c "*) continue ;; + esac; + + eval " + case \"\$c\" in + $USE_COMPONENTS) + COMPONENTS=\"\$COMPONENTS \$c\" + ;; + esac + " + done + + if [ -z "$COMPONENTS" ]; then + mv "$reldest" "$reldest.malformed" + error 1 INVALIDREL "Invalid Release file, no valid components" + fi +} + +CODENAME="" +validate_suite () { + local reldest suite s + reldest="$1" + + CODENAME=$(sed -n "s/^Codename: *//p" "$reldest") + suite=$(sed -n "s/^Suite: *//p" "$reldest") + + for s in $SUITE $EXTRA_SUITES; do + if [ "$s" = "$suite" ] || [ "$s" = "$CODENAME" ]; then + return 0 + fi + done + if [ "$EXTRA_SUITES" = "" ]; then + error 1 WRONGSUITE "Asked to install suite %s, but got %s (codename: %s) from mirror" "$SUITE" "$suite" "$CODENAME" + else + error 1 WRONGSUITE "Asked to install suites %s %s, but got %s (codename: %s) from mirror" "$SUITE" "$EXTRA_SUITES" "$suite" "$CODENAME" + fi +} + +split_inline_sig () { + local inreldest reldest relsigdest + inreldest="$1" + reldest="$2" + relsigdest="$3" + + # Note: InRelease files are fun since one needs to remove the + # last newline from the PGP SIGNED MESSAGE part, while keeping + # the PGP SIGNATURE part intact. This shell implementation + # should work on most if not all systems, instead of trying to + # sed/tr/head, etc. + rm -f "$reldest" "$relsigdest" + nl="" + state="pre-begin" + while IFS= read -r line; do + case "${state}" in + pre-begin) + if [ "x${line}" = "x-----BEGIN PGP SIGNED MESSAGE-----" ]; then + state="begin" + fi + ;; + begin) + if [ "x${line}" = "x" ]; then + state="data" + fi + ;; + data) + if [ "x${line}" = "x-----BEGIN PGP SIGNATURE-----" ]; then + printf "%s\n" "${line}" > "$relsigdest" + state="signature" + else + printf "${nl}%s" "${line}" >> "$reldest" + nl="\n" + fi + ;; + signature) + printf "%s\n" "${line}" >> "$relsigdest" + if [ "x${line}" = "x-----END PGP SIGNATURE-----" ]; then + break + fi + esac + done < "$inreldest" +} + +download_release_sig () { + local m1 suite inreldest reldest relsigdest + m1="$1" + suite="$2" + inreldest="$3" + reldest="$4" + relsigdest="$5" + + progress 0 100 DOWNREL "Downloading Release file" + progress_next 100 + if [ -n "$INRELEASE_PATH" ]; then + get "$m1/dists/$suite/$INRELEASE_PATH" "$inreldest" nocache || + error 1 NOGETREL "Failed getting release file %s" \ + "$m1/dists/$suite/$INRELEASE_PATH" + split_inline_sig "$inreldest" "$reldest" "$relsigdest" + progress 100 100 DOWNREL "Downloading Release file" + elif get "$m1/dists/$suite/InRelease" "$inreldest" nocache; then + split_inline_sig "$inreldest" "$reldest" "$relsigdest" + progress 100 100 DOWNREL "Downloading Release file" + else + get "$m1/dists/$suite/Release" "$reldest" nocache || + error 1 NOGETREL "Failed getting release file %s" "$m1/dists/$suite/Release" + progress 100 100 DOWNREL "Downloading Release file" + fi + if [ -n "$KEYRING" ] && [ -z "$DISABLE_KEYRING" ]; then + progress 0 100 DOWNRELSIG "Downloading Release file signature" + if ! [ -f "$relsigdest" ]; then + progress_next 50 + get "$m1/dists/$suite/Release.gpg" "$relsigdest" nocache || + error 1 NOGETRELSIG "Failed getting release signature file %s" \ + "$m1/dists/$suite/Release.gpg" + progress 50 100 DOWNRELSIG "Downloading Release file signature" + fi + + info RELEASESIG "Checking Release signature" + # Don't worry about the exit status from gpgv; parsing the output will + # take care of that. + (gpgv --status-fd 1 --keyring "$KEYRING" --ignore-time-conflict \ + "$relsigdest" "$reldest" || true) | read_gpg_status + progress 100 100 DOWNRELSIG "Downloading Release file signature" + fi +} + +download_release_indices () { + local m1 inreldest reldest relsigdest totalpkgs \ + subpath xzi bz2i gzi normi i ext \ + donepkgs pkgdest acquirebyhash s c m + m1="${MIRRORS%% *}" + for s in $SUITE $EXTRA_SUITES; do + inreldest="$TARGET/$($DLDEST rel "$s" "$m1" "dists/$s/InRelease")" + reldest="$TARGET/$($DLDEST rel "$s" "$m1" "dists/$s/Release")" + relsigdest="$TARGET/$($DLDEST rel "$s" "$m1" "dists/$s/Release.gpg")" + + download_release_sig "$m1" "$s" "$inreldest" "$reldest" "$relsigdest" + + validate_suite "$reldest" + + extract_release_components "$reldest" + + acquirebyhash=$(grep "^Acquire-By-Hash: yes$" "$reldest" || true) + totalpkgs=0 + for c in $COMPONENTS; do + subpath="$c/binary-$ARCH/Packages" + xzi="$(get_release_checksum "$reldest" "$subpath.xz")" + bz2i="$(get_release_checksum "$reldest" "$subpath.bz2")" + gzi="$(get_release_checksum "$reldest" "$subpath.gz")" + normi="$(get_release_checksum "$reldest" "$subpath")" + if [ "$normi" != "" ]; then + i="$normi" + elif in_path bunzip2 && [ "$bz2i" != "" ]; then + i="$bz2i" + elif in_path unxz && [ "$xzi" != "" ]; then + i="$xzi" + elif in_path gunzip && [ "$gzi" != "" ]; then + i="$gzi" + fi + if [ "$i" != "" ]; then + totalpkgs=$(( $totalpkgs + ${i#* } )) + else + mv "$reldest" "$reldest.malformed" + error 1 MISSINGRELENTRY "Invalid Release file, no entry for %s" "$subpath" + fi + done + + donepkgs=0 + progress 0 $totalpkgs DOWNPKGS "Downloading Packages files" + for c in $COMPONENTS; do + subpath="$c/binary-$ARCH/Packages" + path="dists/$s/$subpath" + xzi="$(get_release_checksum "$reldest" "$subpath.xz")" + bz2i="$(get_release_checksum "$reldest" "$subpath.bz2")" + gzi="$(get_release_checksum "$reldest" "$subpath.gz")" + normi="$(get_release_checksum "$reldest" "$subpath")" + ext="" + if [ "$acquirebyhash" != "" ]; then + ext="$ext byhash" + fi + if [ "$normi" != "" ]; then + ext="$ext $normi ." + i="$normi" + fi + if in_path unxz && [ "$xzi" != "" ]; then + ext="$ext $xzi xz" + i="${i:-$xzi}" + fi + if in_path bunzip2 && [ "$bz2i" != "" ]; then + ext="$ext $bz2i bz2" + i="${i:-$bz2i}" + fi + if in_path gunzip && [ "$gzi" != "" ]; then + ext="$ext $gzi gz" + i="${i:-$gzi}" + fi + progress_next $(($donepkgs + ${i#* })) + for m in $MIRRORS; do + pkgdest="$TARGET/$($DLDEST pkg "$s" "$c" "$ARCH" "$m" "$path")" + if get "$m/$path" "$pkgdest" $ext; then break; fi + done + if [ ! -f "$pkgdest" ]; then + error 1 COULDNTDL "Couldn't download %s" "$m/$path" + fi + donepkgs=$(($donepkgs + ${i#* })) + progress $donepkgs $totalpkgs DOWNPKGS "Downloading Packages files" + done + done +} + +get_package_sizes () { + # mirror pkgdest debs.. + local m pkgdest + m="$1"; shift + pkgdest="$1"; shift + $PKGDETAILS PKGS "$m" "$pkgdest" "$@" | ( + newleft="" + totaldebs=0 + countdebs=0 + while read p details; do + if [ "$details" = "-" ]; then + newleft="$newleft $p" + else + size="${details##* }"; + totaldebs=$(($totaldebs + $size)) + countdebs=$(($countdebs + 1)) + fi + done + echo "$countdebs $totaldebs$newleft" + ) +} + +# note, leftovers come back on fd5 !! +download_debs () { + local m pkgdest debdest debcache + m="$1" + pkgdest="$2" + shift; shift + + "$PKGDETAILS" PKGS "$m" "$pkgdest" "$@" | ( + leftover="" + while read p ver arc mdup fil checksum size; do + if [ "$ver" = "-" ]; then + leftover="$leftover $p" + else + progress_next $(($dloaddebs + $size)) + debdest="$($DLDEST deb "$p" "$ver" "$arc" "$m" "$fil")" + debcache="$(echo "$p"_"$ver"_"$arc".deb | sed 's/:/%3a/')" + if [ -z "$CACHE_DIR" ] && get "$m/$fil" "$TARGET/$debdest" "$checksum" "$size"; then + dloaddebs=$(($dloaddebs + $size)) + echo >>"$TARGET/debootstrap/deburis" "$p $ver $m/$fil" + echo >>"$TARGET/debootstrap/debpaths" "$p $debdest" + elif [ -d "$CACHE_DIR" ] && get "$m/$fil" "$CACHE_DIR/$debcache" "$checksum" "$size"; then + dloaddebs=$(($dloaddebs + $size)) + echo >>"$TARGET/debootstrap/deburis" "$p $ver $m/$fil" + echo >>"$TARGET/debootstrap/debpaths" "$p $debdest" + cp "$CACHE_DIR/$debcache" "$TARGET/$debdest" + else + warning COULDNTDL "Couldn't download package %s (ver %s arch %s) at %s" "$p" "$ver" "$arc" "$m/$fil" + leftover="$leftover $p" + fi + fi + done + echo >&5 ${leftover# } + ) +} + +download_release () { + local m1 numdebs countdebs totaldebs leftoverdebs path pkgdest \ + dloaddebs s c m + m1="${MIRRORS%% *}" + + numdebs="$#" + + countdebs=0 + progress "$countdebs" "$numdebs" SIZEDEBS "Finding package sizes" + + totaldebs=0 + leftoverdebs="$*" + + # Fix possible duplicate package names, which would screw up counts: + leftoverdebs=$(printf "$leftoverdebs"|tr ' ' '\n'|sort -u|tr '\n' ' ') + numdebs=$(printf "$leftoverdebs"|wc -w) + + for s in $SUITE $EXTRA_SUITES; do + for c in $COMPONENTS; do + if [ "$countdebs" -ge "$numdebs" ]; then break; fi + + path="dists/$s/$c/binary-$ARCH/Packages" + pkgdest="$TARGET/$($DLDEST pkg "$s" "$c" "$ARCH" "$m1" "$path")" + if [ ! -e "$pkgdest" ]; then continue; fi + + info CHECKINGSIZES "Checking component %s on %s..." "$c" "$m1" + + leftoverdebs="$(get_package_sizes "$m1" "$pkgdest" $leftoverdebs)" + + countdebs=$(($countdebs + ${leftoverdebs%% *})) + leftoverdebs=${leftoverdebs#* } + + totaldebs=${leftoverdebs%% *} + leftoverdebs=${leftoverdebs#* } + + progress "$countdebs" "$numdebs" SIZEDEBS "Finding package sizes" + done + done + + if [ "$countdebs" -ne "$numdebs" ]; then + error 1 LEFTOVERDEBS "Couldn't find these debs: %s" "$leftoverdebs" + fi + + dloaddebs=0 + + progress "$dloaddebs" "$totaldebs" DOWNDEBS "Downloading packages" + :>"$TARGET/debootstrap/debpaths" + + pkgs_to_get="$*" + for s in $SUITE $EXTRA_SUITES; do + for c in $COMPONENTS; do + path="dists/$s/$c/binary-$ARCH/Packages" + for m in $MIRRORS; do + pkgdest="$TARGET/$($DLDEST pkg "$s" "$c" "$ARCH" "$m" "$path")" + if [ ! -e "$pkgdest" ]; then continue; fi + pkgs_to_get="$(download_debs "$m" "$pkgdest" $pkgs_to_get 5>&1 1>&6)" + if [ -z "$pkgs_to_get" ]; then break; fi + done 6>&1 + if [ -z "$pkgs_to_get" ]; then break; fi + done + if [ -z "$pkgs_to_get" ]; then break; fi + done + progress "$dloaddebs" "$totaldebs" DOWNDEBS "Downloading packages" + if [ "$pkgs_to_get" != "" ]; then + error 1 COULDNTDLPKGS "Couldn't download packages: %s" "$pkgs_to_get" + fi +} + +download_main_indices () { + local m1 comp path pkgdest m s c + m1="${MIRRORS%% *}" + comp="${USE_COMPONENTS}" + progress 0 100 DOWNMAINPKGS "Downloading Packages file" + progress_next 100 + + if [ -z "$comp" ]; then comp=main; fi + COMPONENTS="$(echo $comp | tr '|' ' ')" + + export COMPONENTS + for m in $MIRRORS; do + for s in $SUITE $EXTRA_SUITES; do + for c in $COMPONENTS; do + path="dists/$s/$c/binary-$ARCH/Packages" + pkgdest="$TARGET/$($DLDEST pkg "$s" "$c" "$ARCH" "$m" "$path")" + if in_path gunzip && get "$m/${path}.gz" "${pkgdest}.gz"; then + rm -f "$pkgdest" + gunzip "$pkgdest.gz" + elif get "$m/$path" "$pkgdest"; then + true + fi + done + done + done + progress 100 100 DOWNMAINPKGS "Downloading Packages file" +} + +download_main () { + local m1 path pkgdest debdest p s c m + m1="${MIRRORS%% *}" + + :>"$TARGET/debootstrap/debpaths" + for p in "$@"; do + for s in $SUITE $EXTRA_SUITES; do + for c in $COMPONENTS; do + local details="" + for m in $MIRRORS; do + path="dists/$s/$c/binary-$ARCH/Packages" + pkgdest="$TARGET/$($DLDEST pkg "$s" "$c" "$ARCH" "$m" "$path")" + if [ ! -e "$pkgdest" ]; then continue; fi + details="$($PKGDETAILS PKGS "$m" "$pkgdest" "$p")" + if [ "$details" = "$p -" ]; then + details="" + continue + fi + size="${details##* }"; details="${details% *}" + checksum="${details##* }"; details="${details% *}" + debdest="$($DLDEST deb $details)" + if get "$m/${details##* }" "$TARGET/$debdest" "$checksum" "$size"; then + echo >>"$TARGET/debootstrap/debpaths" "$p $debdest" + details="done" + break + else + details="" + fi + done + if [ "$details" != "" ]; then + break + fi + done + if [ "$details" != "" ]; then + break + fi + done + if [ "$details" != "done" ]; then + error 1 COULDNTDL "Couldn't download %s" "$p" + fi + done +} + +###################################################### deb choosing support + +get_debs () { + local field m1 s c path pkgdest + field="$1" + shift + for m1 in $MIRRORS; do + for s in $SUITE $EXTRA_SUITES; do + for c in $COMPONENTS; do + path="dists/$s/$c/binary-$ARCH/Packages" + pkgdest="$TARGET/$($DLDEST pkg "$s" "$c" "$ARCH" "$m1" "$path")" + echo "$("$PKGDETAILS" FIELD "$field" "$m1" "$pkgdest" "$@" | sed 's/ .*//')" + done + done + done +} + +################################################################ extraction + +EXTRACTORS_SUPPORTED="dpkg-deb ar" +EXTRACT_DEB_TAR_OPTIONS= + +# Native dpkg-deb based extractors +extract_dpkg_deb_field () { + local pkg field + pkg="$1" + field="$2" + + dpkg-deb -f "$pkg" "$field" +} + +extract_dpkg_deb_data () { + local pkg="$1" + + dpkg-deb --fsys-tarfile "$pkg" | tar $EXTRACT_DEB_TAR_OPTIONS -xf - || error 1 FILEEXIST "Tried to extract package, but file already exists. Exit..." +} + +# Raw .deb extractors +extract_ar_deb_field () { + local pkg field tarball + pkg="$1" + field="$2" + tarball=$(ar -t "$pkg" | grep "^control\.tar") + + case "$tarball" in + control.tar.gz) cat_cmd=zcat ;; + control.tar.xz) cat_cmd=xzcat ;; + control.tar.zst) cat_cmd=zstdcat ;; + control.tar) cat_cmd=cat ;; + *) error 1 UNKNOWNCONTROLCOMP "Unknown compression type for %s in %s" "$tarball" "$pkg" ;; + esac + + if in_path $cat_cmd; then + ar -p "$pkg" "$tarball" | $cat_cmd | + tar -O -xf - control ./control 2>/dev/null | + grep -i "^$field:" | sed -e 's/[^:]*: *//' | head -n 1 + else + error 1 UNPACKCMDUNVL "Extracting %s requires the %s command, which is not available" "$pkg" "$cat_cmd" + fi +} + +extract_ar_deb_data () { + local pkg tarball + pkg="$1" + tarball="$(ar -t "$pkg" | grep "^data.tar")" + + case "$tarball" in + data.tar.gz) cat_cmd=zcat ;; + data.tar.bz2) cat_cmd=bzcat ;; + data.tar.xz) cat_cmd=xzcat ;; + data.tar.zst) cat_cmd=zstdcat ;; + data.tar) cat_cmd=cat ;; + *) error 1 UNKNOWNDATACOMP "Unknown compression type for %s in %s" "$tarball" "$pkg" ;; + esac + + if in_path "$cat_cmd"; then + ar -p "$pkg" "$tarball" | "$cat_cmd" | tar $EXTRACT_DEB_TAR_OPTIONS -xf - + else + error 1 UNPACKCMDUNVL "Extracting %s requires the %s command, which is not available" "$pkg" "$cat_cmd" + fi +} + +valid_extractor () { + local extractor="$1" + local E + + for E in $EXTRACTORS_SUPPORTED; do + if [ "$extractor" = "$E" ]; then + return 0 + fi + done + + return 1 +} + +choose_extractor () { + local extractor + + if [ -n "$EXTRACTOR_OVERRIDE" ]; then + extractor="$EXTRACTOR_OVERRIDE" + elif in_path dpkg-deb; then + extractor="dpkg-deb" + else + extractor="ar" + fi + + info CHOSENEXTRACTOR "Chosen extractor for .deb packages: %s" "$extractor" + case "$extractor" in + dpkg-deb) + extract_deb_field () { extract_dpkg_deb_field "$@"; } + extract_deb_data () { extract_dpkg_deb_data "$@"; } + ;; + ar) + extract_deb_field () { extract_ar_deb_field "$@"; } + extract_deb_data () { extract_ar_deb_data "$@"; } + ;; + esac +} + +extract () { ( + cd "$TARGET" || exit 1 + local p cat_cmd pkg + p=0 + for pkg in $(debfor "$@"); do + p=$(($p + 1)) + progress "$p" "$#" EXTRACTPKGS "Extracting packages" + packagename="$(echo "$pkg" | sed 's,^.*/,,;s,_.*$,,')" + info EXTRACTING "Extracting %s..." "$packagename" + extract_deb_data "./$pkg" + done +); } + +in_target_nofail () { + if ! PATH=/sbin:/usr/sbin:/bin:/usr/bin eval "$CHROOT_CMD \"\$@\"" 2>/dev/null; then + true + fi + return 0 +} + +in_target_failmsg () { + local code msg arg + code="$1" + msg="$2" + arg="$3" + shift; shift; shift + if ! PATH=/sbin:/usr/sbin:/bin:/usr/bin eval "$CHROOT_CMD \"\$@\""; then + warning "$code" "$msg" "$arg" + # Try to point user at actual failing package. + msg="See %s for details" + if [ -e "$TARGET/debootstrap/debootstrap.log" ]; then + arg="$TARGET/debootstrap/debootstrap.log" + local pkg="$(grep '^dpkg: error processing ' "$TARGET/debootstrap/debootstrap.log" | head -n 1 | sed 's/\(error processing \)\(package \|archive \)/\1/' | cut -d ' ' -f 4)" + if [ -n "$pkg" ]; then + msg="$msg (possibly the package $pkg is at fault)" + fi + else + arg="the log" + fi + warning "$code" "$msg" "$arg" + return 1 + fi + return 0 +} + +in_target () { + in_target_failmsg IN_TARGET_FAIL "Failure trying to run: %s" "$CHROOT_CMD $*" "$@" +} + +###################################################### standard setup stuff + +conditional_cp () { + if [ ! -e "$2/$1" ]; then + if [ -L "$1" ] && [ -e "$1" ]; then + cat "$1" >"$2/$1" + elif [ -e "$1" ]; then + cp "$1" "$2/$1" + fi + fi +} + + +setup_apt_sources () { + local m s c + mkdir -p "$TARGET/etc/apt" + for m in "$@"; do + for s in $SUITE $EXTRA_SUITES; do + local cs c path pkgdest + cs="" + for c in ${COMPONENTS:-$USE_COMPONENTS}; do + path="dists/$s/$c/binary-$ARCH/Packages" + pkgdest="$TARGET/$($DLDEST pkg "$s" "$c" "$ARCH" "$m" "$path")" + if [ -e "$pkgdest" ]; then cs="$cs $c"; fi + done + if [ "$cs" != "" ]; then echo "deb $m $s$cs"; fi + done + done > "$TARGET/etc/apt/sources.list" +} + +setup_etc () { + mkdir -p "$TARGET/etc" + + conditional_cp /etc/resolv.conf "$TARGET" + conditional_cp /etc/hostname "$TARGET" +} + +setup_proc () { + return 0; +} + + # create the static device nodes + setup_devices () { + return 0 +} + +setup_proc_symlink () { + return 0; +} + +# enable the dynamic device nodes +setup_dynamic_devices () { + return 0 +} + +setup_dselect_method () { + case "$1" in + apt) + mkdir -p "$TARGET/var/lib/dpkg" + echo "apt apt" > "$TARGET/var/lib/dpkg/cmethopt" + chmod 644 "$TARGET/var/lib/dpkg/cmethopt" + ;; + *) + error 1 UNKNOWNDSELECT "unknown dselect method" + ;; + esac +} + +# Find out where the runtime dynamic linker and the shared libraries +# can be installed on each architecture: native, multilib and multiarch. +# This data can be verified by checking the files in the debian/sysdeps/ +# directory of the glibc package. +# +# This function must be updated to support any new architecture which +# either installs the RTLD in a directory different from /lib or builds +# multilib library packages. +setup_merged_usr() { + if doing_variant buildd && [ -z "$MERGED_USR" ]; then + MERGED_USR="no" + fi + + if [ "$MERGED_USR" = "no" ]; then + # With the usrmerge becoming pseudo-essential we need to use this flag + # to ensure that even if it gets installed the buildd is not converted + # when debootstrap needs to create an unmerged-usr installation. + case "$CODENAME" in + etch*|lenny|squeeze|wheezy|jessie*|stretch|buster|bullseye) + ;; + *) + mkdir -p "$TARGET/etc" + echo "this system will not be supported in the future" > "$TARGET/etc/unsupported-skip-usrmerge-conversion" + if ! doing_variant buildd; then + warning SANITYCHECK "Upgrading non-merged-/usr environments post-bookworm is unsupported. Only do this for CI/QA infrastructure that will be re-bootstrapped rather than upgraded." + fi + ;; + esac + return 0; + fi + + local link_dir="" + case $ARCH in + amd64) link_dir="lib32 lib64 libx32" ;; + i386) link_dir="lib64 libx32" ;; + mips|mipsel) + link_dir="lib32 lib64" ;; + mips64*|mipsn32*) + link_dir="lib32 lib64 libo32" ;; + loongarch64*) + link_dir="lib32 lib64" ;; + powerpc) link_dir="lib64" ;; + ppc64) link_dir="lib32 lib64" ;; + ppc64el) link_dir="lib64" ;; + s390x) link_dir="lib32" ;; + sparc) link_dir="lib64" ;; + sparc64) link_dir="lib32 lib64" ;; + x32) link_dir="lib32 lib64 libx32" ;; + esac + link_dir="bin sbin lib $link_dir" + + local dir + for dir in $link_dir; do + ln -s usr/"$dir" "$TARGET/$dir" + mkdir -p "$TARGET/usr/$dir" + done +} + +################################################################ pkgdetails + +# NOTE +# For the debootstrap udeb, pkgdetails is provided by the bootstrap-base +# udeb, so the pkgdetails API needs to be kept in sync with that. + +if in_path perl; then + PKGDETAILS=pkgdetails_perl + + # test if grep supports --perl-regexp + set +e + echo x | grep --perl-regexp . >/dev/null 2>&1 + if [ $? -eq 2 ]; then + gropt=-E + else + gropt=--perl-regexp + fi + set -e + + pkgdetails_field () { + # uniq field mirror Packages values... + perl -le ' +$unique = shift @ARGV; $field = lc(shift @ARGV); $mirror = shift @ARGV; +%expected = map { $_, 0 } @ARGV; +%outputs; +$prevpkg = ""; +$chksumfield = lc($ENV{DEBOOTSTRAP_CHECKSUM_FIELD}).":"; + +sub emit_or_store_pkg { + if ($unique && defined $output_val) { + # Store the output for deduplicated emission later + $outputs{$output_val} = $output; + } else { + print $output if defined $output; + } +} + +while (<STDIN>) { + if (/^([^:]*:)\s*(.*)$/) { + $f = lc($1); $v = $2; + if ($f eq "package:") { + $pkg = $v; + if ($pkg ne $prevpkg) { + emit_or_store_pkg; + $prevpkg = $pkg; + } + undef $output; + undef $output_val; + } + $ver = $v if ($f eq "version:"); + $arc = $v if ($f eq "architecture:"); + $fil = $v if ($f eq "filename:"); + $chk = $v if ($f eq $chksumfield); + $siz = $v if ($f eq "size:"); + $val = $v if ($f eq $field); + } elsif (/^$/) { + if (defined $val && defined $expected{$val}) { + $output = sprintf "%s %s %s %s %s %s %s", + $pkg, $ver, $arc, $mirror, $fil, $chk, $siz; + $output_val = $val; + } + undef $val; + } +} +emit_or_store_pkg; + +if ($unique) { + # Emit all of our deduplicated values + map { print } sort values %outputs; + # And emit any expected packages that were not found + foreach my $v (keys %expected) { + printf ("%s -\n", $v) if !defined $outputs{$v}; + } +} +' "$@" + } + + pkgdetails_perl () { + if [ "$1" = "WGET%" ]; then + shift; + perl -e ' +$v = 0; +$allow_percentage = 0; +while (read STDIN, $x, 1) { + if ($x =~ m/\s/) { + $allow_percentage = 1; + } elsif ($allow_percentage and $x =~ m/\d/) { + $v *= 10; + $v += $x; + } elsif ($allow_percentage and $x eq "%") { + printf "P: %d %d%s\n", int($v / 100.0 * ($ARGV[1] - $ARGV[0]) + $ARGV[0]), $ARGV[2], ($#ARGV == 3 ? " $ARGV[3]" : ""); + $v = 0; + } else { + $v = 0; + $allow_percentage = 0; + } +}' "$@" + elif [ "$1" = "GETDEPS" ]; then + local pkgdest="$2"; shift; shift +LC_ALL=C grep "$gropt" '^$|^Package:|^Depends:|^Pre-Depends:' $pkgdest | perl -e ' +%seen = map { $_ => 1 } @ARGV; +while (<STDIN>) { + if (/^Package: (.*)$/) { + $pkg = $1; + next; + } elsif (/^$/) { + $in = 0; + next; + } + $in = 1 if $seen{$pkg}; + if ($in and (/^Depends: (.*)$/ or /^Pre-Depends: (.*)$/)) { + for $d (split /\s*,\s*/, $1) { + $d =~ s/\s*[|].*$//; + $d =~ s/\s*[(].*[)]\s*//; + $d =~ s/:.*//; + $depends{$d} = 1; + } + } +} + foreach (sort keys %depends) { + print "$_\n"; + } +' "$@" + elif [ "$1" = "PKGS" ]; then + local m="$2" + local p="$3" + shift; shift; shift + LC_ALL=C grep "$gropt" '^$|^Architecture:|^Filename:|^MD5sum:|^Package:|^Priority:|^SHA256:|^Size:|^Version:|^Depends:|^Pre-Depends:' "$p" | pkgdetails_field 1 Package: "$m" "$@" + elif [ "$1" = "FIELD" ]; then + local f="$2" + local m="$3" + local p="$4" + shift; shift; shift; shift + LC_ALL=C grep "$gropt" '^$|^Package:|^Priority:' "$p" | pkgdetails_field 0 "$f" "$m" "$@" + elif [ "$1" = "STANZAS" ]; then + local pkgdest="$2"; shift; shift + perl -e ' +my $accum = ""; +%seen = map { $_ => 1 } @ARGV; +while (<STDIN>) { + $accum .= $_; + $in = 1 if (/^Package: (.*)$/ && $seen{$1}); + if ($in and /^$/) { + print $accum; + if (substr($accum, -1) != "\n") { + print "\n\n"; + } elsif (substr($accum, -2, 1) != "\n") { + print "\n"; + } + $in = 0; + } + $accum = "" if /^$/; +}' <"$pkgdest" "$@" + fi + } +elif [ -e "/usr/lib/debootstrap/pkgdetails" ]; then + PKGDETAILS="/usr/lib/debootstrap/pkgdetails" +elif [ -e "$DEBOOTSTRAP_DIR/pkgdetails" ]; then + PKGDETAILS="$DEBOOTSTRAP_DIR/pkgdetails" +else + PKGDETAILS="$(which pkgdetails)" +fi + +##################################################### dependency resolution + +resolve_deps () { + local m1="${MIRRORS%% *}" + + local PKGS="$*" + local ALLPKGS="$PKGS"; + local ALLPKGS2=""; + local s c + while [ "$PKGS" != "" ]; do + local NEWPKGS="" + for s in $SUITE $EXTRA_SUITES; do + for c in ${COMPONENTS:-$(echo ${USE_COMPONENTS} | tr '|' ' ')}; do + local path="dists/$s/$c/binary-$ARCH/Packages" + local pkgdest="$TARGET/$($DLDEST pkg "$s" "$c" "$ARCH" "$m1" "$path")" + NEWPKGS="$NEWPKGS $("$PKGDETAILS" GETDEPS "$pkgdest" $PKGS)" + done + done + if [ -n "${EXCLUDE_DEPENDENCY:-}" ]; then + NEWPKGS="$(without "$NEWPKGS" "$EXCLUDE_DEPENDENCY")" + fi + PKGS=$(echo "$PKGS $NEWPKGS" | tr ' ' '\n' | sort | uniq) + local REALPKGS="" + for s in $SUITE $EXTRA_SUITES; do + for c in ${COMPONENTS:-$(echo ${USE_COMPONENTS} | tr '|' ' ')}; do + local path="dists/$s/$c/binary-$ARCH/Packages" + local pkgdest="$TARGET/$($DLDEST pkg "$s" "$c" "$ARCH" "$m1" "$path")" + REALPKGS="$REALPKGS $("$PKGDETAILS" PKGS REAL "$pkgdest" $PKGS | sed -n 's/ .*REAL.*$//p')" + done + done + PKGS="$REALPKGS" + ALLPKGS2=$(echo "$PKGS $ALLPKGS" | tr ' ' '\n' | sort | uniq) + PKGS=$(without "$ALLPKGS2" "$ALLPKGS") + ALLPKGS="$ALLPKGS2" + done + echo "$ALLPKGS" +} + +setup_available () { + local m1 c path pkgdest pkg + m1="${MIRRORS%% *}" + + for s in $SUITE $EXTRA_SUITES; do + for c in ${COMPONENTS:-$(echo ${USE_COMPONENTS} | tr '|' ' ')}; do + path="dists/$s/$c/binary-$ARCH/Packages" + pkgdest="$TARGET/$($DLDEST pkg "$s" "$c" "$ARCH" "$m1" "$path")" + # XXX: What if a package is in more than one component? + # -- cjwatson 2009-07-29 + # XXX: ...or suite? + # -- jrtc27 2019-06-11 + "$PKGDETAILS" STANZAS "$pkgdest" "$@" + done + done >"$TARGET/var/lib/dpkg/available" + + for pkg; do + echo "$pkg install" + done | in_target dpkg --set-selections +} + +get_next_predep () { + local stanza="$(in_target_nofail dpkg --predep-package)" + [ "$stanza" ] || return 1 + echo "$stanza" | grep '^Package:' | sed 's/^Package://; s/^ *//' +} + +################################################################### helpers + +read_gpg_status () { + local badsig unkkey validsig + while read prefix keyword keyid rest; do + [ "$prefix" = '[GNUPG:]' ] || continue + case $keyword in + BADSIG) badsig="$keyid" ;; + NO_PUBKEY) unkkey="$keyid" ;; + VALIDSIG) validsig="$keyid" ;; + esac + done + if [ "$validsig" ]; then + info VALIDRELSIG "Valid Release signature (key id %s)" "$validsig" + elif [ "$badsig" ]; then + error 1 BADRELSIG "Invalid Release signature (key id %s)" "$badsig" + elif [ "$unkkey" ]; then + error 1 UNKNOWNRELSIG "Release signed by unknown key (key id %s)\n The specified keyring $KEYRING may be incorrect or out of date.\n You can find the latest Debian release key at https://ftp-master.debian.org/keys.html" "$unkkey" + else + error 1 SIGCHECK "Error executing gpgv to check Release signature" + fi +} + +without () { + # usage: without "a b c" "a d" -> "b" "c" + (echo "$1" | tr ' ' '\n' | sort | uniq; + echo "$2" "$2" | tr ' ' '\n') | sort | uniq -u | tr '\n' ' ' + echo +} + +# Formerly called 'repeat', but that's a reserved word in zsh. +repeatn () { + local n="$1" + shift + while [ "$n" -gt 0 ]; do + if "$@"; then + break + else + n=$(( $n - 1 )) + sleep 1 + fi + done + if [ "$n" -eq 0 ]; then return 1; fi + return 0 +} + +N_EXIT_THINGS=0 +exit_function () { + local n=0 + while [ "$n" -lt "$N_EXIT_THINGS" ]; do + (eval $(eval echo \${EXIT_THING_$n}) 2>/dev/null || true) + n=$(( $n + 1 )) + done + N_EXIT_THINGS=0 +} + +trap "exit_function" 0 +trap "exit 129" 1 +trap "error 130 INTERRUPTED \"Interrupt caught ... exiting\"" 2 +trap "exit 131" 3 +trap "exit 143" 15 + +on_exit () { + eval "$(echo EXIT_THING_${N_EXIT_THINGS}=\"$1\")" + N_EXIT_THINGS=$(( $N_EXIT_THINGS + 1 )) +} + +############################################################## fakechroot tools + +install_fakechroot_tools () { + if [ "$VARIANT" = "fakechroot" ]; then + export PATH=/usr/sbin:/sbin:$PATH + fi + + mv "$TARGET/sbin/ldconfig" "$TARGET/sbin/ldconfig.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake ldconfig called, doing nothing\"" > "$TARGET/sbin/ldconfig" + chmod 755 "$TARGET/sbin/ldconfig" + + echo \ +"/sbin/ldconfig +/sbin/ldconfig.REAL +fakechroot" >> "$TARGET/var/lib/dpkg/diversions" + + mv "$TARGET/usr/bin/ldd" "$TARGET/usr/bin/ldd.REAL" + cat << 'END' > "$TARGET/usr/bin/ldd" +#!/usr/bin/perl + +# fakeldd +# +# Replacement for ldd with usage of objdump +# +# (c) 2003-2005 Piotr Roszatycki <dexter@debian.org>, BSD + + +my %libs = (); + +my $status = 0; +my $dynamic = 0; +my $biarch = 0; + +my $ldlinuxsodir = "/lib"; +my @ld_library_path = qw(/usr/lib /lib); + + +sub ldso($) { + my ($lib) = @_; + my @files = (); + + if ($lib =~ /^\//) { + $libs{$lib} = $lib; + push @files, $lib; + } else { + foreach my $ld_path (@ld_library_path) { + next unless -f "$ld_path/$lib"; + my $badformat = 0; + open OBJDUMP, "objdump -p $ld_path/$lib 2>/dev/null |"; + while (my $line = <OBJDUMP>) { + if ($line =~ /file format (\S*)$/) { + $badformat = 1 unless $format eq $1; + last; + } + } + close OBJDUMP; + next if $badformat; + $libs{$lib} = "$ld_path/$lib"; + push @files, "$ld_path/$lib"; + } + objdump(@files); + } +} + + +sub objdump(@) { + my (@files) = @_; + my @libs = (); + + foreach my $file (@files) { + open OBJDUMP, "objdump -p $file 2>/dev/null |"; + while (my $line = <OBJDUMP>) { + $line =~ s/^\s+//; + my @f = split (/\s+/, $line); + if ($line =~ /file format (\S*)$/) { + if (not $format) { + $format = $1; + if ($unamearch eq "x86_64" and $format eq "elf32-i386") { + my $link = readlink "/lib/ld-linux.so.2"; + if ($link =~ /^\/emul\/ia32-linux\//) { + $ld_library_path[-2] = "/emul/ia32-linux/usr/lib"; + $ld_library_path[-1] = "/emul/ia32-linux/lib"; + } + } elsif ($unamearch =~ /^(sparc|sparc64)$/ and $format eq "elf64-sparc") { + $ldlinuxsodir = "/lib64"; + $ld_library_path[-2] = "/usr/lib64"; + $ld_library_path[-1] = "/lib64"; + } + } else { + next unless $format eq $1; + } + } + if (not $dynamic and $f[0] eq "Dynamic") { + $dynamic = 1; + } + next unless $f[0] eq "NEEDED"; + if ($f[1] =~ /^ld-linux(\.|-)/) { + $f[1] = "$ldlinuxsodir/" . $f[1]; + } + if (not defined $libs{$f[1]}) { + $libs{$f[1]} = undef; + push @libs, $f[1]; + } + } + close OBJDUMP; + } + + foreach my $lib (@libs) { + ldso($lib); + } +} + + +if ($#ARGV < 0) { + print STDERR "fakeldd: missing file arguments\n"; + exit 1; +} + +while ($ARGV[0] =~ /^-/) { + my $arg = $ARGV[0]; + shift @ARGV; + last if $arg eq "--"; +} + +open LD_SO_CONF, "/etc/ld.so.conf"; +while ($line = <LD_SO_CONF>) { + chomp $line; + unshift @ld_library_path, $line; +} +close LD_SO_CONF; + +unshift @ld_library_path, split(/:/, $ENV{LD_LIBRARY_PATH}); + +$unamearch = "$(/bin/uname -m)"; +chomp $unamearch; + +foreach my $file (@ARGV) { + my $address; + %libs = (); + $dynamic = 0; + + if ($#ARGV > 0) { + print "$file:\n"; + } + + if (not -f $file) { + print STDERR "ldd: $file: No such file or directory\n"; + $status = 1; + next; + } + + objdump($file); + + if ($dynamic == 0) { + print "\tnot a dynamic executable\n"; + $status = 1; + } elsif (scalar %libs eq "0") { + print "\tstatically linked\n"; + } + + if ($format =~ /^elf64-/) { + $address = "0x0000000000000000"; + } else { + $address = "0x00000000"; + } + + foreach $lib (keys %libs) { + if ($libs{$lib}) { + printf "\t%s => %s (%s)\n", $lib, $libs{$lib}, $address; + } else { + printf "\t%s => not found\n", $lib; + } + } +} + +exit $status; +END + chmod 755 "$TARGET/usr/bin/ldd" + + echo \ +"/usr/bin/ldd +/usr/bin/ldd.REAL +fakechroot" >> "$TARGET/var/lib/dpkg/diversions" + +} diff --git a/system/usr/share/debootstrap/scripts/aequorea b/system/usr/share/debootstrap/scripts/aequorea new file mode 100644 index 0000000..8c68983 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/aequorea @@ -0,0 +1,202 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/tanglu-archive-keyring.gpg +default_mirror http://archive.tanglu.org/tanglu + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + + # we want the Tanglu minimal dependency set to be installed + base="$base tanglu-minimal" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + base="$base apt-transport-https ca-certificates" + ;; + esac +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + setup_dynamic_devices + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + else + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/amber b/system/usr/share/debootstrap/scripts/amber new file mode 100644 index 0000000..b15c318 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/amber @@ -0,0 +1,226 @@ + +# For PureOS "amber" +# PureOS: https://www.pureos.net/ +# Contact: https://tracker.pureos.net/ + +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/pureos-archive-keyring.gpg +default_mirror https://repo.pureos.net/pureos/ + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + base="pureos-archive-keyring" + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$base $(get_debs Priority: important)" + + # we want the PureOS minimal dependency set to be installed + base="$base pureos-minimal" + elif doing_variant buildd; then + base="$base apt build-essential" + elif doing_variant minbase; then + base="$base apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + base="$base ca-certificates" + ;; + esac +} + +first_stage_install () { + MERGED_USR="yes" + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices +} + +second_stage_install () { + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if doing_variant fakechroot; then + setup_proc_fakechroot + else + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/artful b/system/usr/share/debootstrap/scripts/artful new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/artful @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/ascii b/system/usr/share/debootstrap/scripts/ascii new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/ascii @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/bartholomea b/system/usr/share/debootstrap/scripts/bartholomea new file mode 100644 index 0000000..8c68983 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/bartholomea @@ -0,0 +1,202 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/tanglu-archive-keyring.gpg +default_mirror http://archive.tanglu.org/tanglu + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + + # we want the Tanglu minimal dependency set to be installed + base="$base tanglu-minimal" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + base="$base apt-transport-https ca-certificates" + ;; + esac +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + setup_dynamic_devices + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + else + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/beowulf b/system/usr/share/debootstrap/scripts/beowulf new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/beowulf @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/bionic b/system/usr/share/debootstrap/scripts/bionic new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/bionic @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/bookworm b/system/usr/share/debootstrap/scripts/bookworm new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/bookworm @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/breezy b/system/usr/share/debootstrap/scripts/breezy new file mode 100644 index 0000000..fa2d37c --- /dev/null +++ b/system/usr/share/debootstrap/scripts/breezy @@ -0,0 +1,164 @@ +default_mirror http://old-releases.ubuntu.com/ubuntu +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd +force_md5 + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + *) LIBC="libc6" ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant -; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + # TODO: add Build-Essential: yes extraoverrides + #base="$(get_debs Build-Essential: yes)" + + add () { if [ "$ARCH" = "$1" ]; then eval "$2=\"\$$2 $3\""; fi; } + + base="apt binutils cpio cpp cpp-4.0 dpkg-dev g++ g++-4.0 gcc gcc-4.0 gcc-4.0-base ${LIBC}-dev libdb4.2 libgdbm3 libstdc++6 libstdc++6-4.0-dev linux-kernel-headers make patch perl perl-modules" + + add ia64 base "libunwind7-dev" + add sparc base "lib64gcc1" + add sparc base "libc6-dev-sparc64" + add sparc base "libc6-sparc64" + fi +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + echo >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + setup_proc + umount_on_exit /dev/.static/dev + umount_on_exit /dev + in_target /sbin/ldconfig + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-files base-passwd + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1 + + info CONFREQ "Configuring required packages..." + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1 + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1 + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1 + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/bullseye b/system/usr/share/debootstrap/scripts/bullseye new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/bullseye @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/buster b/system/usr/share/debootstrap/scripts/buster new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/buster @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/byzantium b/system/usr/share/debootstrap/scripts/byzantium new file mode 100644 index 0000000..b15c318 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/byzantium @@ -0,0 +1,226 @@ + +# For PureOS "amber" +# PureOS: https://www.pureos.net/ +# Contact: https://tracker.pureos.net/ + +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/pureos-archive-keyring.gpg +default_mirror https://repo.pureos.net/pureos/ + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + base="pureos-archive-keyring" + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$base $(get_debs Priority: important)" + + # we want the PureOS minimal dependency set to be installed + base="$base pureos-minimal" + elif doing_variant buildd; then + base="$base apt build-essential" + elif doing_variant minbase; then + base="$base apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + base="$base ca-certificates" + ;; + esac +} + +first_stage_install () { + MERGED_USR="yes" + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices +} + +second_stage_install () { + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if doing_variant fakechroot; then + setup_proc_fakechroot + else + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/ceres b/system/usr/share/debootstrap/scripts/ceres new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/ceres @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/chromodoris b/system/usr/share/debootstrap/scripts/chromodoris new file mode 100644 index 0000000..8c68983 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/chromodoris @@ -0,0 +1,202 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/tanglu-archive-keyring.gpg +default_mirror http://archive.tanglu.org/tanglu + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + + # we want the Tanglu minimal dependency set to be installed + base="$base tanglu-minimal" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + base="$base apt-transport-https ca-certificates" + ;; + esac +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + setup_dynamic_devices + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + else + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/cosmic b/system/usr/share/debootstrap/scripts/cosmic new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/cosmic @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/crimson b/system/usr/share/debootstrap/scripts/crimson new file mode 100644 index 0000000..b15c318 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/crimson @@ -0,0 +1,226 @@ + +# For PureOS "amber" +# PureOS: https://www.pureos.net/ +# Contact: https://tracker.pureos.net/ + +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/pureos-archive-keyring.gpg +default_mirror https://repo.pureos.net/pureos/ + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + base="pureos-archive-keyring" + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$base $(get_debs Priority: important)" + + # we want the PureOS minimal dependency set to be installed + base="$base pureos-minimal" + elif doing_variant buildd; then + base="$base apt build-essential" + elif doing_variant minbase; then + base="$base apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + base="$base ca-certificates" + ;; + esac +} + +first_stage_install () { + MERGED_USR="yes" + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices +} + +second_stage_install () { + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if doing_variant fakechroot; then + setup_proc_fakechroot + else + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/dapper b/system/usr/share/debootstrap/scripts/dapper new file mode 100644 index 0000000..5f3e8f1 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/dapper @@ -0,0 +1,169 @@ +case $ARCH in + amd64|i386|powerpc|sparc) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd +force_md5 + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + *) LIBC="libc6" ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant -; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + # TODO: add Build-Essential: yes extraoverrides + #base="$(get_debs Build-Essential: yes)" + + add () { if [ "$ARCH" = "$1" ]; then eval "$2=\"\$$2 $3\""; fi; } + + base="apt binutils cpio cpp cpp-4.0 dpkg-dev g++ g++-4.0 gcc gcc-4.0 ${LIBC}-dev libgdbm3 libstdc++6 libstdc++6-4.0-dev linux-kernel-headers make patch perl perl-modules" + + add ia64 base "libunwind7-dev" + add sparc base "lib64gcc1" + add sparc base "libc6-dev-sparc64" + add sparc base "libc6-sparc64" + fi +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + setup_proc + in_target /sbin/ldconfig + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-files base-passwd + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1 + + info CONFREQ "Configuring required packages..." + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1 + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1 + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1 + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/dasyatis b/system/usr/share/debootstrap/scripts/dasyatis new file mode 100644 index 0000000..8c68983 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/dasyatis @@ -0,0 +1,202 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/tanglu-archive-keyring.gpg +default_mirror http://archive.tanglu.org/tanglu + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + + # we want the Tanglu minimal dependency set to be installed + base="$base tanglu-minimal" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + base="$base apt-transport-https ca-certificates" + ;; + esac +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + setup_dynamic_devices + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + else + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/debian-common b/system/usr/share/debootstrap/scripts/debian-common new file mode 100644 index 0000000..9942f2d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/debian-common @@ -0,0 +1,243 @@ +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + # apt-transport-https exists from lenny to stretch + lenny|squeeze|wheezy|jessie*|stretch) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # On suites >= bookworm, either we set up a merged-/usr system + # via setup_merged_usr, or we deliberately avoided that migration + # by creating the flag file. This means there's no need for the + # live migration 'usrmerge' package and its extra dependencies: + # we can install the empty 'usr-is-merged' metapackage to indicate + # that the transition has been done. + case "$CODENAME" in + etch*|lenny|squeeze|wheezy|jessie*|stretch|buster|bullseye) + ;; + *) + required="$required usr-is-merged" + EXCLUDE_DEPENDENCY="$EXCLUDE_DEPENDENCY usrmerge" + ;; + esac +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + etch*|lenny|squeeze|wheezy|jessie*) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + *) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + if [ "$CODENAME" = "stretch" ] && [ -z "$MERGED_USR" ]; then + MERGED_USR="no" + fi + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/devel b/system/usr/share/debootstrap/scripts/devel new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/devel @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/disco b/system/usr/share/debootstrap/scripts/disco new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/disco @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/edgy b/system/usr/share/debootstrap/scripts/edgy new file mode 100644 index 0000000..de065f3 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/edgy @@ -0,0 +1,188 @@ +case $ARCH in + amd64|i386|powerpc|sparc) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot +force_md5 + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + *) LIBC="libc6" ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant -; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + # TODO: add Build-Essential: yes extraoverrides + #base="$(get_debs Build-Essential: yes)" + + add () { if [ "$ARCH" = "$1" ]; then eval "$2=\"\$$2 $3\""; fi; } + + base="apt binutils cpio cpp cpp-4.1 dpkg-dev g++ g++-4.1 gcc gcc-4.1 ${LIBC}-dev libdb4.4 libgdbm3 libstdc++6 libstdc++6-4.1-dev linux-libc-dev make patch perl perl-modules" + + add ia64 base "libunwind7-dev" + add sparc base "lib64gcc1" + add sparc base "libc6-dev-sparc64" + add sparc base "libc6-sparc64" + elif doing_variant fakechroot; then + base="apt" + fi +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + else + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-files base-passwd + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1 + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot; then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1 + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1 + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1 + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/eoan b/system/usr/share/debootstrap/scripts/eoan new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/eoan @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/etch b/system/usr/share/debootstrap/scripts/etch new file mode 100644 index 0000000..4cdc4b4 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/etch @@ -0,0 +1,18 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +default_mirror http://archive.debian.org/debian +keyring /usr/share/keyrings/debian-archive-removed-keys.gpg +force_md5 + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/etch-m68k b/system/usr/share/debootstrap/scripts/etch-m68k new file mode 100644 index 0000000..4cdc4b4 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/etch-m68k @@ -0,0 +1,18 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +default_mirror http://archive.debian.org/debian +keyring /usr/share/keyrings/debian-archive-removed-keys.gpg +force_md5 + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/feisty b/system/usr/share/debootstrap/scripts/feisty new file mode 100644 index 0000000..42bbce3 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/feisty @@ -0,0 +1,190 @@ +case $ARCH in + amd64|i386|powerpc|sparc) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + *) LIBC="libc6" ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant -; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + # TODO: add Build-Essential: yes extraoverrides + #base="$(get_debs Build-Essential: yes)" + + add () { if [ "$ARCH" = "$1" ]; then eval "$2=\"\$$2 $3\""; fi; } + + base="apt binutils cpio cpp cpp-4.1 dpkg-dev g++ g++-4.1 gcc gcc-4.1 ${LIBC}-dev libdb4.4 libgdbm3 libstdc++6 libstdc++6-4.1-dev linux-libc-dev make patch perl perl-modules" + + add ia64 base "libunwind7-dev" + add sparc base "lib64gcc1" + add sparc base "libc6-dev-sparc64" + add sparc base "libc6-sparc64" + elif doing_variant fakechroot; then + base="apt" + fi +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + else + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-files base-passwd + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1 + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot; then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + + # kill libdevmapper postinst; it tries to create /dev/mapper/ + rm "$TARGET/var/lib/dpkg/info/libdevmapper1"*.postinst + fi + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1 + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1 + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1 + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/focal b/system/usr/share/debootstrap/scripts/focal new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/focal @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/groovy b/system/usr/share/debootstrap/scripts/groovy new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/groovy @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/gutsy b/system/usr/share/debootstrap/scripts/gutsy new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/gutsy @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/hardy b/system/usr/share/debootstrap/scripts/hardy new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/hardy @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/hirsute b/system/usr/share/debootstrap/scripts/hirsute new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/hirsute @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/hoary b/system/usr/share/debootstrap/scripts/hoary new file mode 100644 index 0000000..09230fc --- /dev/null +++ b/system/usr/share/debootstrap/scripts/hoary @@ -0,0 +1,178 @@ +default_mirror http://old-releases.ubuntu.com/ubuntu +mirror_style release +download_style apt + +case $ARCH in + ia64) LIBC="libc6.1" ;; + *) LIBC="libc6" ;; +esac + +work_out_debs () { + + required="base-files base-passwd bash bsdutils coreutils libacl1 libattr1 debconf debconf-i18n liblocale-gettext-perl libtext-iconv-perl libtext-wrapi18n-perl libtext-charwidth-perl debianutils diff dpkg dselect libblkid1 e2fsprogs e2fslibs libcomerr2 libss2 libuuid1 findutils grep gzip hostname libcap1 libdb1-compat libdb3 libncurses5 libnewt0.51 libpam-modules libpam-runtime libpam0g libpopt0 login makedev mawk mount ncurses-base ncurses-bin passwd perl-base procps python-minimal python2.4-minimal sed slang1a-utf8 lsb-base initscripts sysvinit sysv-rc tar util-linux zlib1g whiptail libgcc1 gcc-3.3-base libstdc++5" + + base="adduser alsa-base alsa-utils apt apt-utils aptitude at base-config bind9-host bsdmainutils bzip2 console-common console-data console-tools cpio cramfsprogs cron dash dhcp3-client dhcp3-common discover1 discover1-data dmsetup dnsutils dosfstools ed eject ethtool evms evms-ncurses fdutils file ftp gettext-base gnupg grepmap groff-base hdparm hotplug ifrename ifupdown info initrd-tools iproute iptables iputils-arping iputils-ping iputils-tracepath jfsutils klogd less libasound2 libbz2-1.0 libconsole libdb4.2 libdevmapper1.00 libdiscover1 libdns16 libevms-2.5 libfribidi0 libgc1 libgcrypt11 libgdbm3 libgnutls11 libgpg-error0 libgpmg1 libidn11 libisc7 libiw27 libldap2 liblockfile1 liblwres1 liblzo1 libmagic1 libncursesw5 libopencdk8 libparted1.6-12 libpcap0.8 libreiserfs0.3-0 libsasl2 libsasl2-modules libsigc++-1.2-5c102 libssl0.9.7 libtasn1-2 libusb-0.1-4 libwrap0 locales logrotate lsb-release lshw lsof lvm-common lvm10 lvm2 mailx man-db manpages mdadm mii-diag mime-support module-init-tools mtr-tiny mutt nano net-tools netbase netcat netkit-inetd ntp ntpdate openssh-client parted pciutils popularity-contest postfix postfix-tls ppp pppconfig pppoeconf psmisc python python2.4 reiser4progs reiserfsprogs reportbug rsync strace sudo sysklogd tcpd tcpdump telnet time ubuntu-base ubuntu-keyring udev usbutils vim vim-common w3m wget wireless-tools xfsprogs" + + without_package () { + echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' ' + } + subst_package () { + echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' ' + } + + case $ARCH in + "i386") + required="$required libc6 libc6-i686" + base="$base dmidecode libelfg0 ltrace memtest86+ libreadline4" + ;; + "powerpc") + required="$required libc6 libreadline4" + base="$base hfsplus hfsutils libelfg0 libhfsp0 ltrace mac-fdisk pmac-fdisk powerpc-utils" + ;; + "amd64") + required="$required libc6" + base="$base dmidecode libelfg0 ltrace memtest86+ libreadline4" + ;; + "ia64") + required="$required libc6.1 libunwind7" + base="$base dmidecode libreadline4" + ;; + "sparc") + required="$required libc6" + base="$base lib64gcc1 libc6-sparc64 libreadline4" + ;; + *) + # who knows? + ;; + esac +} + +install_debs () { + first_stage_install + second_stage_install +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + echo >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + setup_proc + umount_on_exit /.dev + umount_on_exit /dev + in_target /sbin/ldconfig + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-files base-passwd + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + x_core_install debconf + + baseprog=0 + bases="$(set -- $required; echo $#)" + + info UNPACKREQ "Unpacking required packages..." + + smallyes '' | (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 | dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1 + + baseprog=0 + + info CONFREQ "Configuring required packages..." + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + #on_exit "(in_target_nofail umount /dev/pts) || true" + + smallyes '' | (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 | dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1 + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + smallyes '' | (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --status-fd 8 --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 | dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1 + + baseprog=0 + + info CONFBASE "Configuring the base system..." + + mv "$TARGET/usr/sbin/sendmail" "$TARGET/usr/sbin/sendmail.REAL" + ln -s /bin/true "$TARGET/usr/sbin/sendmail" + + smallyes '' | (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 | dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1 + + rm -f "$TARGET/usr/sbin/sendmail" + mv "$TARGET/usr/sbin/sendmail.REAL" "$TARGET/usr/sbin/sendmail" + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/hoary.buildd b/system/usr/share/debootstrap/scripts/hoary.buildd new file mode 100644 index 0000000..572266b --- /dev/null +++ b/system/usr/share/debootstrap/scripts/hoary.buildd @@ -0,0 +1,159 @@ +default_mirror http://old-releases.ubuntu.com/ubuntu +mirror_style release +download_style apt + +LIBC=libc6 +if [ "$ARCH" = "alpha" ] || [ "$ARCH" = "ia64" ]; then + LIBC="libc6.1" +fi + +work_out_debs () { + required="base-files base-passwd bash bsdutils build-essential coreutils debianutils diff dpkg dselect e2fslibs e2fsprogs fakeroot findutils gcc-3.3-base grep gzip hostname initscripts libacl1 libattr1 libblkid1 libc6 libcap1 libcomerr2 libdb1-compat libdb3 libgcc1 libncurses5 libpam-modules libpam-runtime libpam0g libss2 libstdc++5 libuuid1 login lsb-base mawk mount ncurses-base ncurses-bin passwd perl-base pkgstriptranslations python-minimal python2.4-minimal sed slang1a-utf8 sysv-rc sysvinit tar util-linux zlib1g" + + base="apt binutils cpio cpp cpp-3.3 dpkg-dev g++ g++-3.3 gcc gcc-3.3 libc6-dev libdb4.2 libgdbm3 libstdc++5-3.3-dev linux-kernel-headers make patch perl perl-modules" + + without_package () { + echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' ' + } + subst_package () { + echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' ' + } + + case $ARCH in + "amd64") + ;; + "i386") + ;; + "powerpc") + ;; + "ia64") + required="$(subst_package "libc6" "libc6.1" "$required")" + base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")" + base="$base libunwind7 libunwind7-dev" + ;; + + # Unsupported architectures: + "alpha") + required="$(subst_package "libc6" "libc6.1" "$required")" + base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")" + ;; + *) + # who knows? + ;; + esac +} + +install_debs () { + first_stage_install + second_stage_install +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + echo >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + DEBIAN_FRONTEND=noninteractive + export DEBIAN_FRONTEND + + baseprog=0 + bases=40 + + setup_proc + in_target /sbin/ldconfig + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-files base-passwd + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + + info UNPACKREQ "Unpacking required packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #8 + smallyes '' | repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required) + p 10; progress $baseprog $bases INSTCORE "Installing core packages" #18 + + info CONFREQ "Configuring required packages..." + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + #on_exit "in_target_nofail umount /dev/pts" + + p; progress $baseprog $bases INSTCORE "Installing core packages" #19 + smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends + p 10; progress $baseprog $bases INSTCORE "Installing core packages" #29 + + info INSTCORE "Installing base packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #30 + smallyes '' | repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) + + smallyes '' | repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --force-confold --skip-same-version --configure -a + + p 9; progress $baseprog $bases INSTCORE "Installing core packages" #39 + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases INSTCORE "Installing core packages" #40 + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/impish b/system/usr/share/debootstrap/scripts/impish new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/impish @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/intrepid b/system/usr/share/debootstrap/scripts/intrepid new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/intrepid @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/jammy b/system/usr/share/debootstrap/scripts/jammy new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/jammy @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/jaunty b/system/usr/share/debootstrap/scripts/jaunty new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/jaunty @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/jessie b/system/usr/share/debootstrap/scripts/jessie new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/jessie @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/jessie-kfreebsd b/system/usr/share/debootstrap/scripts/jessie-kfreebsd new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/jessie-kfreebsd @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/kali b/system/usr/share/debootstrap/scripts/kali new file mode 100644 index 0000000..0da3249 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/kali @@ -0,0 +1,17 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/kali-archive-keyring.gpg +default_mirror http://http.kali.org/kali + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/kali-dev b/system/usr/share/debootstrap/scripts/kali-dev new file mode 100644 index 0000000..0da3249 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/kali-dev @@ -0,0 +1,17 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/kali-archive-keyring.gpg +default_mirror http://http.kali.org/kali + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/kali-last-snapshot b/system/usr/share/debootstrap/scripts/kali-last-snapshot new file mode 100644 index 0000000..0da3249 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/kali-last-snapshot @@ -0,0 +1,17 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/kali-archive-keyring.gpg +default_mirror http://http.kali.org/kali + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/kali-rolling b/system/usr/share/debootstrap/scripts/kali-rolling new file mode 100644 index 0000000..0da3249 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/kali-rolling @@ -0,0 +1,17 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/kali-archive-keyring.gpg +default_mirror http://http.kali.org/kali + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/karmic b/system/usr/share/debootstrap/scripts/karmic new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/karmic @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/kinetic b/system/usr/share/debootstrap/scripts/kinetic new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/kinetic @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/lenny b/system/usr/share/debootstrap/scripts/lenny new file mode 100644 index 0000000..4cdc4b4 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/lenny @@ -0,0 +1,18 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +default_mirror http://archive.debian.org/debian +keyring /usr/share/keyrings/debian-archive-removed-keys.gpg +force_md5 + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/lucid b/system/usr/share/debootstrap/scripts/lucid new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/lucid @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/lunar b/system/usr/share/debootstrap/scripts/lunar new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/lunar @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/maverick b/system/usr/share/debootstrap/scripts/maverick new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/maverick @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/moto b/system/usr/share/debootstrap/scripts/moto new file mode 100644 index 0000000..0da3249 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/moto @@ -0,0 +1,17 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/kali-archive-keyring.gpg +default_mirror http://http.kali.org/kali + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/natty b/system/usr/share/debootstrap/scripts/natty new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/natty @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/oldoldstable b/system/usr/share/debootstrap/scripts/oldoldstable new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/oldoldstable @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/oldstable b/system/usr/share/debootstrap/scripts/oldstable new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/oldstable @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/oneiric b/system/usr/share/debootstrap/scripts/oneiric new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/oneiric @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/potato b/system/usr/share/debootstrap/scripts/potato new file mode 100644 index 0000000..e2e4b48 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/potato @@ -0,0 +1,106 @@ +mirror_style release +download_style apt var-state +default_mirror http://archive.debian.org/debian +keyring /usr/share/keyrings/debian-archive-removed-keys.gpg +force_md5 + +LIBC=libc6 +if [ "$ARCH" = alpha ]; then + LIBC="libc6.1" +fi + +work_out_debs () { + required="base-files base-passwd bash bsdutils debconf-tiny debianutils diff dpkg e2fsprogs fileutils findutils grep gzip hostname ldso libc6 libdb2 libgdbmg1 libncurses5 libnewt0 libpam-modules libpam-runtime libpam0g libpopt0 libreadline4 libstdc++2.10 login makedev mawk modutils mount ncurses-base ncurses-bin passwd perl-5.005-base perl-base procps sed shellutils slang1 sysklogd sysvinit tar textutils update util-linux whiptail" + + base="adduser ae apt base-config elvis-tiny fbset fdutils gettext-base console-data console-tools console-tools-libs libdb2 libwrap0 locales modconf netbase ftp ppp pppconfig pump tasksel tcpd textutils telnet xviddetect" + + without_package () { + echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' ' + } + + case $ARCH in + "alpha") + required="$(without_package "libc6" "$required") libc6.1" + ;; + "i386") + base="$base fdflush isapnptools lilo mbr pciutils pcmcia-cs psmisc setserial syslinux" + ;; + *) + # other arches may have special needs not yet represented here + # oh well, Potato is old + esac +} + +first_stage_install () { + extract $required + + :> "$TARGET/var/lib/dpkg/status" + echo > "$TARGET/var/lib/dpkg/available" + + setup_etc + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + + x_feign_install () { + local pkg=$1 + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + +echo \ +"Package: $pkg +Version: $ver +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + setup_devices + + x_feign_install dpkg + + if [ -e "$TARGET/usr/bin/perl-5.005.dist" ]; then + mv "$TARGET/usr/bin/perl-5.005.dist" "$TARGET/usr/bin/perl-5.005" + fi + if [ ! -e "$TARGET/usr/bin/perl" ]; then + ln -sf perl-5.005 "$TARGET/usr/bin/perl" + fi +} + +second_stage_install () { + x_core_install () { + in_target dpkg --force-depends --install $(debfor "$@") + } + + export DEBIAN_FRONTEND=Noninteractive + + setup_proc + ln "$TARGET/sbin/ldconfig.new" "$TARGET/sbin/ldconfig" + in_target /sbin/ldconfig + + x_core_install base-files base-passwd ldso + x_core_install dpkg + + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + x_core_install $LIBC + + smallyes '' | x_core_install perl-5.005-base + x_core_install mawk + x_core_install debconf-tiny + + in_target dpkg-preconfigure $(debfor $required $base) + + repeatn 5 in_target dpkg --force-depends --unpack $(debfor $required) + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + cp "$TARGET/bin/true" "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + in_target dpkg --configure --pending --force-configure-any --force-depends + + smallyes '' | repeatn 5 in_target dpkg --force-auto-select --force-overwrite --skip-same-version --install $(debfor $base) + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" +} diff --git a/system/usr/share/debootstrap/scripts/precise b/system/usr/share/debootstrap/scripts/precise new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/precise @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/quantal b/system/usr/share/debootstrap/scripts/quantal new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/quantal @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/raring b/system/usr/share/debootstrap/scripts/raring new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/raring @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/sana b/system/usr/share/debootstrap/scripts/sana new file mode 100644 index 0000000..0da3249 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/sana @@ -0,0 +1,17 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/kali-archive-keyring.gpg +default_mirror http://http.kali.org/kali + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/sarge b/system/usr/share/debootstrap/scripts/sarge new file mode 100644 index 0000000..586e6a8 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/sarge @@ -0,0 +1,220 @@ +mirror_style release +download_style apt +default_mirror http://archive.debian.org/debian +keyring /usr/share/keyrings/debian-archive-removed-keys.gpg +force_md5 + +LIBC=libc6 +if [ "$ARCH" = "alpha" ] || [ "$ARCH" = "ia64" ]; then + LIBC="libc6.1" +fi + +work_out_debs () { + + required="base-files base-passwd bash bsdutils coreutils libacl1 libattr1 debconf debconf-i18n liblocale-gettext-perl libtext-wrapi18n-perl libtext-charwidth-perl debianutils diff dpkg dselect libblkid1 e2fsprogs e2fslibs libcomerr2 libss2 libuuid1 findutils grep gzip hostname libcap1 libc6 libdb1-compat libdb3 libncurses5 libnewt0.51 libpam-modules libpam-runtime libpam0g libperl5.8 libpopt0 login makedev mawk modutils mount ncurses-base ncurses-bin passwd perl-base procps sed slang1a-utf8 initscripts sysvinit sysv-rc tar util-linux whiptail libgcc1 gcc-3.3-base libstdc++5" + + base="adduser apt apt-utils libdb4.2 at base-config aptitude libsigc++-1.2-5c102 bsdmainutils console-common console-tools libconsole console-data cpio cron dhcp-client ed exim4 exim4-base exim4-config exim4-daemon-light libgcrypt11 libgnutls11 libgpg-error0 libopencdk8 libtasn1-2 fdutils gettext-base groff-base ifupdown info klogd libssl0.9.7 liblzo1 zlib1g liblockfile1 libpcre3 libwrap0 logrotate mailx man-db libgdbm3 manpages nano net-tools netbase netkit-inetd iputils-ping nvi ppp pppconfig pppoe pppoeconf libpcap0.7 sysklogd tasksel libtextwrap1 tcpd telnet libtext-iconv-perl wget" + + without_package () { + echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' ' + } + subst_package () { + echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' ' + } + + IPFWTOOL=iptables + + case $ARCH in + "alpha") + required="$(subst_package "libc6" "libc6.1" "$required")" + base="$base pciutils" + IPFWTOOL="ipchains" + ;; + "arm") + base="$base libgpmg1" + IPFWTOOL="ipchains iptables" + ;; + "i386") + required="$(without_package "libperl5.8" "$required")" + base="$base pciutils psmisc" + IPFWTOOL="ipchains iptables" + ;; + "ia64") + required="$(subst_package "libc6" "libc6.1" "$required") libreadline4" + base="$base elilo efibootmgr dosfstools libparted1.6-12 parted" + ;; + "m68k") + required="$required libreadline4" + base="$base atari-bootstrap atari-fdisk amiga-fdisk eject mac-fdisk pmac-fdisk-cross vmelilo" + IPFWTOOL="ipchains" + ;; + "powerpc") + required="$required libreadline4" + base="$base mac-fdisk amiga-fdisk psmisc powerpc-utils pciutils hfsutils" + IPFWTOOL="ipchains iptables" + ;; + "sparc") + base="$base silo eject pciutils sparc-utils" + IPFWTOOL="ipchains iptables" + ;; + "mips") + base="$base dvhtool pciutils" + ;; + "mipsel") + base="$base pciutils" + ;; + "hppa") + base="$base palo pciutils" + required="$(without_package "libstdc++2.10-glibc2.2" "$required")" + ;; + s390|s390x) + # base-config depends on console-tools and console-data + # so we can't exclude them although they are useless on s390 + base="$base s390-tools telnetd devfsd" + base="$(without_package "console-tools-libs" "$base")" + base="$(without_package "fdutils" "$base")" + base="$(without_package "ppp" "$base")" + base="$(without_package "pppconfig" "$base")" + base="$(without_package "pppoe" "$base")" + base="$(without_package "pppoeconf" "$base")" + ;; + sh*) + base="$base libstdc++3 gcc-3.0-base" + base="$(without_package "fdutils" "$base")" + required="$required libgcc1" + required="$(without_package "libstdc++2.10-glibc2.2" "$required")" + ;; + "amd64") + base="$base pciutils psmisc" + IPFWTOOL="iptables" + ;; + *) + # who knows? + ;; + esac + + base="$base $IPFWTOOL" +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + echo >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + setup_proc + in_target /sbin/ldconfig + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=40 + + p; progress $baseprog $bases INSTBASE "Installing base system" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTBASE "Installing base system" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-files base-passwd + p; progress $baseprog $bases INSTBASE "Installing base system" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + p; progress $baseprog $bases INSTBASE "Installing base system" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTBASE "Installing base system" #5 + x_core_install perl-base + p; progress $baseprog $bases INSTBASE "Installing base system" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + p; progress $baseprog $bases INSTBASE "Installing base system" #7 + x_core_install debconf + + info UNPACKREQ "Unpacking required packages..." + + p; progress $baseprog $bases INSTBASE "Installing base system" #8 + smallyes '' | repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required) + p 10; progress $baseprog $bases INSTBASE "Installing base system" #18 + + info CONFREQ "Configuring required packages..." + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + p; progress $baseprog $bases INSTBASE "Installing base system" #19 + smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends + p 10; progress $baseprog $bases INSTBASE "Installing base system" #29 + +# if [ ! -e "$TARGET/etc/exim/exim.conf" ]; then +# mkdir -p "$TARGET/etc/exim" +# touch "$TARGET/etc/exim/exim.conf" +# fi + + info INSTBASE "Installing base packages..." + + p; progress $baseprog $bases INSTBASE "Installing base system" #30 + smallyes '' | repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) + + rm -f "$TARGET/usr/sbin/sendmail" + ln -sf /bin/true "$TARGET/usr/sbin/sendmail" + + smallyes '' | repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --force-confold --skip-same-version --configure -a + + rm -f "$TARGET/usr/sbin/sendmail" + ln -sf exim4 "$TARGET/usr/sbin/sendmail" + + p 9; progress $baseprog $bases INSTBASE "Installing base system" #39 + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases INSTBASE "Installing base system" #40 + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/sarge.buildd b/system/usr/share/debootstrap/scripts/sarge.buildd new file mode 100644 index 0000000..5387761 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/sarge.buildd @@ -0,0 +1,166 @@ +mirror_style release +download_style apt +force_md5 + +LIBC=libc6 +if [ "$ARCH" = "alpha" ] || [ "$ARCH" = "ia64" ]; then + LIBC="libc6.1" +fi + +work_out_debs () { + + required="base-files base-passwd bash bsdutils coreutils debianutils diff dpkg dselect e2fslibs e2fsprogs findutils gcc-3.3-base grep gzip hostname initscripts libacl1 libattr1 libblkid1 libc6 libcap1 libcomerr2 libdb1-compat libdb3 libgcc1 libncurses5 libpam-modules libpam-runtime libpam0g libss2 libstdc++5 libuuid1 login mawk mount ncurses-base ncurses-bin passwd perl-base sed slang1a-utf8 sysv-rc sysvinit tar util-linux zlib1g" + + base="apt binutils cpio cpp cpp-3.3 dpkg-dev g++ g++-3.3 gcc gcc-3.3 libc6-dev libdb4.2 libgdbm3 libstdc++5-3.3-dev linux-kernel-headers make patch perl perl-modules" + + without_package () { + echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' ' + } + subst_package () { + echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' ' + } + + case $ARCH in + "alpha") + required="$(subst_package "libc6" "libc6.1" "$required")" + base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")" + ;; + "arm") + ;; + "i386") + ;; + "ia64") + required="$(subst_package "libc6" "libc6.1" "$required")" + base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")" + ;; + "m68k") + ;; + "powerpc") + ;; + "sparc") + ;; + "mips") + ;; + "mipsel") + ;; + "hppa") + ;; + s390|s390x) + ;; + sh*) + ;; + *) + # who knows? + ;; + esac +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + echo >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + setup_proc + in_target /sbin/ldconfig + + DEBIAN_FRONTEND=noninteractive + export DEBIAN_FRONTEND + + baseprog=0 + bases=40 + + p; progress $baseprog $bases INSTBASE "Installing base system" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTBASE "Installing base system" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-files base-passwd + p; progress $baseprog $bases INSTBASE "Installing base system" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + p; progress $baseprog $bases INSTBASE "Installing base system" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTBASE "Installing base system" #5 + x_core_install perl-base + p; progress $baseprog $bases INSTBASE "Installing base system" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + p; progress $baseprog $bases INSTBASE "Installing base system" #7 + + info UNPACKREQ "Unpacking required packages..." + + p; progress $baseprog $bases INSTBASE "Installing base system" #8 + smallyes '' | repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required) + p 10; progress $baseprog $bases INSTBASE "Installing base system" #18 + + info CONFREQ "Configuring required packages..." + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + p; progress $baseprog $bases INSTBASE "Installing base system" #19 + smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends + p 10; progress $baseprog $bases INSTBASE "Installing base system" #29 + + info INSTBASE "Installing base packages..." + + p; progress $baseprog $bases INSTBASE "Installing base system" #30 + smallyes '' | repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) + + smallyes '' | repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --force-confold --skip-same-version --configure -a + + p 9; progress $baseprog $bases INSTBASE "Installing base system" #39 + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases INSTBASE "Installing base system" #40 + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/sarge.fakechroot b/system/usr/share/debootstrap/scripts/sarge.fakechroot new file mode 100644 index 0000000..9bbcf16 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/sarge.fakechroot @@ -0,0 +1,171 @@ +test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" + +mirror_style release +download_style apt +force_md5 + +LIBC=libc6 +if [ "$ARCH" = "alpha" ] || [ "$ARCH" = "ia64" ]; then + LIBC="libc6.1" +fi + +work_out_debs () { + + required="base-files base-passwd bash bsdutils coreutils debianutils diff dpkg dselect e2fslibs e2fsprogs findutils gcc-3.3-base grep gzip hostname initscripts libacl1 libattr1 libblkid1 libc6 libcap1 libcomerr2 libdb1-compat libdb3 libgcc1 libncurses5 libpam-modules libpam-runtime libpam0g libss2 libstdc++5 libuuid1 login mawk mount ncurses-base ncurses-bin passwd perl-base sed slang1a-utf8 sysv-rc sysvinit tar util-linux zlib1g" + + base="apt binutils cpio cpp cpp-3.3 dpkg-dev g++ g++-3.3 gcc gcc-3.3 libc6-dev libdb4.2 libgdbm3 libstdc++5-3.3-dev linux-kernel-headers make patch perl perl-modules" + + without_package () { + echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' ' + } + subst_package () { + echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' ' + } + + required="$required binutils fakechroot" + base="$(without_package "binutils" "$base")" + + case $ARCH in + "alpha") + required="$(subst_package "libc6" "libc6.1" "$required")" + base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")" + ;; + "arm") + ;; + "i386") + ;; + "ia64") + required="$(subst_package "libc6" "libc6.1" "$required")" + base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")" + ;; + "m68k") + ;; + "powerpc") + ;; + "sparc") + ;; + "mips") + ;; + "mipsel") + ;; + "hppa") + ;; + s390|s390x) + ;; + sh*) + ;; + *) + # who knows? + ;; + esac +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + setup_devices_fakechroot + setup_proc_symlink + + DEBIAN_FRONTEND=noninteractive + export DEBIAN_FRONTEND + + baseprog=0 + bases=40 + + p; progress $baseprog $bases INSTBASE "Installing base system" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTBASE "Installing base system" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-files base-passwd + p; progress $baseprog $bases INSTBASE "Installing base system" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + install_fakechroot_tools + + p; progress $baseprog $bases INSTBASE "Installing base system" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTBASE "Installing base system" #5 + x_core_install perl-base + p; progress $baseprog $bases INSTBASE "Installing base system" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + p; progress $baseprog $bases INSTBASE "Installing base system" #7 + + info UNPACKREQ "Unpacking required packages..." + + p; progress $baseprog $bases INSTBASE "Installing base system" #8 + smallyes '' | repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required) + p 10; progress $baseprog $bases INSTBASE "Installing base system" #18 + + info CONFREQ "Configuring required packages..." + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + p; progress $baseprog $bases INSTBASE "Installing base system" #19 + smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends + p 10; progress $baseprog $bases INSTBASE "Installing base system" #29 + + info INSTBASE "Installing base packages..." + + p; progress $baseprog $bases INSTBASE "Installing base system" #30 + smallyes '' | repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) + + smallyes '' | repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --force-confold --skip-same-version --configure -a + + p 9; progress $baseprog $bases INSTBASE "Installing base system" #39 + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases INSTBASE "Installing base system" #40 + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/saucy b/system/usr/share/debootstrap/scripts/saucy new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/saucy @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/sid b/system/usr/share/debootstrap/scripts/sid new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/sid @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/squeeze b/system/usr/share/debootstrap/scripts/squeeze new file mode 100644 index 0000000..4cdc4b4 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/squeeze @@ -0,0 +1,18 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +default_mirror http://archive.debian.org/debian +keyring /usr/share/keyrings/debian-archive-removed-keys.gpg +force_md5 + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/stable b/system/usr/share/debootstrap/scripts/stable new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/stable @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/stretch b/system/usr/share/debootstrap/scripts/stretch new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/stretch @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/testing b/system/usr/share/debootstrap/scripts/testing new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/testing @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/trixie b/system/usr/share/debootstrap/scripts/trixie new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/trixie @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/trusty b/system/usr/share/debootstrap/scripts/trusty new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/trusty @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/unstable b/system/usr/share/debootstrap/scripts/unstable new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/unstable @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/utopic b/system/usr/share/debootstrap/scripts/utopic new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/utopic @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/vivid b/system/usr/share/debootstrap/scripts/vivid new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/vivid @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/warty b/system/usr/share/debootstrap/scripts/warty new file mode 100644 index 0000000..7c0fa12 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/warty @@ -0,0 +1,165 @@ +default_mirror http://old-releases.ubuntu.com/ubuntu +mirror_style release +download_style apt + +LIBC=libc6 + +work_out_debs () { + + required="base-files base-passwd bash bsdutils coreutils libacl1 libattr1 debconf debconf-i18n liblocale-gettext-perl libtext-iconv-perl libtext-wrapi18n-perl libtext-charwidth-perl debianutils diff dpkg dselect libblkid1 e2fsprogs e2fslibs libcomerr2 libss2 libuuid1 findutils grep gzip hostname libcap1 libc6 libdb1-compat libdb3 libncurses5 libnewt0.51 libpam-modules libpam-runtime libpam0g libpopt0 login makedev mawk modutils mount ncurses-base ncurses-bin passwd perl-base procps sed slang1a-utf8 lsb-base initscripts sysvinit sysv-rc tar util-linux zlib1g whiptail libgcc1 gcc-3.3-base libstdc++5" + + base="adduser alsa-base alsa-utils apt apt-utils aptitude at base-config bind9-host bsdmainutils bzip2 console-common console-data console-tools cpio cramfsprogs cron dash dbus-1 dhcp3-client dhcp3-common discover1 discover1-data dmsetup dnsutils dosfstools ed eject evms evms-ncurses fdutils file ftp gettext-base gnupg groff-base hdparm hotplug ifrename ifupdown info initrd-tools iproute iptables iputils-arping iputils-ping iputils-tracepath jfsutils klogd less libasound2 libatm1 libbz2-1.0 libconsole libdb4.2 libdevmapper1.00 libdiscover1 libdns16 libevms-2.3 libexpat1 libfribidi0 libgc1 libgcrypt7 libgdbm3 libgnutls10 libgpg-error0 libgpmg1 libidn11 libisc7 libiw27 libldap2 liblockfile1 liblwres1 liblzo1 libmagic1 libncursesw5 libopencdk8 libparted1.6-0 libpcap0.7 libpcap0.8 libreiserfs0.3-0 libsasl2 libsigc++-1.2-5c102 libssl0.9.7 libtasn1-2 libusb-0.1-4 libwrap0 locales logrotate lshw lsof ltrace lvm-common lvm10 lvm2 mailx man-db manpages mdadm mii-diag mime-support module-init-tools mtr-tiny mutt nano net-tools netbase netcat netkit-inetd ntp ntpdate openssh-client parted pciutils popularity-contest postfix postfix-tls ppp pppconfig pppoeconf psmisc python python2.3 reiser4progs reiserfsprogs reportbug rsync strace sudo sysklogd tcpd tcpdump telnet time ubuntu-base udev usbutils vim vim-common w3m wget wireless-tools xfsprogs" + + without_package () { + echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' ' + } + subst_package () { + echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' ' + } + + case $ARCH in + "i386") + required="$required libc6-i686" + base="$base dmidecode memtest86+ libreadline4" + ;; + "powerpc") + required="$required libreadline4" + base="$base hfsplus hfsutils libhfsp0 mac-fdisk pmac-fdisk powerpc-utils" + ;; + "amd64") + base="$base dmidecode libreadline4" + ;; + *) + # who knows? + ;; + esac +} + +install_debs () { + first_stage_install + second_stage_install +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + echo >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + setup_proc + in_target /sbin/ldconfig + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-files base-passwd + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + x_core_install debconf + + baseprog=0 + bases="$(set -- $required; echo $#)" + + info UNPACKREQ "Unpacking required packages..." + + smallyes '' | (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 | dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1 + + baseprog=0 + + info CONFREQ "Configuring required packages..." + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + #on_exit "(in_target_nofail umount /dev/pts) || true" + + smallyes '' | (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 | dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1 + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + smallyes '' | (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --status-fd 8 --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 | dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1 + + baseprog=0 + + info CONFBASE "Configuring the base system..." + + mv "$TARGET/usr/sbin/sendmail" "$TARGET/usr/sbin/sendmail.REAL" + ln -s /bin/true "$TARGET/usr/sbin/sendmail" + + smallyes '' | (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 | dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1 + + rm -f "$TARGET/usr/sbin/sendmail" + mv "$TARGET/usr/sbin/sendmail.REAL" "$TARGET/usr/sbin/sendmail" + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/warty.buildd b/system/usr/share/debootstrap/scripts/warty.buildd new file mode 100644 index 0000000..5b90005 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/warty.buildd @@ -0,0 +1,159 @@ +default_mirror http://old-releases.ubuntu.com/ubuntu +mirror_style release +download_style apt + +LIBC=libc6 +if [ "$ARCH" = "alpha" ] || [ "$ARCH" = "ia64" ]; then + LIBC="libc6.1" +fi + +work_out_debs () { + + required="base-files base-passwd bash bsdutils build-essential coreutils debianutils diff dpkg dselect e2fslibs e2fsprogs fakeroot findutils gcc-3.3-base grep gzip hostname initscripts libacl1 libattr1 libblkid1 libc6 libcap1 libcomerr2 libdb1-compat libdb3 libgcc1 libncurses5 libpam-modules libpam-runtime libpam0g libss2 libstdc++5 libuuid1 login lsb-base mawk mount ncurses-base ncurses-bin perl-base sed slang1a-utf8 sysv-rc sysvinit tar util-linux zlib1g" + + base="apt binutils cpio cpp cpp-3.3 dpkg-dev g++ g++-3.3 gcc gcc-3.3 libc6-dev libdb4.2 libgdbm3 libstdc++5-3.3-dev linux-kernel-headers make patch perl perl-modules" + + without_package () { + echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' ' + } + subst_package () { + echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' ' + } + + case $ARCH in + "amd64") + ;; + "i386") + ;; + "powerpc") + ;; + + # Unsupported architectures: + "alpha") + required="$(subst_package "libc6" "libc6.1" "$required")" + base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")" + ;; + "ia64") + required="$(subst_package "libc6" "libc6.1" "$required")" + base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")" + ;; + *) + # who knows? + ;; + esac +} + +install_debs () { + first_stage_install + second_stage_install +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + echo >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + DEBIAN_FRONTEND=noninteractive + export DEBIAN_FRONTEND + + baseprog=0 + bases=40 + + setup_proc + in_target /sbin/ldconfig + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-files base-passwd + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + + info UNPACKREQ "Unpacking required packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #8 + smallyes '' | repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required) + p 10; progress $baseprog $bases INSTCORE "Installing core packages" #18 + + info CONFREQ "Configuring required packages..." + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + #on_exit "in_target_nofail umount /dev/pts" + + p; progress $baseprog $bases INSTCORE "Installing core packages" #19 + smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends + p 10; progress $baseprog $bases INSTCORE "Installing core packages" #29 + + info INSTCORE "Installing base packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #30 + smallyes '' | repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) + + smallyes '' | repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --force-confold --skip-same-version --configure -a + + p 9; progress $baseprog $bases INSTCORE "Installing core packages" #39 + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases INSTCORE "Installing core packages" #40 + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/wheezy b/system/usr/share/debootstrap/scripts/wheezy new file mode 100644 index 0000000..710b74d --- /dev/null +++ b/system/usr/share/debootstrap/scripts/wheezy @@ -0,0 +1,16 @@ +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/debian-archive-keyring.gpg + +# include common settings +if [ -e "$DEBOOTSTRAP_DIR/scripts/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/scripts/debian-common" +elif [ -e /debootstrap/debian-common ]; then + . /debootstrap/debian-common +elif [ -e "$DEBOOTSTRAP_DIR/debian-common" ]; then + . "$DEBOOTSTRAP_DIR/debian-common" +else + error 1 NOCOMMON "File not found: debian-common" +fi diff --git a/system/usr/share/debootstrap/scripts/wily b/system/usr/share/debootstrap/scripts/wily new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/wily @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/woody b/system/usr/share/debootstrap/scripts/woody new file mode 100644 index 0000000..626cf5f --- /dev/null +++ b/system/usr/share/debootstrap/scripts/woody @@ -0,0 +1,205 @@ +mirror_style release +download_style apt +default_mirror http://archive.debian.org/debian +keyring /usr/share/keyrings/debian-archive-removed-keys.gpg +force_md5 + +LIBC=libc6 +if [ "$ARCH" = "alpha" ] || [ "$ARCH" = "ia64" ]; then + LIBC="libc6.1" +fi + +work_out_debs () { + + required="base-files base-passwd bash bsdutils debconf debianutils diff dpkg e2fsprogs fileutils findutils grep gzip hostname libcap1 libc6 libdb2 libdb3 libncurses5 libnewt0 libpam-modules libpam-runtime libpam0g libperl5.6 libpopt0 libreadline4 libstdc++2.10-glibc2.2 login makedev mawk modutils mount ncurses-base ncurses-bin passwd perl-base procps sed shellutils slang1 sysvinit tar textutils util-linux whiptail" + + base="adduser apt apt-utils at base-config bsdmainutils console-common console-tools console-tools-libs console-data cpio cron dhcp-client ed exim fdutils gettext-base groff-base ifupdown info klogd libident libldap2 liblockfile1 libpcre3 libsasl7 libwrap0 logrotate mailx man-db manpages modconf nano net-tools netbase netkit-inetd netkit-ping nvi ppp pppconfig pppoe pppoeconf libpcap0 sysklogd tasksel tcpd telnet" + + without_package () { + echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' ' + } + + IPFWTOOL=iptables + + case $ARCH in + "alpha") + required="$(without_package "libc6" "$required") libc6.1" + base="$base setserial aboot pciutils" + IPFWTOOL="ipchains" + ;; + "arm") + base="$base setserial libgpmg1" + IPFWTOOL="ipchains iptables" + ;; + "i386") + required="$(without_package "libperl5.6" "$required") mbr" + base="$base lilo pciutils setserial syslinux psmisc pcmcia-cs" + IPFWTOOL="ipchains iptables" + ;; + "ia64") + required="$(without_package "libc6" "$required") libc6.1 gcc-2.96-base" + base="$base elilo efibootmgr dosfstools libparted1.4 parted" + ;; + "m68k") + base="$base atari-bootstrap atari-fdisk amiga-fdisk eject mac-fdisk pmac-fdisk-cross setserial vmelilo" + IPFWTOOL="ipchains" + ;; + "powerpc") + base="$base quik mac-fdisk amiga-fdisk psmisc powerpc-utils setserial pciutils hfsutils yaboot pcmcia-cs" + IPFWTOOL="ipchains iptables" + ;; + "sparc") + base="$base silo eject pciutils sparc-utils" + IPFWTOOL="ipchains iptables" + ;; + "mips") + base="$base dvhtool pciutils setserial" # pcmcia-cs + ;; + "mipsel") + base="$base delo pciutils setserial" # pcmcia-cs + ;; + "hppa") + base="$base palo libstdc++3 gcc-3.0-base" + required="$(without_package "libstdc++2.10-glibc2.2" "$required")" + ;; + s390|s390x) + # base-config depends on console-data and console-common + # so we can't exclude them although they are useless on s390 + base="$base s390-tools telnetd devfsd" + base="$(without_package "console-tools" "$base")" + base="$(without_package "console-tools-libs" "$base")" + base="$(without_package "fdutils" "$base")" + base="$(without_package "ppp" "$base")" + base="$(without_package "pppconfig" "$base")" + base="$(without_package "pppoe" "$base")" + base="$(without_package "pppoeconf" "$base")" + ;; + *) + # who knows? + ;; + esac + + base="$base $IPFWTOOL" +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + echo >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + setup_proc + in_target /sbin/ldconfig + + DEBIAN_FRONTEND=Noninteractive + export DEBIAN_FRONTEND + + baseprog=0 + bases=40 + + p; progress $baseprog $bases INSTBASE "Installing base system" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTBASE "Installing base system" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-files base-passwd + p; progress $baseprog $bases INSTBASE "Installing base system" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + p; progress $baseprog $bases INSTBASE "Installing base system" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTBASE "Installing base system" #5 + x_core_install perl-base + p; progress $baseprog $bases INSTBASE "Installing base system" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + p; progress $baseprog $bases INSTBASE "Installing base system" #7 + x_core_install debconf + + info UNPACKREQ "Unpacking required packages..." + + p; progress $baseprog $bases INSTBASE "Installing base system" #8 + smallyes '' | repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required) + p 10; progress $baseprog $bases INSTBASE "Installing base system" #18 + + info CONFREQ "Configuring required packages..." + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + p; progress $baseprog $bases INSTBASE "Installing base system" #19 + smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends + p 10; progress $baseprog $bases INSTBASE "Installing base system" #29 + + if [ ! -e "$TARGET/etc/exim/exim.conf" ]; then + mkdir -p "$TARGET/etc/exim" + touch "$TARGET/etc/exim/exim.conf" + fi + + info INSTBASE "Installing base packages..." + + p; progress $baseprog $bases INSTBASE "Installing base system" #30 + smallyes '' | repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) + + rm -f "$TARGET/usr/sbin/sendmail" + ln -sf /bin/true "$TARGET/usr/sbin/sendmail" + + smallyes '' | repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --force-confold --skip-same-version --configure -a + + rm -f "$TARGET/usr/sbin/sendmail" + ln -sf exim "$TARGET/usr/sbin/sendmail" + + p 9; progress $baseprog $bases INSTBASE "Installing base system" #39 + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases INSTBASE "Installing base system" #40 + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/woody.buildd b/system/usr/share/debootstrap/scripts/woody.buildd new file mode 100644 index 0000000..8530692 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/woody.buildd @@ -0,0 +1,168 @@ +mirror_style release +download_style apt +default_mirror http://archive.debian.org/debian +keyring /usr/share/keyrings/debian-archive-removed-keys.gpg +force_md5 + +LIBC=libc6 +if [ "$ARCH" = "alpha" ] || [ "$ARCH" = "ia64" ]; then + LIBC="libc6.1" +fi + +work_out_debs () { + + required="base-files base-passwd bash bsdutils debianutils diff dpkg e2fsprogs fileutils findutils grep gzip hostname libc6 libcap1 libdb3 libgdbmg1 libncurses5 libpam-modules libpam-runtime libpam0g libperl5.6 libstdc++2.10-glibc2.2 login mawk mount ncurses-base ncurses-bin perl-base sed shellutils slang1 sysvinit tar textutils util-linux" + + base="apt binutils cpio cpp cpp-2.95 debconf dpkg-dev g++ g++-2.95 gcc gcc-2.95 libc6-dev libdb2 libstdc++2.10-dev make patch perl perl-modules" + + without_package () { + echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' ' + } + + case $ARCH in + "alpha") + required="$(without_package "libc6" "$required") libc6.1" + base="$(without_package "libc6-dev" "$base") libc6.1-dev" + ;; + "arm") + ;; + "i386") + ;; + "ia64") + required="$(without_package "libc6" "$required") libc6.1 gcc-2.96-base libreadline4" + base="$(without_package "cpp-2.95" "$base") cpp-2.96" + base="$(without_package "gcc-2.95" "$base") gcc-2.96" + base="$(without_package "g++-2.95" "$base") g++-2.96" + base="$(without_package "libc6-dev" "$base") libc6.1-dev elilo efibootmgr dosfstools libparted1.4 parted" + ;; + "m68k") + ;; + "powerpc") + ;; + "sparc") + ;; + "mips") + ;; + "mipsel") + ;; + "hppa") + ;; + s390|s390x) + ;; + sh*) + ;; + *) + # who knows? + ;; + esac +} + +first_stage_install () { + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + echo >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(extract_deb_field "$TARGET/$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg +} + +second_stage_install () { + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + setup_proc + in_target /sbin/ldconfig + + DEBIAN_FRONTEND=noninteractive + export DEBIAN_FRONTEND + + baseprog=0 + bases=40 + + p; progress $baseprog $bases INSTBASE "Installing base system" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTBASE "Installing base system" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-files base-passwd + p; progress $baseprog $bases INSTBASE "Installing base system" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + p; progress $baseprog $bases INSTBASE "Installing base system" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTBASE "Installing base system" #5 + x_core_install perl-base + p; progress $baseprog $bases INSTBASE "Installing base system" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + p; progress $baseprog $bases INSTBASE "Installing base system" #7 + + info UNPACKREQ "Unpacking required packages..." + + p; progress $baseprog $bases INSTBASE "Installing base system" #8 + smallyes '' | repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required) + p 10; progress $baseprog $bases INSTBASE "Installing base system" #18 + + info CONFREQ "Configuring required packages..." + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + setup_dselect_method apt + + p; progress $baseprog $bases INSTBASE "Installing base system" #19 + smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends + p 10; progress $baseprog $bases INSTBASE "Installing base system" #29 + + info INSTBASE "Installing base packages..." + + p; progress $baseprog $bases INSTBASE "Installing base system" #30 + smallyes '' | repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) + + smallyes '' | repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --force-confold --skip-same-version --configure -a + + p 9; progress $baseprog $bases INSTBASE "Installing base system" #39 + + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + + progress $bases $bases INSTBASE "Installing base system" #40 + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/xenial b/system/usr/share/debootstrap/scripts/xenial new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/xenial @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/yakkety b/system/usr/share/debootstrap/scripts/yakkety new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/yakkety @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/system/usr/share/debootstrap/scripts/zesty b/system/usr/share/debootstrap/scripts/zesty new file mode 100644 index 0000000..c5d4c85 --- /dev/null +++ b/system/usr/share/debootstrap/scripts/zesty @@ -0,0 +1,327 @@ +case $ARCH in + amd64|i386) + case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|utopic|vivid|wily|yakkety|zesty) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://archive.ubuntu.com/ubuntu + ;; + esac + ;; + sparc) + case $SUITE in + gutsy) + default_mirror http://old-releases.ubuntu.com/ubuntu + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; + esac + ;; + *) + default_mirror http://ports.ubuntu.com/ubuntu-ports + ;; +esac +mirror_style release +download_style apt +finddebs_style from-indices +variants - buildd fakechroot minbase +keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg + +if doing_variant fakechroot; then + test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" +fi + +case $ARCH in + alpha|ia64) LIBC="libc6.1" ;; + kfreebsd-*) LIBC="libc0.1" ;; + hurd-*) LIBC="libc0.3" ;; + *) LIBC="libc6" ;; +esac + +case $SUITE in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy|hirsute) ;; + *) + # impish+ will use zstd compression, check if supported + dpkg_zstd="$(dpkg-deb --help 2>/dev/null | grep ' zstd,' || :)" + if [ -z "$EXTRACTOR_OVERRIDE" ] && [ -z "$dpkg_zstd" ]; then + info CHOSENEXTRACTOR "%s uses zstd compression, setting --extractor=ar option" "$SUITE" + export EXTRACTOR_OVERRIDE=ar + fi + ;; +esac + +work_out_debs () { + required="$(get_debs Priority: required)" + + if doing_variant - || doing_variant fakechroot; then + #required="$required $(get_debs Priority: important)" + # ^^ should be getting debconf here somehow maybe + base="$(get_debs Priority: important)" + elif doing_variant buildd; then + base="apt build-essential" + elif doing_variant minbase; then + base="apt" + fi + + if doing_variant fakechroot; then + # ldd.fake needs binutils + required="$required binutils" + fi + + case $MIRRORS in + https://*) + case "$CODENAME" in + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty) + base="$base apt-transport-https ca-certificates" + ;; + *) + base="$base ca-certificates" + ;; + esac + ;; + esac + + # do not install usrmerge in fresh bootstraps + # but do print it for germinate to accept it into minimal + if [ "$WHAT_TO_DO" = "finddebs printdebs kill_target" ]; then + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan|focal|groovy) + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if ! doing_variant buildd; then + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + fi + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + if [ -z "$MERGED_USR" ] || [ "$MERGED_USR" = "yes" ]; then + base="$base usrmerge" + fi + ;; + esac + fi +} + +first_stage_install () { + case "$CODENAME" in + # "merged-usr" blacklist for past releases + gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic) + [ -z "$MERGED_USR" ] && MERGED_USR="no" + ;; + disco|eoan|focal|groovy) + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + hirsute) + # keep hirsute buildd chroots split-usr to allow for escape hatch + if [ -z "$MERGED_USR" ]; then + if doing_variant buildd; then + MERGED_USR="no" + else + MERGED_USR="yes" + fi + fi + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + *) + # all future series post hirsute use merged-usr in buildd chroots too + [ -z "$MERGED_USR" ] && MERGED_USR="yes" + # see https://bugs.debian.org/838388 + EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k" + ;; + esac + + setup_merged_usr + extract $required + + mkdir -p "$TARGET/var/lib/dpkg" + : >"$TARGET/var/lib/dpkg/status" + : >"$TARGET/var/lib/dpkg/available" + + setup_etc + if [ ! -e "$TARGET/etc/fstab" ]; then + echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" + chmod 644 "$TARGET/etc/fstab" + fi + + setup_devices + + if doing_variant fakechroot || [ "$CONTAINER" = "docker" ]; then + setup_proc_symlink + fi +} + +second_stage_install () { + in_target /bin/true + + setup_dynamic_devices + + x_feign_install () { + local pkg="$1" + local deb="$(debfor $pkg)" + local ver="$(in_target dpkg-deb -f "$deb" Version)" + + mkdir -p "$TARGET/var/lib/dpkg/info" + + echo \ +"Package: $pkg +Version: $ver +Maintainer: unknown +Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" + + touch "$TARGET/var/lib/dpkg/info/${pkg}.list" + } + + x_feign_install dpkg + + x_core_install () { + smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") + } + + p () { + baseprog="$(($baseprog + ${1:-1}))" + } + + if ! doing_variant fakechroot; then + setup_proc + in_target /sbin/ldconfig + fi + + DEBIAN_FRONTEND=noninteractive + DEBCONF_NONINTERACTIVE_SEEN=true + export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + + baseprog=0 + bases=7 + + p; progress $baseprog $bases INSTCORE "Installing core packages" #1 + info INSTCORE "Installing core packages..." + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" + x_core_install base-passwd + x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + + if [ ! -e "$TARGET/etc/localtime" ]; then + ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" + fi + + if doing_variant fakechroot; then + install_fakechroot_tools + fi + + p; progress $baseprog $bases INSTCORE "Installing core packages" #4 + x_core_install $LIBC + + p; progress $baseprog $bases INSTCORE "Installing core packages" #5 + x_core_install perl-base + + p; progress $baseprog $bases INSTCORE "Installing core packages" #6 + rm "$TARGET/usr/bin/awk" + x_core_install mawk + + p; progress $baseprog $bases INSTCORE "Installing core packages" #7 + if doing_variant -; then + x_core_install debconf + fi + + baseprog=0 + bases=$(set -- $required; echo $#) + + info UNPACKREQ "Unpacking required packages..." + + exec 7>&1 + + smallyes '' | + (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ + dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING + + info CONFREQ "Configuring required packages..." + + if doing_variant fakechroot && [ -e "$TARGET/var/lib/dpkg/info/initscripts.postinst" ] + then + # fix initscripts postinst (no mounting possible, and wrong if condition) + sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst" + fi + + echo \ +"#!/bin/sh +exit 101" > "$TARGET/usr/sbin/policy-rc.d" + chmod 755 "$TARGET/usr/sbin/policy-rc.d" + + mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" + echo \ +"#!/bin/sh +echo +echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" + chmod 755 "$TARGET/sbin/start-stop-daemon" + + if [ -x "$TARGET/sbin/initctl" ]; then + mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" + echo \ +"#!/bin/sh +if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi +echo +echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl" + chmod 755 "$TARGET/sbin/initctl" + fi + + setup_dselect_method apt + + smallyes '' | + (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ + dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING + + baseprog=0 + bases="$(set -- $base; echo $#)" + + info UNPACKBASE "Unpacking the base system..." + + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | + in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + + if [ -n "$base" ]; then + smallyes '' | + (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING + + info CONFBASE "Configuring the base system..." + + smallyes '' | + (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ + dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | + dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + fi + + if [ -x "$TARGET/sbin/initctl.REAL" ]; then + mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl" + fi + mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" + rm -f "$TARGET/usr/sbin/policy-rc.d" + + progress $bases $bases CONFBASE "Configuring base system" + info BASESUCCESS "Base system installed successfully." +} diff --git a/uninstall.sh b/uninstall.sh new file mode 100644 index 0000000..4d35a6e --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,7 @@ +# This file says good-bye to the /usr/ directory. + +mount -o rw,remount / + +umount /usr/ || echo "Warning: Could not unmount /usr/, was it mounted or present in the first place?" > /sdcard/log.txt + +rmdir /usr/ || echo "Warning: /usr/ directory could not be removed, maybe it never existed or mount of / was not possible?" > /sdcard/log.txt