diff --git a/20260607_sid_debootstrap_dpkg-l.txt b/20260607_sid_debootstrap_dpkg-l.txt new file mode 100644 index 0000000..9029544 --- /dev/null +++ b/20260607_sid_debootstrap_dpkg-l.txt @@ -0,0 +1,158 @@ ++-- Desired=Unknown/Install/Remove/Purge/Hold +|+- Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend +||+ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) +||| Name Version Architecture Description ++++-==============================-=========================-============-=================================================================== +ii adduser 3.156 all add and remove users and groups +ii apt 3.3.1 amd64 commandline package manager +ii apt-utils 3.3.1 amd64 package management related utility programs +ii base-files 14.2 amd64 Debian base system miscellaneous files +ii base-passwd 3.6.8 amd64 Debian base system master password and group files +ii bash 5.3-3 amd64 GNU Bourne Again SHell +ii bsdutils 1:2.42.1-2 amd64 basic utilities from 4.4BSD-Lite +ii coreutils 9.10-1 amd64 GNU core utilities +ii cpio 2.15+dfsg-2.1 amd64 GNU cpio -- a program to manage archives of files +ii cron 3.0pl1-209 amd64 process scheduling daemon +ii cron-daemon-common 3.0pl1-209 all process scheduling daemon's configuration files +ii dash 0.5.12-12 amd64 POSIX-compliant shell +ii debconf 1.5.92 all Debian configuration management system +ii debconf-i18n 1.5.92 all full internationalization support for debconf +ii debian-archive-keyring 2025.1 all OpenPGP archive certificates of the Debian archive +ii debianutils 5.23.2 amd64 Miscellaneous utilities specific to Debian +ii dhcpcd-base 1:10.3.2-3 amd64 DHCPv4 and DHCPv6 dual-stack client (binaries and exit hooks) +ii diffutils 1:3.12-1 amd64 File comparison utilities +ii dmidecode 3.7-1 amd64 SMBIOS/DMI table decoder +ii dpkg 1.23.7 amd64 Debian package management system +ii e2fsprogs 1.47.4-1 amd64 ext2/ext3/ext4 file system utilities +ii fdisk 2.42.1-2 amd64 collection of partitioning utilities +ii findutils 4.10.0-4 amd64 utilities for finding files--find, xargs +ii gcc-16-base:amd64 16.1.0-1 amd64 GCC, the GNU Compiler Collection (base package) +ii grep 3.12-1 amd64 GNU grep, egrep and fgrep +ii gzip 1.13-1 amd64 GNU compression utilities +ii hostname 3.25 amd64 utility to set/show the host name or domain name +ii ifupdown 0.8.45 amd64 high level tools to configure network interfaces +ii init 1.69 amd64 metapackage ensuring an init system is installed +ii init-system-helpers 1.69 all helper tools for all init systems +ii iproute2 7.0.0-1 amd64 networking and traffic control tools +ii iputils-ping 3:20250605-1 amd64 Tools to test the reachability of network hosts +ii kmod 34.2-2+b2 amd64 tools for managing Linux kernel modules +ii less 668-1 amd64 pager program similar to more +ii libacl1:amd64 2.3.2-3 amd64 access control list - shared library +ii libapt-pkg7.0:amd64 3.3.1 amd64 package management runtime library +ii libattr1:amd64 1:2.5.2-4 amd64 extended attribute handling - shared library +ii libaudit-common 1:4.1.2-1 all Dynamic library for security auditing - common files +ii libaudit1:amd64 1:4.1.2-1+b1 amd64 Dynamic library for security auditing +ii libblkid1:amd64 2.42.1-2 amd64 block device ID library +ii libbpf1:amd64 1:1.7.0-1 amd64 eBPF helper library (shared library) +ii libbrotli1:amd64 1.2.0-3 amd64 library implementing brotli encoder and decoder (shared libraries) +ii libbsd0:amd64 0.12.2-3 amd64 utility functions from BSD systems - shared library +ii libbz2-1.0:amd64 1.0.8-6+b2 amd64 high-quality block-sorting file compressor library - runtime +ii libc-bin 2.42-16 amd64 GNU C Library: Binaries +ii libc-gconv-modules-extra:amd64 2.42-16 amd64 GNU C Library: Non-essential gconv modules +ii libc6:amd64 2.42-16 amd64 GNU C Library: Shared libraries +ii libcap-ng0:amd64 0.9.3-1 amd64 alternate POSIX capabilities library +ii libcap2:amd64 1:2.78-1 amd64 POSIX 1003.1e capabilities (library) +ii libcap2-bin 1:2.78-1 amd64 POSIX 1003.1e capabilities (utilities) +ii libcom-err2:amd64 1.47.4-1 amd64 common error description library +ii libcrypt1:amd64 1:4.5.1-1+b1 amd64 libcrypt shared library +ii libcurl4t64:amd64 8.20.0-5 amd64 easy-to-use client-side URL transfer library (OpenSSL flavour) +ii libdb5.3t64:amd64 5.3.28+dfsg2-11+b1 amd64 Berkeley v5.3 Database Libraries [runtime] +ii libdebconfclient0:amd64 0.283 amd64 Debian Configuration Management System (C-implementation library) +ii libedit2:amd64 3.1-20260512-1 amd64 BSD editline and history libraries +ii libelf1t64:amd64 0.195-1 amd64 library to read and write ELF files +ii libext2fs2t64:amd64 1.47.4-1 amd64 ext2/ext3/ext4 file system libraries +ii libfdisk1:amd64 2.42.1-2 amd64 fdisk partitioning library +ii libgcc-s1:amd64 16.1.0-1 amd64 GCC support library +ii libgmp10:amd64 2:6.3.0+dfsg-5+b2 amd64 Multiprecision arithmetic library +ii libgssapi-krb5-2:amd64 1.22.1-2.1 amd64 MIT Kerberos runtime libraries - krb5 GSS-API Mechanism +ii libhogweed6t64:amd64 3.10.2-1+b1 amd64 low level cryptographic library (public-key cryptos) +ii libidn2-0:amd64 2.3.8-5 amd64 Internationalized domain names (IDNA2008/TR46) library +ii libjansson4:amd64 2.14-2+b4 amd64 C library for encoding, decoding and manipulating JSON data +ii libk5crypto3:amd64 1.22.1-2.1 amd64 MIT Kerberos runtime libraries - Crypto Library +ii libkeyutils1:amd64 1.6.3-6+b2 amd64 Linux Key Management Utilities (library) +ii libkmod2:amd64 34.2-2+b2 amd64 libkmod shared library +ii libkrb5-3:amd64 1.22.1-2.1 amd64 MIT Kerberos runtime libraries +ii libkrb5support0:amd64 1.22.1-2.1 amd64 MIT Kerberos runtime libraries - Support library +ii libldap2:amd64 2.6.10+dfsg-1+b2 amd64 OpenLDAP libraries +ii liblocale-gettext-perl 1.07-10 amd64 module using libc functions for internationalization in Perl +ii liblz4-1:amd64 1.10.0-10 amd64 Fast LZ compression algorithm library - runtime +ii liblzma5:amd64 5.8.3-1 amd64 XZ-format compression library +ii libmd0:amd64 1.2.0-2 amd64 message digest functions from BSD systems - shared library +ii libmnl0:amd64 1.0.5-3+b2 amd64 minimalistic Netlink communication library +ii libmount1:amd64 2.42.1-2 amd64 device mounting library +ii libncursesw6:amd64 6.6+20251231-1+b1 amd64 shared libraries for terminal handling (wide character support) +ii libnettle8t64:amd64 3.10.2-1+b1 amd64 low level cryptographic library (symmetric and one-way cryptos) +ii libnewt0.52:amd64 0.52.25-2 amd64 Not Erik's Windowing Toolkit - text mode windowing with slang +ii libnftables1:amd64 1.1.6-1+b1 amd64 Netfilter nftables high level userspace API library +ii libnftnl11:amd64 1.3.1-1+b1 amd64 Netfilter nftables userspace API library +ii libnghttp2-14:amd64 1.69.0-1 amd64 library implementing HTTP/2 protocol (shared library) +ii libnghttp3-9:amd64 1.15.0-1 amd64 HTTP/3 mapping over QUIC and QPACK (library) +ii libngtcp2-16:amd64 1.22.1-1 amd64 QUIC protocol library +ii libngtcp2-crypto-ossl0:amd64 1.22.1-1 amd64 crypto helper library for with OpenSSL backend +ii libpam-modules:amd64 1.7.0-5+b2 amd64 Pluggable Authentication Modules for PAM +ii libpam-modules-bin 1.7.0-5+b2 amd64 Pluggable Authentication Modules for PAM - helper binaries +ii libpam-runtime 1.7.0-5 all Runtime support for the PAM library +ii libpam0g:amd64 1.7.0-5+b2 amd64 Pluggable Authentication Modules library +ii libpcre2-8-0:amd64 10.46-1+b2 amd64 New Perl Compatible Regular Expression Library- 8 bit runtime files +ii libpopt0:amd64 1.19+dfsg-2+b2 amd64 lib for parsing cmdline parameters +ii libproc2-0:amd64 2:4.0.4-9+b2 amd64 library for accessing process information from /proc +ii libpsl5t64:amd64 0.21.5-1 amd64 Library for Public Suffix List (shared libraries) +ii libreadline8t64:amd64 8.3-4 amd64 GNU readline and history libraries, run-time libraries +ii libsasl2-2:amd64 2.1.28+dfsg1-11 amd64 Cyrus SASL - authentication abstraction library +ii libsasl2-modules-db:amd64 2.1.28+dfsg1-11 amd64 Cyrus SASL - pluggable authentication modules (DB) +ii libseccomp2:amd64 2.6.0-2+b1 amd64 high level interface to Linux seccomp filter +ii libselinux1:amd64 3.10-1 amd64 SELinux runtime shared libraries +ii libsemanage-common 3.10-1 all Common files for SELinux policy management libraries +ii libsemanage2:amd64 3.10-1 amd64 SELinux policy management library +ii libsepol2:amd64 3.10-1 amd64 SELinux library for manipulating binary security policies +ii libslang2:amd64 2.3.3-6 amd64 S-Lang programming library - runtime version +ii libsmartcols1:amd64 2.42.1-2 amd64 smart column output alignment library +ii libss2:amd64 1.47.4-1 amd64 command-line interface parsing library +ii libssh2-1t64:amd64 1.11.1-3 amd64 SSH2 client-side library +ii libssl3t64:amd64 3.6.2-1 amd64 Secure Sockets Layer toolkit - shared libraries +ii libstdc++6:amd64 16.1.0-1 amd64 GNU Standard C++ Library v3 +ii libsystemd-shared:amd64 261~rc3-1 amd64 systemd shared private library +ii libsystemd0:amd64 261~rc3-1 amd64 systemd utility library +ii libtext-charwidth-perl:amd64 0.04-12 amd64 get display widths of characters on the terminal +ii libtext-iconv-perl:amd64 1.7-9 amd64 module to convert between character sets in Perl +ii libtext-wrapi18n-perl 0.06-11 all internationalized substitute of Text::Wrap +ii libtinfo6:amd64 6.6+20251231-1+b1 amd64 shared low-level terminfo library for terminal handling +ii libtirpc-common 1.3.7+ds-1 all transport-independent RPC library - common files +ii libtirpc3t64:amd64 1.3.7+ds-1 amd64 transport-independent RPC library +ii libudev1:amd64 261~rc3-1 amd64 libudev shared library +ii libunistring5:amd64 1.4.2-1 amd64 Unicode string library for C +ii libuuid1:amd64 2.42.1-2 amd64 Universally Unique ID library +ii libxtables12:amd64 1.8.13-1 amd64 netfilter xtables library +ii libxxhash0:amd64 0.8.3-2+b2 amd64 shared library for xxhash +ii libzstd1:amd64 1.5.7+dfsg-3+b2 amd64 fast lossless compression algorithm +ii linux-sysctl-defaults 4.15 all default sysctl configuration for Linux +ii login 1:4.16.0-2+really2.42.1-2 amd64 system login tools +ii login.defs 1:4.19.3-2 all system user management configuration +ii logrotate 3.22.0-1 amd64 Log rotation utility +ii logsave 1.47.4-1 amd64 save the output of a command in a log file +ii mawk 1.3.4.20260302-1 amd64 Pattern scanning and text processing language +ii mount 2.42.1-2 amd64 tools for mounting and manipulating filesystems +ii nano 9.0-1 amd64 small, friendly text editor inspired by Pico +ii ncurses-base 6.6+20251231-1 all basic terminal type definitions +ii ncurses-bin 6.6+20251231-1+b1 amd64 terminal-related programs and man pages +ii netbase 6.5 all Basic TCP/IP networking system +ii nftables 1.1.6-1+b1 amd64 Program to control packet filtering rules by Netfilter project +ii openssl-provider-legacy 3.6.2-1 amd64 Secure Sockets Layer toolkit - cryptographic utility +ii passwd 1:4.19.3-2 amd64 change and administer password and group data +ii perl-base 5.40.1-8 amd64 minimal Perl system +ii procps 2:4.0.4-9+b2 amd64 /proc file system utilities +ii readline-common 8.3-4 all GNU readline and history libraries, common files +ii sed 4.9-3 amd64 GNU stream editor for filtering/transforming text +ii sensible-utils 0.0.26 all Utilities for sensible alternative selection +ii sqv 1.3.0-5+b2 amd64 OpenPGP signature verification program from Sequoia +ii systemd 261~rc3-1 amd64 system and service manager +ii systemd-sysv 261~rc3-1 amd64 system and service manager - SysV compatibility symlinks +ii sysvinit-utils 3.18-1 amd64 System-V-like utilities +ii tar 1.35+dfsg-4 amd64 GNU version of the tar archiving utility +ii tzdata 2026b-1 all time zone and daylight-saving time data +ii udev 261~rc3-1 amd64 /dev/ and hotplug management daemon +ii util-linux 2.42.1-2 amd64 miscellaneous system utilities +ii vim-common 2:9.2.0524-1 all Vi IMproved - Common files +ii vim-tiny 2:9.2.0524-1 amd64 Vi IMproved - enhanced vi editor - compact version +ii whiptail 0.52.25-2 amd64 Displays user-friendly dialog boxes from shell scripts +ii zlib1g:amd64 1:1.3.dfsg+really1.3.2-3 amd64 compression library - runtime diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..8628d69 --- /dev/null +++ b/build.sh @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +if [ "$(whoami)" != "sid" ] +then + echo "Please execute this script as user sid" + exit 1 +fi + +cat > "/tmp/$(whoami)_sudo" << EOF +$(whoami) ALL = NOPASSWD: /usr/bin/chown * /mnt/$(whoami)* +$(whoami) ALL = NOPASSWD: /usr/bin/mount * /mnt/$(whoami)* +$(whoami) ALL = NOPASSWD: /usr/sbin/chroot /mnt/$(whoami)* +$(whoami) ALL = NOPASSWD: /usr/sbin/debootstrap * /mnt/$(whoami)* +EOF + +add_sid_user() +{ + echo "# useradd $(whoami)" + echo "# passwd $(whoami)" + echo "And add sudo rights" + echo "# cp /tmp/$(whoami)_sudo /etc/sudoers.d/$(whoami)" +} + +if [ "$(whoami)" != "sid" ] +then + echo "Please execute this script as user sid" + grep -q sid /etc/passwd || add_sid_user + exit 1 +fi + +target=/mnt/$(whoami) + +if ! grep "${target} ext" /etc/mtab +then + echo "Error : mount partition under ${target}" + exit 1 +fi + +if ! dpkg -l | grep "^ii debootstrap" +then + echo "Error: install debootstrap" +fi + +if [ ! -d "${target}/debootstrap" ] +then + if ! sudo /usr/sbin/debootstrap sid "${target}" http://deb.debian.org/debian/ + then + echo "Error: please check" + fi +fi + +if [ ! -e mount_chroot.sh ] +then + echo "mount_chroot.sh absent" + echo "link it here" + exit 1 +fi + +# shellcheck source=/dev/null +source mount_chroot.sh "${target}" + +echo "--- Creating the ${target}/etc/ Files" +if ! grep " / " "${target}"/etc/fstab +then + echo "--- Creating /etc/fstab" + FSTAB=${target}/tmp/fstab + if [ -e "${FSTAB}" ] + then + rm "${FSTAB}" + fi + blockdevice="$(mount |grep "${target} type ext4" |cut --delimiter=' ' --fields=1 |cut --delimiter='/' --fields=3)" + for link in /dev/disk/by-uuid/* + do + case $(readlink "${link}") in + *${blockdevice}) + blockuuid=$(basename "${link}") + if [[ ! "${blockuuid}" =~ ^[a-zA-Z0-9-]+$ ]] + then + echo "Can't init /etc/fstab" + echo "Fix it by ourself" + exit 1 + else + cat > "${FSTAB}" << EOSF +UUID=${blockuuid} / ext4 defaults 0 0 +EOSF + fi + ;; + *) + continue + ;; + esac + done + if [ ! -e "${FSTAB}" ] + then + echo "Can't init /etc/fstab" + echo "Fix it by ourself" + exit 1 + fi + swapuuid=$(lsblk --output UUID,MOUNTPOINTS |grep SWAP |head -1 |cut --delimiter=' ' --fields=1) + if [[ "${blockuuid}" =~ ^[a-zA-Z0-9-]+$ ]] + then + cat >> "${FSTAB}" << EOSF +UUID=${swapuuid} none swap sw 0 0 +EOSF + echo "The first swap partition found of the host was written in /etc/fstab" + echo "Fix it of you have/want another swap" + else + echo "Can't init swap /etc/fstab" + echo "Fix it by ourself" + exit 1 + fi + echo "--- Creating /etc/adjtime" + cp --verbose /etc/adjtime "${target}"/tmp/adjtime + echo "--- Creating /etc/network/interfaces.d/lo.conf" + cat > "${target}"/tmp/lo.conf <<"EOSF" +# The loopback network interface +auto lo +iface lo inet loopback +EOSF + echo "--- Creating /etc/network/interfaces.d/eno1.conf" + cat > "${target}"/tmp/eno1.conf <<"EOSF" +auto eno1 +iface eno1 inet dhcp +EOSF + echo "--- Creating /etc/resolv.conf" + cp --verbose /etc/resolv.conf "${target}"/tmp/resolv.conf + echo "--- Creating /etc/hostname" + cp --verbose /etc/hostname "${target}"/tmp/hostname + echo "--- Creating /etc/hosts" + cp --verbose /etc/hosts "${target}"/tmp/hosts + echo "--- Creating /etc/locale.conf" + cp --verbose /etc/locale.conf "${target}"/tmp/locale.conf + echo "--- Creating /etc/default/keyboard" + cp --verbose /etc/default/keyboard "${target}"/tmp/keyboard + echo "--- Creating sudofile executable" + sudofile=/tmp/mnt_$(whoami)_etc_files.sh + cat > "${sudofile}" << "EOSF" +cp --verbose /tmp/fstab /etc/fstab +cp --verbose /tmp/adjtime /etc/adjtime +cp --verbose /tmp/lo.conf /etc/network/interfaces.d/lo.conf +cp --verbose /tmp/eno1.conf /etc/network/interfaces.d/eno1.conf +cp --verbose /tmp/resolv.conf /etc/resolv.conf +cp --verbose /tmp/hostname /etc/hostname +cp --verbose /tmp/hosts /etc/hosts +cp --verbose /tmp/locale.conf /etc/locate.conf +cp --verbose /tmp/keyboard /etc/default/keyboard +apt update +echo "root:$(basename $(ls -1 /etc/s*w))" | chpasswd +apt --yes install linux-image-amd64 ssh +apt --yes install locales console-setup +EOSF + echo "bash mount_chroot.sh ${target} ${sudofile}" + if ! bash mount_chroot.sh "${target}" "${sudofile}" + then + echo "Configuration error" + exit 1 + fi + + +fi \ No newline at end of file