From e92bf79bf2bea5025ef91d3ad06ed7e192e54b41 Mon Sep 17 00:00:00 2001 From: Hartmut Goebel Date: Sun, 31 Jan 2021 16:23:40 +0100 Subject: TEMP Add "playgound" for runninc plasma on another virtual terminal. Following the idea from +: Start an X11 server (provided by the host OS) on another virtual terminal and make this run the desktop. --- 99-playground/.xinitrc | 14 +++++ 99-playground/.xserverrc | 8 +++ 99-playground/00-README.txt | 54 +++++++++++++++++ 99-playground/00-setup.sh | 52 ++++++++++++++++ 99-playground/01-setup.sh | 38 ++++++++++++ 99-playground/desktop-manifest.scm | 116 ++++++++++++++++++++++++++++++++++++ 99-playground/unstrace.py | 119 +++++++++++++++++++++++++++++++++++++ 99-playground/xorg.conf | 54 +++++++++++++++++ 8 files changed, 455 insertions(+) create mode 100755 99-playground/.xinitrc create mode 100755 99-playground/.xserverrc create mode 100644 99-playground/00-README.txt create mode 100755 99-playground/00-setup.sh create mode 100755 99-playground/01-setup.sh create mode 100644 99-playground/desktop-manifest.scm create mode 100644 99-playground/unstrace.py create mode 100644 99-playground/xorg.conf diff --git a/99-playground/.xinitrc b/99-playground/.xinitrc new file mode 100755 index 0000000000..bade74592c --- /dev/null +++ b/99-playground/.xinitrc @@ -0,0 +1,14 @@ +#!/bin/sh + +exec >$HOME/xerrors 2>&1 + +# test: dies a simple X11 program start? +#exec xvt -geometry +1+1 -display $DISPLAY + +# start plasma under strace and collect trace files in /tmp +/usr/bin/rm -rf /tmp/trace.* +exec /usr/bin/strace -ff -o /tmp/trace.txt -e trace=file \ + -e trace=file \ + --no-abbrev -e abbrev=!execve -s 2000 \ + startplasma-x11 +#exec startplasma-x11 diff --git a/99-playground/.xserverrc b/99-playground/.xserverrc new file mode 100755 index 0000000000..1ee413d509 --- /dev/null +++ b/99-playground/.xserverrc @@ -0,0 +1,8 @@ +#!/bin/sh + +VTNR=$XDG_VTNR +((VTNR++)) # overwrite use next VT + +# Use the X server provided by the foreign system (host OS) +PATH=/usr/local/bin:/usr/bin +exec /usr/bin/Xorg -novtswitch -nolisten tcp "$@" vt$VTNR diff --git a/99-playground/00-README.txt b/99-playground/00-README.txt new file mode 100644 index 0000000000..f8e541ff61 --- /dev/null +++ b/99-playground/00-README.txt @@ -0,0 +1,54 @@ + +This directory contains file to test the desktop following the idea from +. +The basic idea: Start an X11 server (provided by the host OS) on another +virtual terminal and make this run the desktop. + +See comments in desktop-manifest.scm for which packages get installed and what +combinations I already treid. + + + +Brief howto +================= + +* Switch to a new virtual terminal (e.g Ctrl-Alt-F2) and login there + (maybe this is not necessary, but I was not able to start a new X11 server + from within my running X session) + +* cd here +* Adjust desktop-manifest.scm +* Adjust .xinitrc + +* Run ./00-setup.sh + + This script will set this directory as your HOME, create a Guix profile + containing the Plasma desktop and start the X11 server with the Plasma + desktop on the next virtaul terminal. + +* check results, refine packages, adjust desktop-manifest.scm redo :-) + +* new X-server will get DISPLAY :1. + To change this, change number at the end of 00-setup.sh and 01-setup.sh + + +Files +============ + +00-setup.sh - starts using a profile - might require tweaking +01-setup.sh - starts using an environment - unfinished +desktop-manifest.scm - packages to install. + Also contains information about what I already tried. + +.xserverrc - starts X server on next vt - called by xinit +.xinitrc - start the X clients, esp. the desktop + Use these scripts to be more flexible in adjusting environments + +xorg.conf - unused in the Plase desktop test playground. *-setup.sh uses the + host OS's xinit and the host OS's xorg.conf + +unstrace.py - unfinished helper to strip irrelevant information from + the strace logs + + + diff --git a/99-playground/00-setup.sh b/99-playground/00-setup.sh new file mode 100755 index 0000000000..b768228356 --- /dev/null +++ b/99-playground/00-setup.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +export HOME=$(dirname $(realpath "$0")) +echo $HOME + +cd $HOME +../pre-inst-env guix package -p ~/.desktop-profile -m ~/desktop-manifest.scm +if [ $? != 0 ] ; then + exit +fi + +export GUIX_PROFILE=${HOME}/.desktop-profile +#export XDG_CONFIG_DIRS="${GUIX_PROFILE}/etc/xdg" +#export XDG_DATA_DIRS="${GUIX_PROFILE}/share" + +# remove remainings from foreign distro +export QT4DOCDIR= +export QT5DOCDIR= +export QTDIR5= +export QTDIR= +export QT_PLUGIN_PATH= +export KDEINIT5_LIBRARY_PATH= +unset QT4DOCDIR QT5DOCDIR QTDIR5 QTDIR QT_PLUGIN_PATH KDEINIT5_LIBRARY_PATH + +PATH= +KDEINIT5_LIBRARY_PATH= +QT_PLUGIN_PATH= +source "${GUIX_PROFILE}/etc/profile" + +#export QT_LOGGING_RULES="*.debug=true" + +#export XDG_RUNTIME_DIR=$HOME/.run +#mkdir -p "$XDG_RUNTIME_DIR" +#chmod 0700 "$XDG_RUNTIME_DIR" + +echo PATH=$PATH +echo XDG_DATA_DIRS=$XDG_DATA_DIRS +echo XDG_CONFIG_DIRS=$XDG_CONFIG_DIRS +echo QT_PLUGIN_PATH=$QT_PLUGIN_PATH +echo KDEINIT5_LIBRARY_PATH=$KDEINIT5_LIBRARY_PATH +echo QML2_IMPORT_PATH=$QML2_IMPORT_PATH + +# DISPLAY must be *first* argument to xinit after `--`, otherwise +# xinit will assume display :0 +# Use the foreign system's xinit +# This will start the X server as defined in .xserverrc and +# connect the clients defined in .xinitrc to it. +# Use these scripts (instead of passing commands here) to be more flexible +# in adjusting environments +/usr/bin/xinit -- :1 + +#pkill -9 kwin_x11 baloo diff --git a/99-playground/01-setup.sh b/99-playground/01-setup.sh new file mode 100755 index 0000000000..debc1b8add --- /dev/null +++ b/99-playground/01-setup.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +if [ "$1" != "--in-environment" ] ; then + + export HOME=$(realpath $(dirname "$0")) + + exec ../pre-inst-env guix environment -m ~/desktop-manifest.scm \ + --pure \ + -- sh $0 --in-environment "$@" + exit +fi + +# in environment +shift # remove --in-environment + +#export QT_LOGGING_RULES="*.debug=true" + +#export XDG_RUNTIME_DIR=$HOME/.run +#mkdir -p "$XDG_RUNTIME_DIR" +#chmod 0700 "$XDG_RUNTIME_DIR" + +echo PATH=$PATH +echo XDG_DATA_DIRS=$XDG_DATA_DIRS +echo XDG_CONFIG_DIRS=$XDG_CONFIG_DIRS +echo QT_PLUGIN_PATH=$QT_PLUGIN_PATH +echo KDEINIT5_LIBRARY_PATH=$KDEINIT5_LIBRARY_PATH +echo QML2_IMPORT_PATH=$QML2_IMPORT_PATH + +# DISPLAY must be *first* argument to xinit after `--`, otherwise +# xinit will assume display :0 +# Use the foreign system's xinit +# This will start the X server as defined in .xserverrc and +# connect the clients defined in .xinitrc to it. +# Use these scripts (instead of passing commands here) to be more flexible +# in adjusting environments +/usr/bin/xinit -- :1 + +#pkill -9 kwin_x11 baloo diff --git a/99-playground/desktop-manifest.scm b/99-playground/desktop-manifest.scm new file mode 100644 index 0000000000..d5686a0bd2 --- /dev/null +++ b/99-playground/desktop-manifest.scm @@ -0,0 +1,116 @@ +;; For comparism from +;; https://guix.gnu.org/de/blog/2019/running-a-guix-xfce-desktop-on-centos-7/ +;; +;; (specifications->manifest +;; '("xfce" "xfce4-session" "xfconf" "xfce4-battery-plugin" +;; "pulseaudio" "xfce4-volumed-pulse" "xfce4-notifyd" +;; ;; Helpful graphical programs. +;; "mousepad" "orage" +;; ;; System configuration utilities. +;; "xbacklight" "pavucontrol" "stow" +;; ;; For HTTPS access. +;; "nss-certs" +;; ;; These utilities are provided by the host, but we want the Guix versions +;; ;; because they are likely better integrated and up to date. +;; "fontconfig" "bash-completion" "gnupg" "man-db" "git")) + + +;; I tried several combinations of packages to get Plasma Desktop running. +;; Asking at the KDE "distribution" mailinglist did not give an reasonable +;; answer. If you have contact to the Plasma core team, maybe someone there +;; can answer what is required to run the Plasma Desktop. +;; +;; In ../11-TODO-Plasma-Desktop-Service.txt you can find a collection of what +;; "task-plasma-desktop" or "task-plasma-desktop-minimal" meta-packages install +;; in some other distributions. +;; +;; Good Luck! + + +(specifications->manifest + '("plasma-desktop" + "plasma-workspace" ;; propagate? + "qtbase" ;; to not search Qt plugins in the host OS + + ;;-- theme/visual dependencies + "breeze" ; default theme + "breeze-icons" ;; required: default Icon theme - propagate? + "kirigami" "oxygen" + "qtquickcontrols2" ;; required by plasma-workspace and plasme-desktop + "qqc2-desktop-style" "font-liberation" + + ;; adding qtquickcontrols2 results in: + ;;;KCrash: Attempting to start /gnu/store/lif5pqmd3rk2cda9293gl386mp32zhi7-plasma-workspace-5.18.5/bin/.plasmashell-real + ;;;KCrash: Application '.plasmashell-real' crashing... + + ;;-- shell/QML dependencies + "kde-cli-tools" "kded" "kwin" "setxkbmap" + "qtgraphicaleffects" ;; required by plasma-workspace + + ;; --- addefd by hartmut + ;; ksplashqml requires: qtsvg qtimageformats kimageformats + "qtsvg" "qtimageformats" "kimageformats" + + "plasma-workspace-wallpapers" ;; dpendency of workspace already? + "plasma-integration" ;; - KDEPlasmaPlatformTheme.so - propagte with breeze? + + "kinit" ;; propagate with plasma-workspace - or hardcode path?! + "kglobalaccel" + ;; kapplymousetheme + "libkscreen" ;; actually required? + "kscreen" ;;- branch kde-plasma - actually required? + "kservice" ;;- Tier 3 solution for working with .desktop files. - actually required? + + ;; ---------- up to here: mini-desktop ----------------------- + + ;; + "kactivities" + "kactivitymanagerd" ;; - branch kde-plasma System service to manage user's activities + "kdeplasma-addons" ;; - branch kde-plasma + ;; "khotkeys" ;; - branch kde-plasma - editor komponent?? + ;; "kparts" + "krunner" + + "kitemviews" ;; irgendwas von da oben braucht das, ist baer nicht verbunden + + ;;"baloo" "milou" - file indexer and search plasmoid + + ;; ;; ------------------ + ;; ;; This was an attempt to install *all* KDE framework and Plasma packages + + ;; "kcoreaddons" "ki18n" "karchive" "kconfig" "kdoctools" + ;; "kwidgetsaddons" "kwindowsystem" + ;; "polkit-qt" + ;; "kcodecs" "kauth" "kcrash" "kdbusaddons" + ;; "kguiaddons" "kconfigwidgets" "kitemviews" "kiconthemes" "kcompletion" + ;; "kservice" "sonnet" + ;; "attica" "breeze-icons" "kglobalaccel" "ktextwidgets" "knotifications" + ;; "kxmlgui" + ;; "kbookmarks" "kjobwidgets" "kwallet" "solid" "kio" "taglib" "kirigami" + ;; "kpackage" "kparts" "kinit" + ;; "kactivities" "kdeclarative" "kidletime" "kunitconversion" + ;; "ksyntaxhighlighting" + ;; ;;"plasma-wayland-protocols" + ;; "kdnssd" "kitemmodels" "ktexteditor" "kwayland" "threadweaver" + ;; "kded" "kdesignerplugin" "kemoticons" "kfilemetadata" "knewstuff" "kpty" + ;; "plasma-framework" + ;; "baloo" "kde-frameworkintegration" "kactivities-stats" "kcmutils" "kdesu" + ;; "kholidays" + ;; "kimageformats" "knotifyconfig" "kpeople" "kplotting" "krunner" + ;; "kxmlrpcclient" "prison" + ;; "purpose" "qqc2-desktop-style" "syndication" "kjs" "kdecoration" + ;; "breeze" "libksysguard" + ;; "kuserfeedback" "kscreenlocker" + ;; ;;"kwayland-integration" "kwayland-server" + ;; "libkscreen" + ;; "khelpcenter" "kjsembed" + ;; ;;"kquickcharts" + ;; "kactivitymanagerd" "kwin" "milou" + ;; ;;"kio-extras" <--- not yet packaged + ;; "qca" + ;; "pulseaudio-qt" "ksysguard" "powerdevil" "systemsettings" + ;; ;;"kaccounts-integration" " kaccounts-providers" "ksysguardqml" ; not yet packaged + ;; "bluedevil" "discover" "kdeplasma-addons" + ;; "khotkeys" + ;; ;;"kinfocenter" -- application + )) diff --git a/99-playground/unstrace.py b/99-playground/unstrace.py new file mode 100644 index 0000000000..d74fb7d4b8 --- /dev/null +++ b/99-playground/unstrace.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python3 + +import re, os + +def split_args(args): + a = args.split('"', 1)[1] + a = a.split('"')[0] + return a + + +cmd_map = { + "statx": "stat", + "lstat": "stat", + "openat": "open", + "access": "stat", +} + +seen = set() + +def stage1(cmds): + last_cmd, last_path, last_rc = None, None, None + for cmd, path, rc in cmds: + if (cmd, path, rc) in seen: + continue + seen.add((cmd, path, rc)) + if (last_cmd == "open" and last_rc == False and + cmd == "stat" and rc == False and + os.path.dirname(last_path) == path): + # stat on dir after trying to access file + last_path = path + continue + if rc == last_rc: + # unchanged status + if path == last_path: + last_cmd, last_path, last_rc = cmd, path, rc + elif path.startswith(path): + last_path = path + last_cmd, last_path, last_rc = cmd, path, rc + else: + last_cmd, last_path, last_rc = cmd, path, rc + yield(cmd, path, rc) + else: + last_cmd, last_path, last_rc = cmd, path, rc + yield(cmd, path, rc) + +LIB_SEARCH = 1 +PLUGIN_SEARCH = 2 + +def stage2(cmds): + last_cmd, last_path, last_rc = None, None, None + state = None + for cmd, path, rc in cmds: + #breakpoint() + if (state == LIB_SEARCH): + if rc == True: + # found + searched_dirs = [] + yield cmd, path, rc + continue + elif os.path.basename(path) == last_path: + # still seeking + searched_dirs.append(os.path.dirname(path)) + continue + else: + #breakpoint() + # next library + for p in searched_dirs: + yield cmd, last_path + " " + p, False + searched_dirs = [] + + if (cmd == "open" and rc == False and + re.search(r'\.so(\.[0-9]+)?', path)): + # library, access failed here + state = LIB_SEARCH + searched_dirs = [os.path.dirname(path)] + last_path = os.path.basename(path) + else: + yield cmd, path, rc + + +def strip_store_names(cmds): + import pathlib + HOME = str(pathlib.Path.home()) + PWD = str(pathlib.Path.cwd()) + pwd_first = len(PWD) > len(HOME) + for cmd, path, result in cmds: + if path.startswith("/gnu/store/"): + path = "/gnu/store/…" + path[43:] + elif pwd_first and path.startswith(PWD): + path = "$PWD" + path[len(PWD):] + elif path.startswith(HOME): + path = "~" + path[len(HOME):] + elif path.startswith(PWD): + path = "$PWD" + path[len(PWD):] + yield cmd, path, result + + +def main(filename): + with open(filename) as fh: + lines = fh.readlines() + matches = (re.match(r"^(\w+)\(([^)]+)\) = (\S+).*", l) + for l in lines) + cmds = (m.groups() for m in matches if m) + cmds = ((cmd_map.get(cmd, cmd), split_args(path), int(result) >= 0) + for cmd, path, result in cmds + if not "/share/locale/" in path) + cmds = strip_store_names(cmds) + cmds = stage1(cmds) + cmds = stage2(cmds) + for cmd, path, rc in cmds: + print(cmd, path, "" if rc else "***") + + + +import argparse +parser = argparse.ArgumentParser() +parser.add_argument("filename") +args = parser.parse_args() +main(args.filename) diff --git a/99-playground/xorg.conf b/99-playground/xorg.conf new file mode 100644 index 0000000000..60884f509e --- /dev/null +++ b/99-playground/xorg.conf @@ -0,0 +1,54 @@ +################# +################# +################# This file is unused in the Plase desktop +################# test playground. +################# +################# + + + +# ********************************************************************** +# Refer to the xorg.conf man page for details about the format of +# this file. +# ********************************************************************** + +Section "ServerFlags" + #DontZoom # disable / (resolution switching) + #Option "DontZap" "False" # disable (server abort) + AllowMouseOpenFail # allows the server to start up even if the mouse does not work +EndSection + +Section "Module" + #Load "v4l" # Video for Linux +EndSection + +Section "Monitor" + Identifier "monitor1" + VendorName "Plug'n Play" + + # TV fullscreen mode or DVD fullscreen output. + # 768x576 @ 79 Hz, 50 kHz hsync + ModeLine "768x576" 50.00 768 832 846 1000 576 590 595 630 + + # 768x576 @ 100 Hz, 61.6 kHz hsync + ModeLine "768x576" 63.07 768 800 960 1024 576 578 590 616 +EndSection + +Section "Device" + Identifier "device1" + VendorName "Intel Corporation" + BoardName "Intel 810 and later" + #Driver "intel" + Option "DPMS" +EndSection + +Section "Screen" + Identifier "screen1" + Device "device1" + Monitor "monitor1" +EndSection + +Section "ServerLayout" + Identifier "layout1" + Screen "screen1" +EndSection -- cgit v1.2.3