From 11f339a3688a8041854a0870ecb7f954ffd4ab86 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Thu, 3 Aug 2023 15:06:57 +0200 Subject: added slock (not unlocking the screen yet) --- README | 4 +++- configs/versions | 1 + patches/slock-no-xrandr.patch | 26 ++++++++++++++++++++++++++ patches/slock-tcc.patch | 14 ++++++++++++++ scripts/build.sh | 17 +++++++++++++++++ scripts/download.sh | 7 +++++++ 6 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 patches/slock-no-xrandr.patch create mode 100644 patches/slock-tcc.patch diff --git a/README b/README index f3f3350..84f35ea 100644 --- a/README +++ b/README @@ -515,7 +515,9 @@ Call Trace: - depth 16 -> 24 on Xfbdev? - meh segfaults with the test.qoi image from the meh branch in qemu, works on the host - +- slock runs but cannot unlock the screen (shadow issue?), also we need + a hard-coded nobody and nogroup user and group + tools ----- diff --git a/configs/versions b/configs/versions index f48822c..da69028 100644 --- a/configs/versions +++ b/configs/versions @@ -29,6 +29,7 @@ RXVT_VERSION="2.6.4" XHOST_VERSION="1.0.8" XAUTH_VERSION="1.0.9" MEH_VERSION="041539e" +SLOCK_VERSION="4f04554" LUA_VERSION="5.1.5" NOTION_VERSION="435631f" WORDGRINDER_VERSION="0.8" diff --git a/patches/slock-no-xrandr.patch b/patches/slock-no-xrandr.patch new file mode 100644 index 0000000..d723604 --- /dev/null +++ b/patches/slock-no-xrandr.patch @@ -0,0 +1,26 @@ +diff -rauN slock/slock.c slock-no-xrandr-patch/slock.c +--- slock/slock.c 2023-08-03 14:54:34.474038914 +0200 ++++ slock-no-xrandr-patch/slock.c 2023-08-03 14:57:25.574289865 +0200 +@@ -272,8 +272,10 @@ + /* input is grabbed: we can lock the screen */ + if (ptgrab == GrabSuccess && kbgrab == GrabSuccess) { + XMapRaised(dpy, lock->win); ++#ifdef HAVE_XRANDR + if (rr->active) + XRRSelectInput(dpy, lock->win, RRScreenChangeNotifyMask); ++#endif + + XSelectInput(dpy, lock->root, SubstructureNotifyMask); + return lock; +@@ -356,7 +358,11 @@ + die("slock: setuid: %s\n", strerror(errno)); + + /* check for Xrandr support */ ++#ifdef HAVE_XRANDR + rr.active = XRRQueryExtension(dpy, &rr.evbase, &rr.errbase); ++#else ++ rr.active = 0; ++#endif + + /* get number of screens in display "dpy" and blank them */ + nscreens = ScreenCount(dpy); diff --git a/patches/slock-tcc.patch b/patches/slock-tcc.patch new file mode 100644 index 0000000..59b1a0a --- /dev/null +++ b/patches/slock-tcc.patch @@ -0,0 +1,14 @@ +diff -rauN slock/slock.c slock-tcc-patch/slock.c +--- slock/slock.c 2023-08-03 14:54:34.474038914 +0200 ++++ slock-tcc-patch/slock.c 2023-08-03 14:54:56.284070903 +0200 +@@ -348,8 +348,10 @@ + die("slock: cannot open display\n"); + + /* drop privileges */ ++#ifdef HAVE_SETGROUPS + if (setgroups(0, NULL) < 0) + die("slock: setgroups: %s\n", strerror(errno)); ++#endif + if (setgid(dgid) < 0) + die("slock: setgid: %s\n", strerror(errno)); + if (setuid(duid) < 0) diff --git a/scripts/build.sh b/scripts/build.sh index 18e20a0..d8a1bdd 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -552,6 +552,23 @@ else echo "stage1 meh exists" fi +if [ ! -f "${BASE}/build/stage1/bin/slock" ]; then + rm -rf "slock-${SLOCK_VERSION}" + tar xf "${BASE}/downloads/slock-${SLOCK_VERSION}.tar.gz" + cd "slock-${SLOCK_VERSION}" + cp config.def.h config.h + patch -Np1 < "${BASE}/patches/slock-tcc.patch" + patch -Np1 < "${BASE}/patches/slock-no-xrandr.patch" + make -j$CPUS CC="${BASE}/build/stage1/bin/i386-tcc" \ + VERSION="${SLOCK_VERSION}" \ + CFLAGS="-Os -DVERSION= -I${BASE}/build/stage1/include" \ + LDFLAGS="-static ${BASE}/build/stage1/lib/libXext.a ${BASE}/build/stage1/lib/libX11.a" + make -j$CPUS DESTDIR="${BASE}/build/stage1" PREFIX="" install + cd .. +else + echo "stage1 slock exists" +fi + if [ ! -f "${BASE}/build/stage1/bin/lua" ]; then rm -rf "lua-${LUA_VERSION}" tar xf "${BASE}/downloads/lua-${LUA_VERSION}.tar.gz" diff --git a/scripts/download.sh b/scripts/download.sh index e288445..0e4259c 100755 --- a/scripts/download.sh +++ b/scripts/download.sh @@ -165,6 +165,13 @@ if [ ! -f "${BASE}/downloads/meh-${MEH_VERSION}.tar.gz" ]; then rm -rf "meh-${MEH_VERSION}" fi +if [ ! -f "${BASE}/downloads/slock-${SLOCK_VERSION}.tar.gz" ]; then + git clone git://git.suckless.org/slock "slock-${SLOCK_VERSION}" + git -C "slock-${SLOCK_VERSION}" checkout "${SLOCK_VERSION}" + tar zcf "${BASE}/downloads/slock-${SLOCK_VERSION}.tar.gz" "slock-${SLOCK_VERSION}" + rm -rf "slock-${SLOCK_VERSION}" +fi + if [ ! -f "${BASE}/downloads/bdftopcf-${BDFTOPCF_VERSION}.tar.gz" ]; then wget -O "${BASE}/downloads/bdftopcf-${BDFTOPCF_VERSION}.tar.gz" \ "https://www.x.org/archive/individual/app/bdftopcf-${BDFTOPCF_VERSION}.tar.gz" -- cgit v1.2.3-54-g00ecf