diff options
| author | Mitch Riedstra <mitch@riedstra.us> | 2018-04-23 00:23:36 -0400 |
|---|---|---|
| committer | Mitch Riedstra <mitch@riedstra.us> | 2018-04-23 00:31:02 -0400 |
| commit | 477bfced7fdaa525f9cc7f13afdacb2a48f07379 (patch) | |
| tree | fc1e657add7456e7c791d7729c08e37feae4567e | |
| parent | 42f57801fc0a0842aedbb8d645641710f4877c87 (diff) | |
| download | min-477bfced7fdaa525f9cc7f13afdacb2a48f07379.tar.gz min-477bfced7fdaa525f9cc7f13afdacb2a48f07379.tar.xz | |
Bump to 4.16.3 in /boot/syslinux.cfg
Add `ssh`, `nobody`, and `nogroup`, in `/etc/passwd` and `/etc/group`
Updated the init script to use `mdev`
Added a service definition for a getty on tty0
Added a service definition for sshd
Added busybox udhcpc `default.script` I *still need to check the
license* ( Copied from my Gentoo installation, and works )
Updated readme.md to reflect the fact that we pull in the commands from
`pfx` and you'll need to add `/lib/ld-musl-x86_64.so.1` or change the
PATH in `./inc`
Added rsync, ncdu xz and grub. Removed tar-pfx.sh Replaced with
cpio-pfx.sh
added `conf.sh` which will be taking care of basic system configuration
for now
Change configuration directory for libressl
Enable wide chars in `ncurses`
Use `/etc` for SSH configuration files
Remove make clean from tree.sh and xz.sh
Added relevant files to sources.lst
| -rw-r--r-- | local/boot/syslinux.cfg | 8 | ||||
| -rw-r--r-- | local/etc/group | 3 | ||||
| -rw-r--r-- | local/etc/passwd | 2 | ||||
| -rwxr-xr-x | local/etc/runit/1 | 20 | ||||
| -rwxr-xr-x | local/etc/sv/getty-tty0/run | 4 | ||||
| -rwxr-xr-x | local/etc/sv/sshd/run | 3 | ||||
| -rw-r--r-- | local/usr/share/udhcpc/default.script | 59 | ||||
| -rw-r--r-- | readme.md | 10 | ||||
| -rw-r--r-- | scripts/build.sh | 6 | ||||
| -rw-r--r-- | scripts/conf.sh | 2 | ||||
| -rw-r--r-- | scripts/cpio-pfx.sh | 11 | ||||
| -rw-r--r-- | scripts/grub.sh | 7 | ||||
| -rw-r--r-- | scripts/libarchive.sh | 2 | ||||
| -rw-r--r-- | scripts/libressl.sh | 2 | ||||
| -rw-r--r-- | scripts/ncdu.sh | 21 | ||||
| -rw-r--r-- | scripts/ncurses.sh | 1 | ||||
| -rw-r--r-- | scripts/nginx.sh | 3 | ||||
| -rw-r--r-- | scripts/openssh.sh | 3 | ||||
| -rw-r--r-- | scripts/pv.sh | 2 | ||||
| -rw-r--r-- | scripts/rsync.sh | 21 | ||||
| -rw-r--r-- | scripts/tar-pfx.sh | 18 | ||||
| -rw-r--r-- | scripts/tree.sh | 1 | ||||
| -rw-r--r-- | scripts/xz.sh | 2 | ||||
| -rw-r--r-- | sources.lst | 2 |
24 files changed, 165 insertions, 48 deletions
diff --git a/local/boot/syslinux.cfg b/local/boot/syslinux.cfg index f5ef39c..34fa6ac 100644 --- a/local/boot/syslinux.cfg +++ b/local/boot/syslinux.cfg @@ -4,13 +4,13 @@ TIMEOUT 50 DEFAULT linux-runit LABEL linux-runit - LINUX /boot/vmlinuz-4.16.2 - APPEND root=/dev/vda1 rw init=/sbin/runit-init console=tty0 console=ttyS0,11500n8 + LINUX /boot/vmlinuz-4.16.3 + APPEND root=/dev/vda1 rw init=/sbin/runit-init quiet console=tty0 console=ttyS0,11500n8 LABEL linux-mksh - LINUX /boot/vmlinuz-4.16.2 + LINUX /boot/vmlinuz-4.16.3 APPEND root=/dev/vda1 rw init=/bin/mksh console=tty0 console=ttyS0,11500n8 LABEL linux - LINUX /boot/vmlinuz-4.16.2 + LINUX /boot/vmlinuz-4.16.3 APPEND root=/dev/vda1 rw init=/sbin/init console=tty0 console=ttyS0,11500n8 diff --git a/local/etc/group b/local/etc/group index 18acc30..0146ee7 100644 --- a/local/etc/group +++ b/local/etc/group @@ -1 +1,4 @@ root:x:0:root +ssh:x:22: +nogroup:x:65533: +nobody:x:65534: diff --git a/local/etc/passwd b/local/etc/passwd index 7710014..cf4d7f7 100644 --- a/local/etc/passwd +++ b/local/etc/passwd @@ -1 +1,3 @@ root:x:0:0:root:/root:/bin/mksh +sshd:x:22:22:sshd:/var/empty:/bin/false +nobody:x:65534:65534:nobody:/var/empty:/bin/false diff --git a/local/etc/runit/1 b/local/etc/runit/1 index 671b689..b22c9ef 100755 --- a/local/etc/runit/1 +++ b/local/etc/runit/1 @@ -2,26 +2,26 @@ . /etc/profile -printf "Starting *MIN*imum system\n" +set -x -mkdir -p /dev -mountpoint -q /dev || mount -t devtmpfs dev /dev -o mode=0755,nosuid -mkdir -p /dev/pts -mountpoint -q /dev/pts || mount -n -t devpts devpts /dev/pts -o mode=0620,gid=5,nosuid,noexec,noatime +printf "Starting *MIN*imum system\n" mkdir -p /proc /sys mountpoint -q /proc || mount -t proc proc /proc -o nosuid,noexec,nodev,hidepid=2 mountpoint -q /sys || mount -t sysfs sys /sys -o nosuid,noexec,nodev -mkdir -p /dev/shm -mountpoint -q /dev/shm || mount -n -t tmpfs shm /dev/shm -o mode=1777,nosuid,nodev,noatime +mkdir -p /dev/pts +mountpoint -q /dev/pts || mount -n -t devpts devpts /dev/pts -o \ + mode=0620,gid=5,nosuid,noexec,noatime +mdev -s -# It's going to be interesting to figure out what this one does. -ln -s /proc/self/fd /dev/fd +mkdir -p /dev/shm +mountpoint -q /dev/shm || mount -n -t tmpfs shm /dev/shm -o \ + mode=1777,nosuid,nodev,noatime mountpoint -q /sys/fs/cgroup || mount -n -t cgroup nodev /sys/fs/cgroup printf "Setting up loopback.\n" [ -d /sys/class/net/lo ] && ifconfig lo up - +if [ -e /etc/net ] ; then . /etc/net ; fi diff --git a/local/etc/sv/getty-tty0/run b/local/etc/sv/getty-tty0/run new file mode 100755 index 0000000..4fd121c --- /dev/null +++ b/local/etc/sv/getty-tty0/run @@ -0,0 +1,4 @@ +#!/bin/sh +. /etc/profile + +getty tty0 38400 vt100 diff --git a/local/etc/sv/sshd/run b/local/etc/sv/sshd/run new file mode 100755 index 0000000..8e5081a --- /dev/null +++ b/local/etc/sv/sshd/run @@ -0,0 +1,3 @@ +#!/bin/sh +ssh-keygen -A +/usr/sbin/sshd -D diff --git a/local/usr/share/udhcpc/default.script b/local/usr/share/udhcpc/default.script new file mode 100644 index 0000000..b2fe4a3 --- /dev/null +++ b/local/usr/share/udhcpc/default.script @@ -0,0 +1,59 @@ +#!/bin/sh +# udhcpc script edited by Tim Riker <Tim@Rikers.org> + +RESOLV_CONF="/etc/resolv.conf" + +[ -n "$1" ] || { echo "Error: should be called from udhcpc"; exit 1; } + +NETMASK="" +[ -n "$subnet" ] && NETMASK="netmask $subnet" +BROADCAST="broadcast +" +[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" + +case "$1" in + deconfig) + echo "Setting IP address 0.0.0.0 on $interface" + ifconfig $interface 0.0.0.0 + ;; + + renew|bound) + echo "Setting IP address $ip on $interface" + ifconfig $interface $ip $NETMASK $BROADCAST + + if [ -n "$router" ] ; then + echo "Deleting routers" + while route del default gw 0.0.0.0 dev $interface ; do + : + done + + metric=0 + for i in $router ; do + echo "Adding router $i" + if [ "$subnet" = "255.255.255.255" ]; then + # special case for /32 subnets: + # /32 instructs kernel to always use routing for all outgoing packets + # (they can never be sent to local subnet - there is no local subnet for /32). + # Used in datacenters, avoids the need for private ip-addresses between two hops. + ip route add $i dev $interface + fi + route add default gw $i dev $interface metric $((metric++)) + done + fi + + echo "Recreating $RESOLV_CONF" + # If the file is a symlink somewhere (like /etc/resolv.conf + # pointing to /run/resolv.conf), make sure things work. + realconf=$(readlink -f "$RESOLV_CONF" 2>/dev/null || echo "$RESOLV_CONF") + tmpfile="$realconf-$$" + > "$tmpfile" + [ -n "$domain" ] && echo "search $domain" >> "$tmpfile" + for i in $dns ; do + echo " Adding DNS server $i" + echo "nameserver $i" >> "$tmpfile" + done + mv "$tmpfile" "$realconf" + ;; +esac + +exit 0 + @@ -52,4 +52,12 @@ Run `scripts/get_sources.sh` and then `scripts/build.sh` It's rather important to run them from the `min` directory so the paths and imports will be correct. - sudo ln -sv /s6/min/pfx/usr/lib/libc.so /lib/ld-musl-x86_64.so.1 +Note: + +Because I've not yet been able to make some programs statically linked you +might need a symlink for programs to find `musl` libc, or just switch +the `$PATH` order in `./inc` + +```bash +sudo ln -sv ${base_dir}/pfx/usr/lib/libc.so /lib/ld-musl-x86_64.so.1 +``` diff --git a/scripts/build.sh b/scripts/build.sh index 604af31..92296cf 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -14,7 +14,9 @@ $shell scripts/libressl.sh $shell scripts/openssh.sh $shell scripts/nginx.sh $shell scripts/libarchive.sh +$shell scripts/rsync.sh +$shell scripts/ncdu.sh +$shell scripts/xz.sh $shell scripts/runit.sh $shell scripts/conf.sh -$shell scripts/tar-pfx.sh -# $shell scripts/grub.sh +$shell scripts/grub.sh diff --git a/scripts/conf.sh b/scripts/conf.sh index 568bcdd..385f028 100644 --- a/scripts/conf.sh +++ b/scripts/conf.sh @@ -3,3 +3,5 @@ . ./.vars cp -av local/* $prefix/ +cd $prefix +mkdir -p dev proc sys tmp run var/log var/tmp var/run root diff --git a/scripts/cpio-pfx.sh b/scripts/cpio-pfx.sh new file mode 100644 index 0000000..483b4d9 --- /dev/null +++ b/scripts/cpio-pfx.sh @@ -0,0 +1,11 @@ +#!/bin/sh +. ./.vars + +SZE=$(du -sm $prefix |awk '{print $1}') + + # | cpio -R root:root -do - \ +cd "$prefix" +find . \ + | cpio -v -R root:root -oH newc \ + | pv -s ${SZE}M \ + | xz -T1 -1 -c > $base_dir/pfx.cpio.xz diff --git a/scripts/grub.sh b/scripts/grub.sh index 8c37155..37c8e3c 100644 --- a/scripts/grub.sh +++ b/scripts/grub.sh @@ -7,9 +7,14 @@ if ! [ -d "${build_dir}/grub-$VERSION" ] ; then fi cd "grub-$VERSION" export DESTDIR="$prefix" +export LDFLAGS="-static" +export CFLAGS="-static" +export CPPFLAGS="$CFLAGS" ./configure \ --prefix='/usr' \ + --sysconfdir='/etc' \ + --host=$BUILD_TGT \ --disable-werror # Why in the fuck do I have to add disable -Werror? # Is GRUB really *that* shit? -make -j8 +make -j$(nproc) make install diff --git a/scripts/libarchive.sh b/scripts/libarchive.sh index 6311950..a669b11 100644 --- a/scripts/libarchive.sh +++ b/scripts/libarchive.sh @@ -12,8 +12,6 @@ export CC=$BUILD_TGT-gcc export CFLAGS="-I$prefix/usr/include -static" export DESTDIR=$prefix export LDFLAGS="-L$prefix/usr/lib/ -static" -rm config.log || echo "" -make clean || echo "" ./configure \ --host=$BUILD_TGT \ --prefix=/usr \ diff --git a/scripts/libressl.sh b/scripts/libressl.sh index ed330e0..f5458d7 100644 --- a/scripts/libressl.sh +++ b/scripts/libressl.sh @@ -12,8 +12,8 @@ cd "$BUILD_DIR" export CFLAGS="-static -I$prefix/usr/include" export LDFLAGS="-static -L$prefix/usr/lib" export DESTDIR="$prefix" -make clean || echo "" ./configure --prefix=/usr \ + --sysconfdir=/etc \ --host=$BUILD_TGT \ --with-sysroot=$prefix \ --enable-static=yes diff --git a/scripts/ncdu.sh b/scripts/ncdu.sh new file mode 100644 index 0000000..b8bee9a --- /dev/null +++ b/scripts/ncdu.sh @@ -0,0 +1,21 @@ +#!/bin/sh +. ./.vars +VERSION=1.13 +APP_NAME="ncdu" +BUILD_DIR="${build_dir}/$APP_NAME-$VERSION" +if ! [ -d "$BUILD_DIR" ] ; then + cd "$build_dir" + tar xfzv ${dist_dir}/$APP_NAME-$VERSION.tar.gz +fi +cd "$BUILD_DIR" +export CC=$BUILD_TGT-gcc +export CFLAGS="-I$prefix/usr/include -static" +export CPPFLAGS="$CFLAGS" +export DESTDIR=$prefix +export LDFLAGS="-L$prefix/usr/lib/ -L$prefix/lib -static" +./configure \ + --prefix=/usr \ + --with-local-dir=$prefix/usr \ + --with-ncurses +make -j$(nproc) +make install diff --git a/scripts/ncurses.sh b/scripts/ncurses.sh index 3f12d93..f07783d 100644 --- a/scripts/ncurses.sh +++ b/scripts/ncurses.sh @@ -14,6 +14,7 @@ export DESTDIR="$prefix" ./configure \ --host=$BUILD_TGT \ --prefix=/usr \ + --enable-wide \ --enable-static make -j$(numproc) make install diff --git a/scripts/nginx.sh b/scripts/nginx.sh index 5035a19..de7fb0e 100644 --- a/scripts/nginx.sh +++ b/scripts/nginx.sh @@ -14,7 +14,7 @@ cd "$BUILD_DIR" export CFLAGS="-static -I$prefix/usr/include" export LDFLAGS="-static -L$prefix/usr/lib" export DESTDIR="$prefix" -make clean || echo "" +# make clean || echo "" > /dev/null ./configure --prefix=/usr \ --without-pcre \ --conf-path="/etc/nginx/nginx.conf" \ @@ -30,5 +30,4 @@ sed -e"s/^CC =.*$/CC = ${BUILD_TGT}-gcc/g" \ -e'1aLDFLAGS = -static' \ objs/Makefile.bak > objs/Makefile make -j$(nproc) -# make make install diff --git a/scripts/openssh.sh b/scripts/openssh.sh index ac59fd3..1f1f5b2 100644 --- a/scripts/openssh.sh +++ b/scripts/openssh.sh @@ -10,10 +10,9 @@ cd "$BUILD_DIR" export CFLAGS="-I$prefix/usr/include" export LDFLAGS="-static -L$prefix/usr/lib/" export DESTDIR="$prefix" -rm config.log || echo "" -make clean || echo "" ./configure \ --host=$BUILD_TGT \ + --sysconfdir=/etc \ --prefix=/usr \ --without-openssl cp Makefile Makefile.bak diff --git a/scripts/pv.sh b/scripts/pv.sh index f715dc7..3bdfecb 100644 --- a/scripts/pv.sh +++ b/scripts/pv.sh @@ -12,8 +12,6 @@ export CC=$BUILD_TGT-gcc export CFLAGS="-I$prefix/usr/include -static" export DESTDIR=$prefix export LDFLAGS="-L$prefix/usr/lib/ -static" -rm config.log || echo "" -make clean || echo "" ./configure \ --host=$BUILD_TGT \ --prefix=/usr \ diff --git a/scripts/rsync.sh b/scripts/rsync.sh new file mode 100644 index 0000000..6944e75 --- /dev/null +++ b/scripts/rsync.sh @@ -0,0 +1,21 @@ +#!/bin/sh +. ./.vars +VERSION=3.1.3 +APP_NAME="rsync" +BUILD_DIR="${build_dir}/$APP_NAME-$VERSION" +if ! [ -d "$BUILD_DIR" ] ; then + cd "$build_dir" + tar xfzv ${dist_dir}/$APP_NAME-$VERSION.tar.gz +fi +cd "$BUILD_DIR" +export CC=$BUILD_TGT-gcc +export CFLAGS="-I$prefix/usr/include -static" +export CPPFLAGS="$CFLAGS" +export DESTDIR=$prefix +export LDFLAGS="-L$prefix/usr/lib/ -static" +./configure \ + --host=$BUILD_TGT \ + --prefix=/usr \ + --with-sysroot=$prefix +make -j$(nproc) +make install diff --git a/scripts/tar-pfx.sh b/scripts/tar-pfx.sh deleted file mode 100644 index 2b5a215..0000000 --- a/scripts/tar-pfx.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -. ./.vars - -SZE=$(du -sm $prefix |awk '{print $1}') - - # | cpio -R root:root -do - \ -find $prefix \ - | cpio -v -R root:root -oH newc \ - | pv -s ${SZE}M \ - | xz -T0 -9 -c > pfx.txz - -# bsdtar \ -# --numeric-owner \ -# --owner=root \ -# --group=root \ -# -C pfx \ -# -cvf - . \ -# | xz -9 -T0 -vc > pfx.txz diff --git a/scripts/tree.sh b/scripts/tree.sh index 7f804cf..c3a61f7 100644 --- a/scripts/tree.sh +++ b/scripts/tree.sh @@ -16,6 +16,5 @@ sed -e's/^CC.*$/CC = gcc/g' \ -e"s@^prefix.*\$@prefix = $prefix/usr@g" \ < Makefile.bak > Makefile rm Makefile.bak -make clean || echo "" > /dev/null make make install diff --git a/scripts/xz.sh b/scripts/xz.sh index 079f3e2..9ff33a1 100644 --- a/scripts/xz.sh +++ b/scripts/xz.sh @@ -13,8 +13,6 @@ export CFLAGS="-I$prefix/usr/include -static" export CPPFLAGS="$CFLAGS" export DESTDIR=$prefix export LDFLAGS="-L$prefix/usr/lib/ -static" -rm config.log || echo "" -make clean || echo "" ./configure \ --host=$BUILD_TGT \ --prefix=/usr \ diff --git a/sources.lst b/sources.lst index a666226..993cf97 100644 --- a/sources.lst +++ b/sources.lst @@ -15,3 +15,5 @@ http://libarchive.org/downloads/libarchive-3.3.2.tar.gz http://www.ivarch.com/programs/sources/pv-1.6.6.tar.bz2 https://tukaani.org/xz/xz-5.2.3.tar.xz http://smarden.org/runit/runit-2.1.2.tar.gz +https://dev.yorhel.nl/download/ncdu-1.13.tar.gz +https://download.samba.org/pub/rsync/src/rsync-3.1.3.tar.gz |
