summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2018-02-24 14:05:29 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2018-02-24 14:05:29 +0100
commit5af74548e741eab8fcf156f56850a5639043abac (patch)
tree4b1c2a3679b589d5b99bb831a48244e8e488cb08
parent428aebe60e7dd5664c53e9efb8cf2368397211b0 (diff)
downloadbootstrap32-5af74548e741eab8fcf156f56850a5639043abac.tar.xz
building all but syslinux, gcc and glibc
-rw-r--r--.Attic/README.old_stage2291
-rw-r--r--README3
-rw-r--r--TODOS5
-rwxr-xr-xbuild_stage2.sh16
-rwxr-xr-xbuild_stage2_package.sh8
-rw-r--r--i486-stage1/syslinux/DESCR6
-rw-r--r--i486-stage2/gdb/DESCR9
-rw-r--r--i486-stage2/iproute2/DESCR2
-rw-r--r--i486-stage2/iptables/DESCR13
-rw-r--r--i486-stage2/libunwind/DESCR2
-rw-r--r--i486-stage2/make/DESCR3
-rw-r--r--i486-stage2/nasm/DESCR8
-rw-r--r--i486-stage2/openssh/DESCR9
-rw-r--r--i486-stage2/syslinux/DESCR18
-rw-r--r--i486-stage2/syslinux/syslinux-6.03-precomputed-python-menues.patch1032
-rw-r--r--i486-stage2/uinit/DESCR3
16 files changed, 1127 insertions, 301 deletions
diff --git a/.Attic/README.old_stage2 b/.Attic/README.old_stage2
index 2c67933..5b3becf 100644
--- a/.Attic/README.old_stage2
+++ b/.Attic/README.old_stage2
@@ -1,28 +1,9 @@
# old stage 2 based on a broken stage 1, so carefull what to pick
# into the next version..
-
-# generic build
-###############
-
-for p in $PACKAGES
-
- # for ncurses, readline for bash
- # autoreconf needs autotools/m4 and dependencies (crosstool-ng autotools are broken for me)
- # libunistring for gettext
- # libffi for glib2
- bsdtar xf $STAGE1_CHROOT/packages/i486/libffi-3.2.1-2-i486.pkg.tar.gz
- popd
-
- cd ..
-done
-
-testing:
-
# common issues
###############
-
TODOS: in linux package makepkg
https://github.com/libarchive/libarchive/issues/411
@@ -46,174 +27,6 @@ qemu-system-i386 --enable-kvm -cpu 486 -m 32 \
PHASE 2
#######
-Test what we can build inside the chroot.
-When we get all dependencies right, we go into the real environment (which is
-i486 and thus not SMP and slow- ok, we could use distcc, but anyway)
-
-Main problem: we have trouble to run fakeroot in a chroot
-fakeroot: nested operation not yet supported
-makepkf -F takes care of that (thanks for providing minial fakeroot support)
-but pacman also takes an -F parameter
--> INFAKEROOT=1 in /usr/bin/makepkg
-
-As pacman seems to have some trouble, we overwrite the temp packages inside
-the chroot and replace the files on the filesystem forcefully:
-error: could not register 'temp' database (wrong or NULL argument passed)
-
-In this round don't skip dependencies and tests if possible.
-
-cp pkg/arch-install-scripts/usr/bin/arch-chroot /usr/local/bin/.
-
-arch-chroot /home/cross/i486-root/
-
-# package specific things
-
-# bc
-# requires texinfo, is this part of base-devel?
-# bootstrap --force
-# no /usr/lib32
-# ./fbc -c ./libmath.b </dev/null >libmath.h
-
-#
-# libxml2
-# go without icu for now, icu needs C++
-# also, python bindings and git are not really needed
-sed -i 's@^depends\(.*\)@#depends\1@g' libxml2/PKGBUILD
-sed -i 's@^makedepends\(.*\)@#makedepends\1@g' libxml2/PKGBUILD
-build()
-{
- sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0 /g' libtool
- make
-}
-sed -i 's@--with-icu@@' libxml2/PKGBUILD
-# dito package
-# really, what is it with people!
-# take: ftp://xmlsoft.org/libxml2/libxml2-2.9.7.tar.gz
-#source=(git+https://git.gnome.org/browse/libxml2#commit=$_commit
-# no tests, c++ tests would fail
-./configure: line 13042: syntax error near unexpected token `Z,zlib,'
-./configure: line 13042: ` PKG_CHECK_MODULES(Z,zlib,'
-==> ERROR: A failure occurred in build().
- Aborting...
--> zlib probing needs pkg-config, which is it's own disaster, so disable
-zlib for now.
-=> hack out the broken PKG_CHECK_MODULES out of configure!
--> same trick for LZMA (equally broken) and ICU
--> disable testing for now, either it takes long or it hangs
-
-# libgcrypt
-# download location broken, download by hand, adapt PKGBUILD
-
-# libxslt: same disaster as libxml2
-# no python, no check
-
-# kmod: circular dependency on linux-headers, let's build
-# linux/linux-headers correctly outside the chroot and install
-# them here (at least linux-headers)
-# gtk-doc draws in Gnome bullshit again
-sed -i 's@^makedepends\(.*\)@#makedepends\1@g' kmod/PKGBUILD
-
-# inetutils:
-# disable checks
-
-# iroute2
-# trying with iptables, as iptables draws in tons of things
-sed -i 's@^makedepends\(.*\)@#makedepends\1@g' iproute2/PKGBUILD
-sed -i 's@^depends\(.*\)@#depends\1@g' iproute2/PKGBUILD
-
-# bison
-# --nocheck: fails miserably to compile tests (C++ missing?)
-
-# linux-headers: fails hapilly and has tons of weird stuff in it
-install: failed to access ‘/home/cross/build/linux/pkg/linux-headers/usr/lib/modules/4.13.13-1/build’: No such file or directory
-_package-headers()
-=> mkdir -p "${_builddir}" everywhere, the problem is install -D on Centos, obviously broken!
-
-# kmod
-configure: error: The pkg-config script could not be found or is too old. Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-Alternatively, you may set the environment variables liblzma_CFLAGS
-and liblzma_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See `config.log' for more details
-==> ERROR: A failure occurred in build().
- Aborting...
-=> let's try to set lzma ourselves or disable it, get around pkg-config probing
-# no pkg-config, no docu, try to work around
-sed -i 's@--enable-gtk-doc@--disable-gtk-doc@g' kmod/PKGBUILD
-sed -i 's@./configure@liblzma_CFLAGS=-I/usr/include liblzma_LIBS=-llzma ./configure@g' kmod/PKGBUILD
-sed -i 's@./configure@zlib_CFLAGS=-I/usr/include zlib_LIBS=-lz ./configure@g' kmod/PKGBUILD
-=> ok heck: linking errors
-sed -i 's@--with-xz@--without-xz@g' kmod/PKGBUILD
-sed -i 's@--with-zlib@--without-zlib@g' kmod/PKGBUILD
-
-# libidn
-# --nocheck, testing hangs
-
-# iputils
-# remove git again
-# no docu, hack out manually
-sed -i 's@^makedepends\(.*\)@#makedepends\1@g' iptuils/PKGBUILD
-
-# perl-error
-# no checks, needs perl test-pod
-sed -i 's@^checkdepends\(.*\)@#checkdepends\1@g' perl-error/PKGBUILD
-
-
-# shadow
-# git treatment again.
-# no docu
-# --disable-man
-
-# tar:
-# checking whether mknod can create fifo without root privileges... configure: error: in `/build/tar/src/tar-1.29':
-# configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
-# See `config.log' for more details
-=> oh, please, bugger off!
-sed -i 's@./configure@FORCE_UNSAFE_CONFIGURE=1 ./configure@g' tar/PKGBUILD
-
-#TODO:
-
-#TODO: libldap keyutils krb5 they end in circlejerk with systemd!
-# we will solve that later by building a non-systemd version and then bootstrapping first systemd
-
-# for now we don't rebuild ca-certificates, we had to copy them funilly anyway, and it's
-# just a bunch of certs. So, in phase 3 or 4 then..
-
-# gmp
-#####
-# no C++
-sed -i 's@--enable-cxx@--disable-cxx@g' gmp/PKGBUILD
-
-# gawk
-######
-# we don't have a valid locale yet, disable NLS
-# and disable testing
-sed -i 's@./configure@./configure --disable-nls@g' PKGBUILD
-
-# openssh
-#########
-# package suffers from featuritis
-# remove ldns and kerberos5 support, keep libedit (as it's easy to build)
-# ssh => not good, openssl <> unbound <> openssl cycle and mess
-sed -i 's@^makedepends\(.*\)@#makedepends\1@g' PKGBUILD
-sed -i 's@^depends\(.*\)@#depends\1@g' PKGBUILD
-sed -i 's@--with-ldns@--without-ldns@g' PKGBUILD
-sed -i 's@--with-kerberos5=/usr@--without-kerberos5@g' PKGBUILD
-#ln: failed to create symbolic link '/build/openssh/pkg/openssh/usr/share/man/man1/slogin.1.gz': No such file or directory
-sed -i 's@\(ln -sf ssh.1.gz.*\)@#\1@g' PKGBUILD
-
-# git
-#####
-# manual PKGBUILD fix
-#make: pkg-config: Command not found
-#make: pkg-config: Command not found
-#make: Leaving directory '/build/git/src/git-2.15.0/contrib/subtree'
-
# tcl
#####
# disable tests: cynical, disable unit tests of a software needed for testing
@@ -226,31 +39,6 @@ sed -i '/configure.ac/ a \ sed -i "s@\\(unit_SOURCES.*\\)@#\\1@g" Makefile.am'
sed -i '/configure.ac/ a \ sed -i "s@\\(check_PROGRAMS*\\)@#\\1@g" Makefile.am' dejagnu/PKGBUILD
sed -i '/Makefile.am/ a \ autoreconf' dejagnu/PKGBUILD
-# wget
-######
-# no gnutls, no libpsl
-sed -i 's@^depends\(.*\)@#depends\1@g' PKGBUILD
-sed -i 's@--enable-nls@--disable-nls@g' PKGBUILD
-sed -i 's@--with-ssl=gnutls@--with-ssl=openssl@g' PKGBUILD
-sed -i '/.\/configure/ a \ --without-libpsl \\' PKGBUILD
-# work around pkg-config
-sed -i 's@./configure@OPENSSL_CFLAGS=-I/usr/include OPENSSL_LIBS="-lssl lcrypto" ./configure@g' PKGBUILD
-# needs myriads of perl modules for testing => --nocheck
-sed -i 's@^checkdepends\(.*\)@#checkdepends\1@g' PKGBUILD
-
-# binutils
-##########
-# risky, risky
-sed -i 's/glibc>=2.26/glib/g' binutils/PKGBUILD
-# this is in gold, so let's disable gold! We don't have C++ (yet), so this should not matter..
-sed -i 's@--enable-gold@--disable-gold@g' binutils/PKGBUILD
-
-# libunwind
-###########
-# no TeX, no docu
-sed -i 's@^makedepends\(.*\)@#makedepends\1@g' libunwind/PKGBUILD
-
-
# TODO: gcc
#####
TODO:
@@ -291,10 +79,6 @@ make: *** i486-pc-linux-gnu/libgo: No such file or directory. Stop.
=> fails, oh well, nobody needs go :-)
-
-only c language
-no checkdepdns, makedepnds
-
why the hell, I switched off c++, so wy are still cpp probes being done!?
/lib/cpp hardcoded, seriosly!!
# in prepare()
@@ -444,52 +228,10 @@ https://git.busybox.net/buildroot/diff/package/glibc/0005-fix-binutils-2-29-buil
make[2]: *** [../o-iterator.mk:9: /build/glibc/src/glibc-build/misc/regexp.os] Error 1
PACKAGES=" \
-libxml2 libgpg-error libgcrypt libxslt \
-docbook-xml docbook-xsl xmlto libcap inetutils bison iproute2 kmod \
+libgpg-error \
+ \
sysfsutils libidn iputils \
-libedit openssh libunwind strace wget \
-gmp mpfr gawk libmpc tcl expect dejagnu binutils gcc libtool glibc"
-for p in $PACKAGES; do
- asp export $p
-done
-
-for p in $PACKAGES
- cd $p
-
- sed -i "s/^arch=.*/arch=('i486')/" PKGBUILD
-
- # for some packages we cannot execute tests (because the dependencies to install in
- # the toolchain environment would be too much)
- # libtool: --nocheck
- # libxml2: --nocheck
- # libxslt: --nocheck
- # inetutils: --nocheck
- # bison: --nocheck
- # gawk: --nocheck
- # tcl: --nocheck
-
- makepkg -C --config /etc/makepkg.conf --skipchecksums --skippgpcheck > $p.log 2>&1
-
- # TODO:
- # some package break in parallel builds or produce really funky
- # error messages or/and results
- # binutils: use makepkg-noparallel.conf
- # gcc: use makepkg-noparallel.conf for debuging, the real build works fine in parallel
-
- cp -v *.pkg.tar.gz /packages/i486/.
-
- pacman --noconfirm --config /etc/pacman-i486.conf -U *.pkg.tar.gz
-
- # replace all pacman articats and clean caches
- rm -rf /packages/i486/temp* /var/cache/pacman/pkg/*
- repo-add /packages/i486/temp.db.tar.gz /packages/i486/*pkg.tar.gz
-
- #repo-add -n /packages/i486/temp.db.tar.gz /packages/i486/*pkg.tar.gz
-
- pacman --noconfirm --config /etc/pacman-i486.conf -r / -S $p
-
- pacman --config /etc/pacman-i486.conf -r / -Q | grep $p
-done
+ tcl expect dejagnu gcc glibc"
# aftermatch for gcc/binutils
@@ -506,30 +248,6 @@ etc.
# bacause pacman cannot set file permissions
chmod u+x /usr/bin/* /lib/*.so*
-# kernel headers:
-#/usr/include/linux/errno.h missing
-#/usr/include/adm/errno.h missing
-=> a libarchive compression issue, files missing, because they are in pkg of
- linux-api-headers?!
-
-remove debug packages
-
-error: failed to commit transaction (conflicting files)
-/usr/lib/libstdc++.a exists in both 'gcc-libs' and 'gcc'
-/usr/lib/libstdc++.la exists in both 'gcc-libs' and 'gcc'
-/usr/lib/libblkid.a exists in both 'util-linux' and 'libutil-linux'
-/usr/lib/libblkid.la exists in both 'util-linux' and 'libutil-linux'
-/usr/lib/libfdisk.a exists in both 'util-linux' and 'libutil-linux'
-/usr/lib/libfdisk.la exists in both 'util-linux' and 'libutil-linux'
-/usr/lib/libmount.a exists in both 'util-linux' and 'libutil-linux'
-/usr/lib/libmount.la exists in both 'util-linux' and 'libutil-linux'
-/usr/lib/libsmartcols.a exists in both 'util-linux' and 'libutil-linux'
-/usr/lib/libsmartcols.la exists in both 'util-linux' and 'libutil-linux'
-/usr/lib/libuuid.a exists in both 'util-linux' and 'libutil-linux'
-/usr/lib/libuuid.la exists in both 'util-linux' and 'libutil-linux'
-Errors occurred, no packages were upgraded.
-
-=> ok, we loose files and permissions
# in 'real' 486
###############
@@ -541,7 +259,4 @@ error: could not register 'temp' database (wrong or NULL argument passed)
installed binaries have wrong permissions (no execute permission), a pacman issue?
shilly flags? libarchive problem?
-git: https helpers
-chmod 0777 /usr/lib/git-core/git-remote-*
-
later: for inside the chroot
diff --git a/README b/README
index 3829728..8f373da 100644
--- a/README
+++ b/README
@@ -187,4 +187,7 @@ su cross ./prepare_stage2_repo.sh
# stage 1 system. Resulting artifacts get stored also back
# in $STAGE2_BUILD.
+# Most things compile just fine with 64 MB RAM, binutils ld gold needs more
+# (we gave it 512 MB)
+
./build_stage2.sh
diff --git a/TODOS b/TODOS
index 79b8707..c4c44d3 100644
--- a/TODOS
+++ b/TODOS
@@ -76,3 +76,8 @@ stage2 issues:
=> so we must not install zlib before we rebuild binutils
- better "package already built" test (example pacman and pacman-mirrorlist)
dito linux and linux-api-headers
+- syslinux: python cmenu issues (a generator), python is out of reach for stage2 to
+ make it a build requirement!
+- syslinux: linking issues, header section too small in ld linker script
+- syslinux: shouldn't we switch to another easier boot manager? or to grub?
+
diff --git a/build_stage2.sh b/build_stage2.sh
index e0c8049..c3465b3 100755
--- a/build_stage2.sh
+++ b/build_stage2.sh
@@ -24,18 +24,18 @@ autoconf automake perl-error pcre2 git libtool
zlib pambase cracklib libtirpc flex pam libcap coreutils
util-linux pkg-config e2fsprogs expat bzip2 lz4 xz pcre less gzip
tar libarchive curl
-archlinux-keyring archlinux32-keyring pacman
+pacman-mirrorlist archlinux-keyring archlinux32-keyring pacman
elfutils sed texinfo grep findutils file diffutils ed patch
fakeroot
kbd procps-ng bison shadow
-inetutils bc kmod linux
+inetutils bc kmod linux uinit nasm
+net-tools libmnl libnfnetlink iptables iproute2
+libedit openssh
+make mpfr gawk libmpc binutils
+libunwind strace gdb
"
-#~ uinit nasm syslinux
-#~ net-tools libmnl libnfnetlink iptables iproute2
-#~ libedit openssh
-#~ make mpfr gawk libmpc binutils gcc glibc
-#~ libunwind strace gdb"
-#~ pacman-mirrorlist
+#TODO after nasm: syslinux
+#~ TODO: after binutils: gcc glibc
for p in $PACKAGES; do
diff --git a/build_stage2_package.sh b/build_stage2_package.sh
index 13c2856..95ab857 100755
--- a/build_stage2_package.sh
+++ b/build_stage2_package.sh
@@ -16,7 +16,7 @@ PACKAGE=$1
. "$SCRIPT_DIR/$TARGET_CPU-stage2/template/DESCR"
-#if "$(find "$STAGE2_PACKAGES" -regex ".*/$PACKAGE-.*pkg\\.tar\\.xz" | wc -l)" = 0; then
+if test "$(find "$STAGE2_PACKAGES" -regex ".*/$PACKAGE-.*pkg\\.tar\\.xz" | wc -l)" = 0; then
echo "Building package $PACKAGE."
cd $STAGE2_BUILD || exit 1
@@ -163,6 +163,6 @@ PACKAGE=$1
cd $STAGE2_BUILD || exit 1
-#else
-# echo "$PACKAGE exists."
-#fi
+else
+ echo "$PACKAGE exists."
+fi
diff --git a/i486-stage1/syslinux/DESCR b/i486-stage1/syslinux/DESCR
index a542c39..05c571a 100644
--- a/i486-stage1/syslinux/DESCR
+++ b/i486-stage1/syslinux/DESCR
@@ -1,4 +1,4 @@
-# disable python
+# disable python (take it from the host for generating the menues)
sed -i "/makedepends=/s/python2//" PKGBUILD
sed -i "s/make PYTHON=python2/make/" PKGBUILD
@@ -13,3 +13,7 @@ sed -i "/makedepends=/s/upx//" PKGBUILD
# use the cross compiler
sed -i "s/\(make \$_targets\)/\1 CC=$TARGET_ARCH-gcc AS=$TARGET_ARCH-as LD=$TARGET_ARCH-ld AR=$TARGET_ARCH-ar/" PKGBUILD
+
+# build BIOS version only for i486
+sed -i '/_targets/s/efi32//g' PKGBUILD
+sed -i '3!N; /prepare()/ a \ sed -i "/all_firmware :=/s/efi32 efi64//g" Makefile' PKGBUILD
diff --git a/i486-stage2/gdb/DESCR b/i486-stage2/gdb/DESCR
new file mode 100644
index 0000000..a7fca85
--- /dev/null
+++ b/i486-stage2/gdb/DESCR
@@ -0,0 +1,9 @@
+# disable python
+sed -i "/makedepends=/s/python//" PKGBUILD
+sed -i "/depends=/s/python//" PKGBUILD
+sed -i "s@--with-python=/usr/bin/python3@--without-python@g" PKGBUILD
+
+# disable guile
+sed -i "/makedepends=/s/guile2.0//" PKGBUILD
+sed -i "/depends=/s/guile2.0//" PKGBUILD
+sed -i "s@--with-guile=guile-2.0@--without-guile@g" PKGBUILD
diff --git a/i486-stage2/iproute2/DESCR b/i486-stage2/iproute2/DESCR
new file mode 100644
index 0000000..ae827b2
--- /dev/null
+++ b/i486-stage2/iproute2/DESCR
@@ -0,0 +1,2 @@
+# disable linux-atm (unlikely we still have some ATM based networks)
+sed -i "/makedepends=/s/'linux-atm'//" PKGBUILD
diff --git a/i486-stage2/iptables/DESCR b/i486-stage2/iptables/DESCR
new file mode 100644
index 0000000..bc12c3e
--- /dev/null
+++ b/i486-stage2/iptables/DESCR
@@ -0,0 +1,13 @@
+# disable Berkley Packet Filtering
+sed -i 's@--enable-bpf-compiler@--disable-bpf-compiler@g' PKGBUILD
+
+# disable nftable support, draws in more libraries, we need the xtables
+# depevelopment mainly now for iproute2
+sed -i "/depends=/s/libnftnl//" PKGBUILD
+sed -i 's@./configure@./configure --disable-nftables@' PKGBUILD
+
+# disable libpcap (tcpdump, draws in too many dependencies)
+sed -i "/depends=/s/libpcap//" PKGBUILD
+
+# disable connection tracking
+sed -i 's@./configure@./configure --disable-connlabel@' PKGBUILD
diff --git a/i486-stage2/libunwind/DESCR b/i486-stage2/libunwind/DESCR
new file mode 100644
index 0000000..63a58a0
--- /dev/null
+++ b/i486-stage2/libunwind/DESCR
@@ -0,0 +1,2 @@
+# no TeX, no docu
+sed -i "/makedepends=/s/'texlive-core'//" PKGBUILD
diff --git a/i486-stage2/make/DESCR b/i486-stage2/make/DESCR
new file mode 100644
index 0000000..c876f0d
--- /dev/null
+++ b/i486-stage2/make/DESCR
@@ -0,0 +1,3 @@
+# no guile
+sed -i "/depends=/s/'guile'//" PKGBUILD
+sed -i 's@./configure@./configure --without-guile@g' PKGBUILD
diff --git a/i486-stage2/nasm/DESCR b/i486-stage2/nasm/DESCR
new file mode 100644
index 0000000..78f2337
--- /dev/null
+++ b/i486-stage2/nasm/DESCR
@@ -0,0 +1,8 @@
+# remove all fonts and ghostscript (we don't build the manual)
+sed -i "/makedepends=/s/perl-font-ttf//" PKGBUILD
+sed -i "/makedepends=/s/perl-sort-versions//" PKGBUILD
+sed -i "/makedepends=/s/fontconfig//" PKGBUILD
+sed -i "/makedepends=/s/adobe-source-sans-pro-fonts//" PKGBUILD
+sed -i "/makedepends=/s/ttf-liberation//" PKGBUILD
+sed -i "/makedepends=/s/ghostscript//" PKGBUILD
+sed -i "s/\(make -C doc\)/#\1/" PKGBUILD
diff --git a/i486-stage2/openssh/DESCR b/i486-stage2/openssh/DESCR
new file mode 100644
index 0000000..88fc07e
--- /dev/null
+++ b/i486-stage2/openssh/DESCR
@@ -0,0 +1,9 @@
+# remove ldns and kerberos5 support, keep libedit (as it's easy to build)
+# ssh => not good, openssl <> unbound <> openssl cycle
+sed -i "/depends=/s/krb5//" PKGBUILD
+sed -i "/depends=/s/ldns//" PKGBUILD
+sed -i 's@--with-ldns@--without-ldns@g' PKGBUILD
+sed -i 's@--with-kerberos5=/usr@--without-kerberos5@g' PKGBUILD
+
+#ln: failed to create symbolic link '/build/openssh/pkg/openssh/usr/share/man/man1/slogin.1.gz': No such file or directory
+sed -i 's@\(ln -sf ssh.1.gz.*\)@#\1@g' PKGBUILD
diff --git a/i486-stage2/syslinux/DESCR b/i486-stage2/syslinux/DESCR
new file mode 100644
index 0000000..d03b11d
--- /dev/null
+++ b/i486-stage2/syslinux/DESCR
@@ -0,0 +1,18 @@
+# disable python
+sed -i "/makedepends=/s/python2//" PKGBUILD
+sed -i "s/make PYTHON=python2/make/" PKGBUILD
+
+# no documentation
+sed -i "/makedepends=/s/asciidoc//" PKGBUILD
+
+# no upx compression
+sed -i "/makedepends=/s/upx//" PKGBUILD
+
+# build BIOS version only for i486
+sed -i '/_targets/s/efi32//g' PKGBUILD
+sed -i '3!N; /prepare()/ a \ sed -i "/all_firmware :=/s/efi32 efi64//g" Makefile' PKGBUILD
+
+# precompute the menues which are generated with python
+sed -i 's@source=(@source=(syslinux-6.03-precomputed-python-menues.patch @' PKGBUILD
+sed -i "s@sha1sums=(@sha1sums=('4f92057c1dca02f8b6d4a71170183f89c7d4bd8f' @" PKGBUILD
+sed -i '/patch -p1/ a \ patch -Np1 -i "${srcdir}/syslinux-6.03-precomputed-python-menues.patch"' PKGBUILD
diff --git a/i486-stage2/syslinux/syslinux-6.03-precomputed-python-menues.patch b/i486-stage2/syslinux/syslinux-6.03-precomputed-python-menues.patch
new file mode 100644
index 0000000..e6c1db3
--- /dev/null
+++ b/i486-stage2/syslinux/syslinux-6.03-precomputed-python-menues.patch
@@ -0,0 +1,1032 @@
+diff -rauN syslinux/com32/cmenu/Makefile syslinux-precomputed-python-menues-patch/com32/cmenu/Makefile
+--- syslinux/com32/cmenu/Makefile 2018-02-24 08:57:21.870445499 +0100
++++ syslinux-precomputed-python-menues-patch/com32/cmenu/Makefile 2018-02-24 09:44:46.464893504 +0100
+@@ -41,7 +41,8 @@
+
+ .PRECIOUS: %.c
+ %.c: %.menu adv_menu.tpl
+- $(PYTHON) $(SRC)/menugen.py --input=$< --output=$@ --template=$(SRC)/adv_menu.tpl
++ cp $(basename $@).c $@
++# $(PYTHON) $(SRC)/menugen.py --input=$< --output=$@ --template=$(SRC)/adv_menu.tpl
+
+ all: makeoutputdirs menus
+
+diff -rauN syslinux/com32/cmenu/test.c syslinux-precomputed-python-menues-patch/com32/cmenu/test.c
+--- syslinux/com32/cmenu/test.c 1970-01-01 01:00:00.000000000 +0100
++++ syslinux-precomputed-python-menues-patch/com32/cmenu/test.c 2018-02-24 09:17:50.483434027 +0100
+@@ -0,0 +1,477 @@
++/* -*- c -*- ------------------------------------------------------------- *
++ *
++ * Copyright 2004-2006 Murali Krishnan Ganapathy - All Rights Reserved
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
++ * Boston MA 02111-1307, USA; either version 2 of the License, or
++ * (at your option) any later version; incorporated herein by reference.
++ *
++ * ----------------------------------------------------------------------- */
++
++#ifndef NULL
++#define NULL ((void *) 0)
++#endif
++
++#include "cmenu.h"
++#include "help.h"
++#include "passwords.h"
++#include "com32io.h"
++#include <string.h>
++#include <stdlib.h>
++#include <unistd.h>
++
++#define MAX_CMD_LINE_LENGTH 514
++
++typedef struct s_xtra {
++ long ipappend; // Stores the ipappend flag to send (useful for PXELINUX only)
++ char *argsmenu; // Stores the name of menu which contains options for the given RUN item
++ char *perms; // stores the permissions required to activate the item
++} t_xtra;
++
++typedef t_xtra *pt_xtra; // Pointer to extra datastructure
++
++// Types of dot commands for which caller takes responsibility of handling
++// In some case some commands may not make sense, it is up to the caller
++// to handle cases which do not make sense
++typedef enum {QUIT_CMD, REPEAT_CMD, ENTER_CMD, ESCAPE_CMD} t_dotcmd;
++
++
++/*----------------- Global Variables */
++
++// default user
++#define GUEST_USER "guest"
++
++// for local commands. return value of execdotcmd
++#define QUIT_CMD 0
++#define RPT_CMD 1
++
++char username[12]; // Name of user currently using the system
++
++int PWD_ROW; // Line number where user authentication happens
++int EDIT_ROW; // row where User Tab
++
++char loginstr[] = "<L>ogin ";
++char logoutstr[30];
++
++int vmode; // The video mode we want to be in
++char timeoutcmd[MAX_CMD_LINE_LENGTH]; // Command to execute on timeout
++char totaltimeoutcmd[MAX_CMD_LINE_LENGTH]; // Command to execute on totaltimeout
++
++char QUITSTR[] = ".quit"; // same as exit
++char IGNORESTR[]=".ignore"; // same as repeat, wait
++
++/*---------------- End globals */
++
++// returns pointer to first non-space char
++// and advances end of str by removing trailing spaces
++char * strip(char *str)
++{
++ char *p,*s,*e;
++ if (!str) return NULL;
++ p = str;
++ s = NULL;
++ e = NULL;
++ while (*p) {
++ if (*p != ' ') {
++ // mark start of string or record the last visited non-space char
++ if (!s) s=p; else e=p;
++ }
++ p++;
++ }
++ *(++e)='\0'; // kill string earlier
++ return s;
++}
++
++// executes a list of % separated commands
++// non-dot commands are assumed to be syslinux commands
++// All syslinux commands are appended with the contents of kerargs
++// If it fails (kernel not found) then the next one is tried in the
++// list
++// returns QUIT_CMD or RPT_CMD
++t_dotcmd execdotcmd(const char *cmd, char *defcmd, const char *kerargs)
++{
++ char cmdline[MAX_CMD_LINE_LENGTH];
++ char dotcmd[MAX_CMD_LINE_LENGTH];
++ char *curr,*next,*p,*args;
++ char ctr;
++
++ strcpy(dotcmd,cmd);
++ next = dotcmd;
++ cmdline[0] = '\0';
++ while (*next) { // if something to do
++ curr = next;
++ p = strchr(next,'%');
++ if (p) {
++ *p--='\0'; next=p+2;
++ while (*p == ' ') p--;
++ *(++p)='\0'; // remove trailing spaces
++ } else {
++ if (*defcmd) { // execute defcmd next
++ next=defcmd;
++ defcmd=NULL; // exec def cmd only once
++ } else next=NULL;
++ }
++ // now we just need to execute the command "curr"
++ curr = strip(curr);
++ if (curr[0] != '.') { // just run the kernel
++ strcpy(cmdline,curr);
++ if (kerargs) strcat(cmdline,kerargs);
++ runsyslinuximage(cmdline,0); // No IPAppend
++ } else { // We have a DOT command
++ // split command into command and args (may be empty)
++ args = curr;
++ while ( (*args != ' ') && (*args != '\0') ) args++;
++ if (*args) { // found a space
++ *args++ = '\0';
++ while (*args == ' ') args++; // skip over spaces
++ }
++ if ( (strcmp(curr,".exit")==0) ||
++ (strcmp(curr,".quit")==0)
++ )
++ return QUIT_CMD;
++ if ( (strcmp(curr,".repeat")==0) ||
++ (strcmp(curr,".ignore")==0) ||
++ (strcmp(curr,".wait")==0)
++ )
++ return RPT_CMD;
++ if (strcmp(curr,".beep")==0) {
++ if ((args) && ('0' <= args[0]) && (args[0] <= '9'))
++ ctr = args[0]-'0';
++ else ctr=1;
++ for (;ctr>0; ctr--) beep();
++ }
++ if (strcmp(curr,".help")==0) runhelp(args);
++ }
++ }
++ return RPT_CMD; // by default we do not quit
++}
++
++
++TIMEOUTCODE timeout(const char *cmd)
++{
++ t_dotcmd c;
++ c = execdotcmd(cmd,".wait",NULL);
++ switch(c) {
++ case ENTER_CMD:
++ return CODE_ENTER;
++ case ESCAPE_CMD:
++ return CODE_ESCAPE;
++ default:
++ return CODE_WAIT;
++ }
++}
++
++TIMEOUTCODE ontimeout(void)
++{
++ return timeout(timeoutcmd);
++}
++
++TIMEOUTCODE ontotaltimeout(void)
++{
++ return timeout(totaltimeoutcmd);
++}
++
++void keys_handler(t_menusystem * ms __attribute__ (( unused )), t_menuitem * mi, int scancode)
++{
++ int nc, nr;
++
++ if (getscreensize(1, &nr, &nc)) {
++ /* Unknown screen size? */
++ nc = 80;
++ nr = 24;
++ }
++
++ if ( (scancode == KEY_F1) && (mi->helpid != 0xFFFF) ) { // If scancode of F1 and non-trivial helpid
++ runhelpsystem(mi->helpid);
++ }
++
++ // If user hit TAB, and item is an "executable" item
++ // and user has privileges to edit it, edit it in place.
++ if ((scancode == KEY_TAB) && (mi->action == OPT_RUN) &&
++ (EDIT_ROW < nr) && (EDIT_ROW > 0) &&
++ (isallowed(username,"editcmd") || isallowed(username,"root"))) {
++ // User typed TAB and has permissions to edit command line
++ gotoxy(EDIT_ROW,1);
++ csprint("Command line:",0x07);
++ editstring(mi->data,ACTIONLEN);
++ gotoxy(EDIT_ROW,1);
++ cprint(' ',0x07,nc-1);
++ }
++}
++
++t_handler_return login_handler(t_menusystem *ms, t_menuitem *mi)
++{
++ (void)mi; // Unused
++ char pwd[40];
++ char login[40];
++ int nc, nr;
++ t_handler_return rv;
++
++ (void)ms;
++
++ rv = ACTION_INVALID;
++ if (PWD_ROW < 0) return rv; // No need to authenticate
++
++ if (mi->item == loginstr) { /* User wants to login */
++ if (getscreensize(1, &nr, &nc)) {
++ /* Unknown screen size? */
++ nc = 80;
++ nr = 24;
++ }
++
++ gotoxy(PWD_ROW,1);
++ csprint("Enter Username: ",0x07);
++ getstring(login, sizeof username);
++ gotoxy(PWD_ROW,1);
++ cprint(' ',0x07,nc);
++ csprint("Enter Password: ",0x07);
++ getpwd(pwd, sizeof pwd);
++ gotoxy(PWD_ROW,1);
++ cprint(' ',0x07,nc);
++
++ if (authenticate_user(login,pwd))
++ {
++ strcpy(username,login);
++ strcpy(logoutstr,"<L>ogout ");
++ strcat(logoutstr,username);
++ mi->item = logoutstr; // Change item to read "Logout"
++ rv.refresh = 1; // refresh the screen (as item contents changed)
++ }
++ else strcpy(username,GUEST_USER);
++ }
++ else // User needs to logout
++ {
++ strcpy(username,GUEST_USER);
++ strcpy(logoutstr,"");
++ mi->item = loginstr;
++ }
++
++ return rv;
++}
++
++t_handler_return check_perms(t_menusystem *ms, t_menuitem *mi)
++{
++ char *perms;
++ pt_xtra x;
++
++ (void) ms; // To keep compiler happy
++
++ x = (pt_xtra) mi->extra_data;
++ perms = ( x ? x->perms : NULL);
++ if (!perms) return ACTION_VALID;
++
++ if (isallowed(username,"root") || isallowed(username,perms)) // If allowed
++ return ACTION_VALID;
++ else return ACTION_INVALID;
++}
++
++// Compute the full command line to add and if non-trivial
++// prepend the string prepend to final command line
++// Assume cmdline points to buffer long enough to hold answer
++void gencommand(pt_menuitem mi, char *cmdline)
++{
++ pt_xtra x;
++ cmdline[0] = '\0';
++ strcat(cmdline,mi->data);
++ x = (pt_xtra) mi->extra_data;
++ if ( (x) && (x->argsmenu)) gen_append_line(x->argsmenu,cmdline);
++}
++
++
++// run the given command together with additional options which may need passing
++void runcommand(pt_menuitem mi)
++{
++ char *line;
++ pt_xtra x;
++ long ipappend;
++
++ line = (char *)malloc(sizeof(char)*MAX_CMD_LINE_LENGTH);
++ gencommand(mi,line);
++ x = (pt_xtra) mi->extra_data;
++ ipappend = (x ? x->ipappend : 0);
++
++ runsyslinuximage(line,ipappend);
++ free(line);
++}
++
++// set the extra info for the specified menu item.
++void set_xtra(pt_menuitem mi, const char *argsmenu, const char *perms, unsigned int helpid, long ipappend)
++{
++ pt_xtra xtra;
++ int bad_argsmenu, bad_perms, bad_ipappend;
++
++ mi->extra_data = NULL; // initalize
++ mi->helpid = helpid; // set help id
++
++ if (mi->action != OPT_RUN) return;
++
++ bad_argsmenu = bad_perms = bad_ipappend = 0;
++ if ( (argsmenu==NULL) || (strlen(argsmenu)==0)) bad_argsmenu = 1;
++ if ( (perms==NULL) || (strlen(perms)==0)) bad_perms = 1;
++ if ( ipappend==0) bad_ipappend = 1;
++
++ if (bad_argsmenu && bad_perms && bad_ipappend) return;
++
++ xtra = (pt_xtra) malloc(sizeof(t_xtra));
++ mi->extra_data = (void *) xtra;
++ xtra->argsmenu = xtra->perms = NULL;
++ xtra->ipappend = ipappend;
++ if (!bad_argsmenu) {
++ xtra->argsmenu = (char *) malloc(sizeof(char)*(strlen(argsmenu)+1));
++ strcpy(xtra->argsmenu,argsmenu);
++ }
++ if (!bad_perms) {
++ xtra->perms = (char *) malloc(sizeof(char)*(strlen(perms)+1));
++ strcpy(xtra->perms,perms);
++ mi->handler = &check_perms;
++ }
++}
++
++int main(void)
++{
++ pt_menuitem curr;
++ char quit;
++ char exitcmd[MAX_CMD_LINE_LENGTH];
++ char exitcmdroot[MAX_CMD_LINE_LENGTH];
++ char onerrcmd[MAX_CMD_LINE_LENGTH];
++ char startfile[MAX_CMD_LINE_LENGTH];
++ char *ecmd; // effective exit command or onerrorcmd
++ char skipbits;
++ char skipcmd[MAX_CMD_LINE_LENGTH];
++ int timeout; // time in multiples of 0.1 seconds
++ int totaltimeout; // time in multiples of 0.1 seconds
++ t_dotcmd dotrv; // to store the return value of execdotcmd
++ int temp;
++
++ strcpy(username,GUEST_USER);
++/* ---- Initializing menu system parameters --- */
++ vmode = 0xFF;
++ skipbits = 0;
++ PWD_ROW = 23;
++ EDIT_ROW = 23;
++ strcpy(onerrcmd,".repeat");
++ strcpy(exitcmd,".exit");
++ strcpy(exitcmdroot,"");
++ // If not specified exitcmdroot = exitcmd
++ if (exitcmdroot[0] == '\0') strcpy(exitcmdroot,exitcmd);
++ // Timeout stuff
++ timeout = 600;
++ strcpy(timeoutcmd,".beep");
++ totaltimeout = 0;
++ strcpy(totaltimeoutcmd,".wait");
++ strcpy(startfile,"");
++
++ init_help("/isolinux/help");
++ init_passwords("");
++ init_menusystem("A test of the test.menu file");
++ set_window_size(1,1,23,78);
++
++ // Register the ontimeout handler, with a time out of 10 seconds
++ reg_ontimeout(ontimeout,timeout*10,0);
++ reg_ontotaltimeout(ontotaltimeout,totaltimeout*10);
++
++ // Register menusystem handlers
++ reg_handler(HDLR_KEYS,&keys_handler);
++/* ---- End of initialization --- */
++
++/* ------- MENU testing ----- */
++ add_named_menu("testing"," Testing ",-1);
++
++ curr = add_item("Self Loop","Go to Testing",OPT_SUBMENU,"testing",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("Memory Test","Perform extensive memory testing",OPT_RUN,"memtest",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("Exit this menu","Go one level up",OPT_EXITMENU,"",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++/* ------- MENU rescue ----- */
++ add_named_menu("rescue"," Rescue Options ",-1);
++ set_menu_pos(10,10);
++
++ curr = add_item("Linux Rescue","linresc",OPT_RUN,"linresc",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("Dos Rescue","dosresc",OPT_RUN,"dosresc",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("Windows Rescue","winresc",OPT_RUN,"winresc",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("Exit this menu","Go one level up",OPT_EXITMENU,"",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++/* ------- MENU main ----- */
++ add_named_menu("main"," Main Menu ",-1);
++
++ curr = add_item("Prepare","prep",OPT_RUN,"prep",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("Rescue options...","Troubleshoot a system",OPT_SUBMENU,"rescue",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("Testing...","Options to test hardware",OPT_SUBMENU,"testing",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("Exit this menu","Go one level up",OPT_EXITMENU,"",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++/* ------- END OF MENU declarations ----- */
++
++// Check if we should skip the menu altogether
++ quit = 0; // Dont skip the menu
++ if (getshiftflags() & skipbits) { // we must skip the menu altogther and execute skipcmd
++ dotrv = execdotcmd(skipcmd,".beep%.exit",NULL); // Worst case we beep and exit
++ if (dotrv == QUIT_CMD) quit = 1;
++ }
++
++// Switch vide mode if required
++ if (vmode != 0xFF) setvideomode(vmode);
++
++// Do we have a startfile to display?
++ if (startfile[0] != '\0') runhelp(startfile);
++
++// The main loop
++ while (quit == 0) { // As long as quit is zero repeat
++ curr = showmenus(find_menu_num("main")); // Initial menu is the one called "main"
++
++ if (curr) {
++ if (curr->action == OPT_RUN) {
++ ecmd = (char *)malloc(sizeof(char)*MAX_CMD_LINE_LENGTH);
++ gencommand(curr,ecmd);
++ temp = (curr->extra_data ? ((pt_xtra)curr->extra_data)->ipappend : 0);
++ runsyslinuximage(ecmd,temp);
++ // kernel not found so execute the appropriate dot command
++ dotrv = execdotcmd(onerrcmd,".quit",ecmd); // pass bad cmdline as arg
++ if (dotrv== QUIT_CMD) quit = 1;
++ free(ecmd); ecmd = NULL;
++ }
++ else csprint("Error in programming!",0x07);
++ } else {
++ // find effective exit command
++ ecmd = ( isallowed(username,"root") ? exitcmdroot : exitcmd);
++ dotrv = execdotcmd(ecmd,".repeat",NULL);
++ quit = (dotrv == QUIT_CMD ? 1 : 0); // should we exit now
++ }
++ }
++
++// Deallocate space used and quit
++ close_passwords();
++ close_help();
++ close_menusystem();
++ return 0;
++}
++
+diff -rauN syslinux/com32/cmenu/test2.c syslinux-precomputed-python-menues-patch/com32/cmenu/test2.c
+--- syslinux/com32/cmenu/test2.c 1970-01-01 01:00:00.000000000 +0100
++++ syslinux-precomputed-python-menues-patch/com32/cmenu/test2.c 2018-02-24 09:19:06.739180583 +0100
+@@ -0,0 +1,534 @@
++/* -*- c -*- ------------------------------------------------------------- *
++ *
++ * Copyright 2004-2006 Murali Krishnan Ganapathy - All Rights Reserved
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
++ * Boston MA 02111-1307, USA; either version 2 of the License, or
++ * (at your option) any later version; incorporated herein by reference.
++ *
++ * ----------------------------------------------------------------------- */
++
++#ifndef NULL
++#define NULL ((void *) 0)
++#endif
++
++#include "cmenu.h"
++#include "help.h"
++#include "passwords.h"
++#include "com32io.h"
++#include <string.h>
++#include <stdlib.h>
++#include <unistd.h>
++
++#define MAX_CMD_LINE_LENGTH 514
++
++typedef struct s_xtra {
++ long ipappend; // Stores the ipappend flag to send (useful for PXELINUX only)
++ char *argsmenu; // Stores the name of menu which contains options for the given RUN item
++ char *perms; // stores the permissions required to activate the item
++} t_xtra;
++
++typedef t_xtra *pt_xtra; // Pointer to extra datastructure
++
++// Types of dot commands for which caller takes responsibility of handling
++// In some case some commands may not make sense, it is up to the caller
++// to handle cases which do not make sense
++typedef enum {QUIT_CMD, REPEAT_CMD, ENTER_CMD, ESCAPE_CMD} t_dotcmd;
++
++
++/*----------------- Global Variables */
++
++// default user
++#define GUEST_USER "guest"
++
++// for local commands. return value of execdotcmd
++#define QUIT_CMD 0
++#define RPT_CMD 1
++
++char username[12]; // Name of user currently using the system
++
++int PWD_ROW; // Line number where user authentication happens
++int EDIT_ROW; // row where User Tab
++
++char loginstr[] = "<L>ogin ";
++char logoutstr[30];
++
++int vmode; // The video mode we want to be in
++char timeoutcmd[MAX_CMD_LINE_LENGTH]; // Command to execute on timeout
++char totaltimeoutcmd[MAX_CMD_LINE_LENGTH]; // Command to execute on totaltimeout
++
++char QUITSTR[] = ".quit"; // same as exit
++char IGNORESTR[]=".ignore"; // same as repeat, wait
++
++/*---------------- End globals */
++
++// returns pointer to first non-space char
++// and advances end of str by removing trailing spaces
++char * strip(char *str)
++{
++ char *p,*s,*e;
++ if (!str) return NULL;
++ p = str;
++ s = NULL;
++ e = NULL;
++ while (*p) {
++ if (*p != ' ') {
++ // mark start of string or record the last visited non-space char
++ if (!s) s=p; else e=p;
++ }
++ p++;
++ }
++ *(++e)='\0'; // kill string earlier
++ return s;
++}
++
++// executes a list of % separated commands
++// non-dot commands are assumed to be syslinux commands
++// All syslinux commands are appended with the contents of kerargs
++// If it fails (kernel not found) then the next one is tried in the
++// list
++// returns QUIT_CMD or RPT_CMD
++t_dotcmd execdotcmd(const char *cmd, char *defcmd, const char *kerargs)
++{
++ char cmdline[MAX_CMD_LINE_LENGTH];
++ char dotcmd[MAX_CMD_LINE_LENGTH];
++ char *curr,*next,*p,*args;
++ char ctr;
++
++ strcpy(dotcmd,cmd);
++ next = dotcmd;
++ cmdline[0] = '\0';
++ while (*next) { // if something to do
++ curr = next;
++ p = strchr(next,'%');
++ if (p) {
++ *p--='\0'; next=p+2;
++ while (*p == ' ') p--;
++ *(++p)='\0'; // remove trailing spaces
++ } else {
++ if (*defcmd) { // execute defcmd next
++ next=defcmd;
++ defcmd=NULL; // exec def cmd only once
++ } else next=NULL;
++ }
++ // now we just need to execute the command "curr"
++ curr = strip(curr);
++ if (curr[0] != '.') { // just run the kernel
++ strcpy(cmdline,curr);
++ if (kerargs) strcat(cmdline,kerargs);
++ runsyslinuximage(cmdline,0); // No IPAppend
++ } else { // We have a DOT command
++ // split command into command and args (may be empty)
++ args = curr;
++ while ( (*args != ' ') && (*args != '\0') ) args++;
++ if (*args) { // found a space
++ *args++ = '\0';
++ while (*args == ' ') args++; // skip over spaces
++ }
++ if ( (strcmp(curr,".exit")==0) ||
++ (strcmp(curr,".quit")==0)
++ )
++ return QUIT_CMD;
++ if ( (strcmp(curr,".repeat")==0) ||
++ (strcmp(curr,".ignore")==0) ||
++ (strcmp(curr,".wait")==0)
++ )
++ return RPT_CMD;
++ if (strcmp(curr,".beep")==0) {
++ if ((args) && ('0' <= args[0]) && (args[0] <= '9'))
++ ctr = args[0]-'0';
++ else ctr=1;
++ for (;ctr>0; ctr--) beep();
++ }
++ if (strcmp(curr,".help")==0) runhelp(args);
++ }
++ }
++ return RPT_CMD; // by default we do not quit
++}
++
++
++TIMEOUTCODE timeout(const char *cmd)
++{
++ t_dotcmd c;
++ c = execdotcmd(cmd,".wait",NULL);
++ switch(c) {
++ case ENTER_CMD:
++ return CODE_ENTER;
++ case ESCAPE_CMD:
++ return CODE_ESCAPE;
++ default:
++ return CODE_WAIT;
++ }
++}
++
++TIMEOUTCODE ontimeout(void)
++{
++ return timeout(timeoutcmd);
++}
++
++TIMEOUTCODE ontotaltimeout(void)
++{
++ return timeout(totaltimeoutcmd);
++}
++
++void keys_handler(t_menusystem * ms __attribute__ (( unused )), t_menuitem * mi, int scancode)
++{
++ int nc, nr;
++
++ if (getscreensize(1, &nr, &nc)) {
++ /* Unknown screen size? */
++ nc = 80;
++ nr = 24;
++ }
++
++ if ( (scancode == KEY_F1) && (mi->helpid != 0xFFFF) ) { // If scancode of F1 and non-trivial helpid
++ runhelpsystem(mi->helpid);
++ }
++
++ // If user hit TAB, and item is an "executable" item
++ // and user has privileges to edit it, edit it in place.
++ if ((scancode == KEY_TAB) && (mi->action == OPT_RUN) &&
++ (EDIT_ROW < nr) && (EDIT_ROW > 0) &&
++ (isallowed(username,"editcmd") || isallowed(username,"root"))) {
++ // User typed TAB and has permissions to edit command line
++ gotoxy(EDIT_ROW,1);
++ csprint("Command line:",0x07);
++ editstring(mi->data,ACTIONLEN);
++ gotoxy(EDIT_ROW,1);
++ cprint(' ',0x07,nc-1);
++ }
++}
++
++t_handler_return login_handler(t_menusystem *ms, t_menuitem *mi)
++{
++ (void)mi; // Unused
++ char pwd[40];
++ char login[40];
++ int nc, nr;
++ t_handler_return rv;
++
++ (void)ms;
++
++ rv = ACTION_INVALID;
++ if (PWD_ROW < 0) return rv; // No need to authenticate
++
++ if (mi->item == loginstr) { /* User wants to login */
++ if (getscreensize(1, &nr, &nc)) {
++ /* Unknown screen size? */
++ nc = 80;
++ nr = 24;
++ }
++
++ gotoxy(PWD_ROW,1);
++ csprint("Enter Username: ",0x07);
++ getstring(login, sizeof username);
++ gotoxy(PWD_ROW,1);
++ cprint(' ',0x07,nc);
++ csprint("Enter Password: ",0x07);
++ getpwd(pwd, sizeof pwd);
++ gotoxy(PWD_ROW,1);
++ cprint(' ',0x07,nc);
++
++ if (authenticate_user(login,pwd))
++ {
++ strcpy(username,login);
++ strcpy(logoutstr,"<L>ogout ");
++ strcat(logoutstr,username);
++ mi->item = logoutstr; // Change item to read "Logout"
++ rv.refresh = 1; // refresh the screen (as item contents changed)
++ }
++ else strcpy(username,GUEST_USER);
++ }
++ else // User needs to logout
++ {
++ strcpy(username,GUEST_USER);
++ strcpy(logoutstr,"");
++ mi->item = loginstr;
++ }
++
++ return rv;
++}
++
++t_handler_return check_perms(t_menusystem *ms, t_menuitem *mi)
++{
++ char *perms;
++ pt_xtra x;
++
++ (void) ms; // To keep compiler happy
++
++ x = (pt_xtra) mi->extra_data;
++ perms = ( x ? x->perms : NULL);
++ if (!perms) return ACTION_VALID;
++
++ if (isallowed(username,"root") || isallowed(username,perms)) // If allowed
++ return ACTION_VALID;
++ else return ACTION_INVALID;
++}
++
++// Compute the full command line to add and if non-trivial
++// prepend the string prepend to final command line
++// Assume cmdline points to buffer long enough to hold answer
++void gencommand(pt_menuitem mi, char *cmdline)
++{
++ pt_xtra x;
++ cmdline[0] = '\0';
++ strcat(cmdline,mi->data);
++ x = (pt_xtra) mi->extra_data;
++ if ( (x) && (x->argsmenu)) gen_append_line(x->argsmenu,cmdline);
++}
++
++
++// run the given command together with additional options which may need passing
++void runcommand(pt_menuitem mi)
++{
++ char *line;
++ pt_xtra x;
++ long ipappend;
++
++ line = (char *)malloc(sizeof(char)*MAX_CMD_LINE_LENGTH);
++ gencommand(mi,line);
++ x = (pt_xtra) mi->extra_data;
++ ipappend = (x ? x->ipappend : 0);
++
++ runsyslinuximage(line,ipappend);
++ free(line);
++}
++
++// set the extra info for the specified menu item.
++void set_xtra(pt_menuitem mi, const char *argsmenu, const char *perms, unsigned int helpid, long ipappend)
++{
++ pt_xtra xtra;
++ int bad_argsmenu, bad_perms, bad_ipappend;
++
++ mi->extra_data = NULL; // initalize
++ mi->helpid = helpid; // set help id
++
++ if (mi->action != OPT_RUN) return;
++
++ bad_argsmenu = bad_perms = bad_ipappend = 0;
++ if ( (argsmenu==NULL) || (strlen(argsmenu)==0)) bad_argsmenu = 1;
++ if ( (perms==NULL) || (strlen(perms)==0)) bad_perms = 1;
++ if ( ipappend==0) bad_ipappend = 1;
++
++ if (bad_argsmenu && bad_perms && bad_ipappend) return;
++
++ xtra = (pt_xtra) malloc(sizeof(t_xtra));
++ mi->extra_data = (void *) xtra;
++ xtra->argsmenu = xtra->perms = NULL;
++ xtra->ipappend = ipappend;
++ if (!bad_argsmenu) {
++ xtra->argsmenu = (char *) malloc(sizeof(char)*(strlen(argsmenu)+1));
++ strcpy(xtra->argsmenu,argsmenu);
++ }
++ if (!bad_perms) {
++ xtra->perms = (char *) malloc(sizeof(char)*(strlen(perms)+1));
++ strcpy(xtra->perms,perms);
++ mi->handler = &check_perms;
++ }
++}
++
++int main(void)
++{
++ pt_menuitem curr;
++ char quit;
++ char exitcmd[MAX_CMD_LINE_LENGTH];
++ char exitcmdroot[MAX_CMD_LINE_LENGTH];
++ char onerrcmd[MAX_CMD_LINE_LENGTH];
++ char startfile[MAX_CMD_LINE_LENGTH];
++ char *ecmd; // effective exit command or onerrorcmd
++ char skipbits;
++ char skipcmd[MAX_CMD_LINE_LENGTH];
++ int timeout; // time in multiples of 0.1 seconds
++ int totaltimeout; // time in multiples of 0.1 seconds
++ t_dotcmd dotrv; // to store the return value of execdotcmd
++ int temp;
++
++ strcpy(username,GUEST_USER);
++/* ---- Initializing menu system parameters --- */
++ vmode = 0xFF;
++ skipbits = SHIFT_PRESSED | CAPSLOCK_ON;
++ PWD_ROW = 23;
++ EDIT_ROW = 23;
++ strcpy(onerrcmd,".beep 2 % % .help hlp00025.txt % .exit");
++ strcpy(exitcmd,".exit");
++ strcpy(exitcmdroot,"");
++ // If not specified exitcmdroot = exitcmd
++ if (exitcmdroot[0] == '\0') strcpy(exitcmdroot,exitcmd);
++ // Timeout stuff
++ timeout = 600;
++ strcpy(timeoutcmd,".wait");
++ totaltimeout = 0;
++ strcpy(totaltimeoutcmd,"chain.c32 hd 0");
++ strcpy(startfile,"hlp00026.txt");
++
++ init_help("/isolinux/help");
++ init_passwords("/isolinux/password");
++ init_menusystem(" COMBOOT Menu System ");
++ set_window_size(1,1,21,79);
++
++ // Register the ontimeout handler, with a time out of 10 seconds
++ reg_ontimeout(ontimeout,timeout*10,0);
++ reg_ontotaltimeout(ontotaltimeout,totaltimeout*10);
++
++ // Register menusystem handlers
++ reg_handler(HDLR_KEYS,&keys_handler);
++/* ---- End of initialization --- */
++
++/* ------- MENU netmenu ----- */
++ add_named_menu("netmenu"," Init Network ",-1);
++
++ curr = add_item("<N>one","Dont start network",OPT_RADIOITEM,"network=no",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("<d>hcp","Use DHCP",OPT_RADIOITEM,"network=dhcp",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++/* ------- MENU testing ----- */
++ add_named_menu("testing"," Testing ",-1);
++
++ curr = add_item("<M>emory Test","Perform extensive memory testing",OPT_RUN,"memtest",0);
++ set_xtra(curr,"","",25,3); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("<I>nvisible","You dont see this",OPT_INVISIBLE,"",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("<E>xit menu","Go one level up",OPT_EXITMENU,"",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++/* ------- MENU rescue ----- */
++ add_named_menu("rescue"," Rescue Options ",-1);
++
++ curr = add_item("<L>inux Rescue","Run linresc",OPT_RUN,"linresc",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("<D>os Rescue","dosresc",OPT_RUN,"dosresc",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("<W>indows Rescue","winresc",OPT_RUN,"winresc",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("<E>xit this menu","Go one level up",OPT_EXITMENU,"",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++/* ------- MENU prep ----- */
++ add_named_menu("prep"," Prep options ",-1);
++
++ curr = add_item("<b>aseurl by IP?","Specify gui baseurl by IP address",OPT_CHECKBOX,"baseurl=http://192.168.0.1",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("<m>ountcd?","Mount the cdrom drive?",OPT_CHECKBOX,"mountcd",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("Network Initialization","How to initialise network device?",OPT_RADIOMENU,"netmenu",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("","",OPT_SEP,"",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("Reinstall <w>indows","Re-install the windows side of a dual boot setup",OPT_CHECKBOX,"repair=win",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("Reinstall <l>inux","Re-install the linux side of a dual boot setup",OPT_CHECKBOX,"repair=lin",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("","",OPT_SEP,"",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("<R>un prep now","Execute prep with the above options",OPT_RUN,"prep",0);
++ set_xtra(curr,"prep","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("<E>xit this menu","Go up one level",OPT_EXITMENU,"",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++/* ------- MENU main ----- */
++ add_named_menu("main"," Main Menu ",-1);
++
++ curr = add_item(loginstr,"Login/Logout of authentication system",OPT_RUN,NULL,0);
++ curr->helpid = 65535;
++ curr->handler = &login_handler;
++
++ curr = add_item("<P>repare","prep",OPT_RUN,"prep",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("<P>rep options...","Options for prep",OPT_SUBMENU,"prep",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("<R>escue options...","Troubleshoot a system",OPT_SUBMENU,"rescue",0);
++ set_xtra(curr,"","",26,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("<T>esting...","Options to test hardware",OPT_SUBMENU,"testing",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++
++ curr = add_item("<E>xit to prompt","Exit the menu system",OPT_EXITMENU,"",0);
++ set_xtra(curr,"","",65535,0); // Set associated extra info
++ set_shortcut(-1);
++/* ------- END OF MENU declarations ----- */
++
++// Check if we should skip the menu altogether
++ quit = 0; // Dont skip the menu
++ if (getshiftflags() & skipbits) { // we must skip the menu altogther and execute skipcmd
++ dotrv = execdotcmd(skipcmd,".beep%.exit",NULL); // Worst case we beep and exit
++ if (dotrv == QUIT_CMD) quit = 1;
++ }
++
++// Switch vide mode if required
++ if (vmode != 0xFF) setvideomode(vmode);
++
++// Do we have a startfile to display?
++ if (startfile[0] != '\0') runhelp(startfile);
++
++// The main loop
++ while (quit == 0) { // As long as quit is zero repeat
++ curr = showmenus(find_menu_num("main")); // Initial menu is the one called "main"
++
++ if (curr) {
++ if (curr->action == OPT_RUN) {
++ ecmd = (char *)malloc(sizeof(char)*MAX_CMD_LINE_LENGTH);
++ gencommand(curr,ecmd);
++ temp = (curr->extra_data ? ((pt_xtra)curr->extra_data)->ipappend : 0);
++ runsyslinuximage(ecmd,temp);
++ // kernel not found so execute the appropriate dot command
++ dotrv = execdotcmd(onerrcmd,".quit",ecmd); // pass bad cmdline as arg
++ if (dotrv== QUIT_CMD) quit = 1;
++ free(ecmd); ecmd = NULL;
++ }
++ else csprint("Error in programming!",0x07);
++ } else {
++ // find effective exit command
++ ecmd = ( isallowed(username,"root") ? exitcmdroot : exitcmd);
++ dotrv = execdotcmd(ecmd,".repeat",NULL);
++ quit = (dotrv == QUIT_CMD ? 1 : 0); // should we exit now
++ }
++ }
++
++// Deallocate space used and quit
++ close_passwords();
++ close_help();
++ close_menusystem();
++ return 0;
++}
++
diff --git a/i486-stage2/uinit/DESCR b/i486-stage2/uinit/DESCR
new file mode 100644
index 0000000..2b74cf8
--- /dev/null
+++ b/i486-stage2/uinit/DESCR
@@ -0,0 +1,3 @@
+# uinit as temporary systemd replacement for PID 1, lives in the AUR
+FETCH_METHOD="yaourt"
+