main
setup-rootfs
1#!/bin/sh -eu
2. ./util/lib.sh # source functions
3
4printf "$0 assumes you have your root parition mounted at ${m}!\n"
5printf "$0 will remove all files from ${m}!\n"
6set -x
7
8rm -rf $m/*
9wget \
10 https://codeberg.org/kiss-community/repo/releases/download/24.12.18/kiss-chroot-24.12.18.tar.xz \
11 -O kiss.tar.xz
12
13tar -xf kiss.tar.xz -C $m
14
15# set up situation init
16git clone https://srcdump.net/chld/srudge.git --depth 1 ./srudge
17cp ./srudge/sit $m/bin/sit
18cp ./srudge/reboot $m/bin/reboot-sit
19for i in sit reboot
20do
21 chmod 755 $m/bin/$i
22done
23rm -rf ./srudge/
24
25# mwakatizing the rootfs
26rm -f $m/etc/*tab # situation doesnt use tables, it is not sysv-ish
27rm -f $m/etc/issue
28
29rm -f $m/etc/os-release
30cp ./rootfs/os-release $m/etc/os-release
31
32rm -f $m/etc/mdev.conf # change later?
33
34# unlink /sbin due to udevadm errors
35unlink $m/sbin
36
37# further remove traces of KISS
38rm -rf $m/root/*
39rm -rf $m/usr/share/doc
40
41# copy KISS no-perl.patch for the linux kernel
42mkdir -p $m/usr
43mkdir $m/usr/src
44cp ./rootfs/no-perl.patch $m/usr/src/no-perl.patch
45
46# enter apk to fix symlink errors
47wget \
48 https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.6/x86_64/apk.static \
49 -O $m/bin/apk # static apk ez
50
51chmod 755 $m/bin/apk # executable apk
52$m/bin/apk --arch $(arch) -X https://dl-cdn.alpinelinux.org/alpine/latest-stable/main/ -U --allow-untrusted --root $m/ --initdb add alpine-keys
53
54# add apk repositories
55mkdir -p $m/etc/
56mkdir -p $m/etc/apk
57printf "https://dl-cdn.alpinelinux.org/alpine/latest-stable/main\nhttps://dl-cdn.alpinelinux.org/alpine/latest-stable/community\n" > $m/etc/apk/repositories
58ls $m/lib/apk
59ls $m/lib/apk/db
60
61$m/bin/apk --root $m --allow-untrusted add busybox
62
63# remove all except: kiss, musl, curl
64# kiss will be removed after bootstrapping apk
65
66sh ./util/kiss-mount $m
67
68_inc '
69 rm -f /var/db/kiss/installed/kiss/depends
70 kiss r b3sum git linux-headers
71 kiss r libmpc gmp mpfr gcc
72 kiss r binutils bison m4 flex pigz xz make
73 kiss r baselayout
74 kiss r curl zlib
75'
76
77ls $m/var/db/kiss/installed # wooh
78
79# now, lets remove all traces of KISS from the rootfs
80rm -rf $m/var/db/kiss/
81rm -rf $m/bin/kiss-* $m/bin/kiss