From 6ac4e5f49c3146df2f445531c6cf6365571315e7 Mon Sep 17 00:00:00 2001 From: "Sicelo A. Mhlongo" Date: Sat, 1 Feb 2025 00:39:06 +0200 Subject: [PATCH] device-nokia-n900: stop using /etc/skel (MR 6123) Drop all uses of the /etc/skel feature for adding configuration files and scripts to the user's $HOME. Files installed via /etc/skel are outside the control of the package manager and may result in broken installations. At the least, they are not updateable from the packaging. To implement this: * drop $HOME/.protip_shell.sh, whose usefulness is questionable * relocate i3blocks blocklets to /usr/share, and the config file to /etc/xdg, which is an i3blocks' standard search path (`man i3blocks`) * move the i3 configuration file to /etc/xdg, from where it can be picked up and included by the config file provided via postmarketos-ui-i3wm. Configs from $HOME are still parsed, and will be honored by i3wm, subject to i3's limitations in connection with including extra config files * at i3 startup, with the help of an external script, ensure there is an i3 config file in $HOME, even if empty. This prevents i3-config-wizard from running and mangling the config files * convert xdefaults to Xresources and store in /usr/share/X11. Load it to on the environment by calling `xrdb` during i3 startup --- device/community/device-nokia-n900/APKBUILD | 42 +++++++++---------- .../device-nokia-n900/i3wm/config-checker | 7 ++++ .../device-nokia-n900/i3wm/i3blocks.conf | 10 ++--- .../device-nokia-n900/i3wm/i3wm.conf | 6 ++- .../device-nokia-n900/i3wm/protip_shell.sh | 8 ---- .../{xdefaults => xresources} | 0 6 files changed, 37 insertions(+), 36 deletions(-) create mode 100644 device/community/device-nokia-n900/i3wm/config-checker delete mode 100644 device/community/device-nokia-n900/i3wm/protip_shell.sh rename device/community/device-nokia-n900/{xdefaults => xresources} (100%) diff --git a/device/community/device-nokia-n900/APKBUILD b/device/community/device-nokia-n900/APKBUILD index 497250b53..5349219ed 100644 --- a/device/community/device-nokia-n900/APKBUILD +++ b/device/community/device-nokia-n900/APKBUILD @@ -2,8 +2,8 @@ # Maintainer: Sicelo # Co-Maintainer: Danct12 pkgname=device-nokia-n900 -pkgver=37 -pkgrel=1 +pkgver=38 +pkgrel=0 pkgdesc="Nokia N900" url="https://postmarketos.org" arch="armv7" @@ -44,9 +44,9 @@ source=" device-nokia-n900.start deviceinfo modules-initfs + i3wm/config-checker i3wm/i3blocks.conf i3wm/i3wm.conf - i3wm/protip_shell.sh i3wm/scripts/battery-bq27200 i3wm/scripts/calendar i3wm/scripts/ofono @@ -70,8 +70,8 @@ source=" udev/90-touchscreen-dev.rules upower.conf x11-keymap - xdefaults xorg.conf + xresources " options="!check !archcheck" @@ -149,7 +149,7 @@ package() { x11() { install_if="$pkgname=$pkgver-r$pkgrel xorg-server" - depends="xset xinput scrot" + depends="xset xinput scrot xrdb" mkdir "$pkgdir"/etc/acpi install -D -m755 "$srcdir"/acpi_handler.sh \ "$pkgdir"/etc/acpi/handler.sh @@ -160,11 +160,11 @@ x11() { install -D -m644 "$srcdir"/xorg.conf \ "$subpkgdir"/etc/X11/xorg.conf.d/11-n900.conf install -Dm755 "$srcdir"/lock.sh \ - "$pkgdir"/usr/bin/lock.sh + "$subpkgdir"/usr/bin/lock.sh install -Dm755 "$srcdir"/proxishot.sh \ - "$pkgdir"/usr/bin/proxishot.sh - install -D -m644 "$srcdir"/xdefaults \ - "$subpkgdir"/etc/skel/.Xdefaults + "$subpkgdir"/usr/bin/proxishot.sh + install -Dm644 "$srcdir"/xresources \ + "$subpkgdir"/usr/share/X11/Xresources-mobile } xkeyboard_config() { @@ -178,19 +178,19 @@ i3wm() { install_if="$pkgname=$pkgver-r$pkgrel postmarketos-ui-i3wm" depends="unclutter-xfixes i3blocks rxvt-unicode upower brightnessctl" install -D -m644 "$srcdir"/i3wm.conf \ - "$subpkgdir"/etc/skel/.config/i3/config + "$subpkgdir"/etc/xdg/i3/config install -D -m644 "$srcdir"/i3blocks.conf \ - "$subpkgdir"/etc/skel/.config/i3blocks/config + "$subpkgdir"/etc/xdg/i3blocks/config install -D -m755 "$srcdir"/battery-bq27200 \ - "$subpkgdir"/etc/skel/.config/i3blocks/battery-bq27200 + "$subpkgdir"/usr/share/i3blocks/battery-bq27200 install -D -m755 "$srcdir"/ofono \ - "$subpkgdir"/etc/skel/.config/i3blocks/ofono + "$subpkgdir"/usr/share/i3blocks/ofono install -D -m755 "$srcdir"/calendar \ - "$subpkgdir"/etc/skel/.config/i3blocks/calendar + "$subpkgdir"/usr/share/i3blocks/calendar install -D -m755 "$srcdir"/wifi \ - "$subpkgdir"/etc/skel/.config/i3blocks/wifi - install -D -m755 "$srcdir"/protip_shell.sh \ - "$subpkgdir"/etc/skel/.protip_shell.sh + "$subpkgdir"/usr/share/i3blocks/wifi + install -D -m755 "$srcdir"/config-checker \ + "$subpkgdir"/usr/bin/i3-config-checker } upower() { @@ -220,9 +220,9 @@ c5b8e03ca9f720a794f2593a3e938640cbd91ac44dd761079bbf4614a0d288a9d7b72de8ed2493c0 e6bbac8de1a198ba716f44ade76606e1e0adcc574156b855ac41be5eb5308389d3277fd89cc34b119fbc33d9801ab9f79a6ff213392596bff40bc17e931c05ef device-nokia-n900.start 40aaeb44941a988ab8ec58d331bc6cd42c4a23c6b6e8fc302f9216a38b46baab38d0a0137606a5b7959a51326983c03d684615c5ba9c58b0e36314ec8c49cfbb deviceinfo f48b8dd7297d03008f73e1ecd55b77ace535ecb03f9bdf021123b96fb5f4fb491ff4c532e226b835c8118fa8d505cc4c635a2b604a3e42a162746021552a551c modules-initfs -826a3790b49324c1e61c75b6c0ffc043a2a1d7c13a8c554fb5eae4977af47a1ca93d70ef8c783d712b953b70e18ae58fa4c6a49bf97263398a01a0c4f91ebc8f i3blocks.conf -506accabcf9fb3e2a270228ea53fdcb57f51092d6e7126a631af8eed697cd882cc805b19cf255422284bec12c928b58219d173a4a790d784db5335a059b6bb4f i3wm.conf -0b80af9fd1f36e6bc06bdfdf48352897234ac7457210649016665da8570a5a64b8a0841b4fbeb64fd7054a5246a64718cf4412f8a53024ce39b28a80984972d8 protip_shell.sh +d7d1599a9952fd02d3cfbeaa6b3307251e765f98a9eb723237c94f585831cc8f11d9d30dbc0352e3b008224dec12b820cf86fa28a5e5ac303cfd03d80b8872f5 config-checker +a8152e94262629e11abdd8809d187c3b7ed1866a6128fb1f435e17e72120536ac8114262e66df6decb2627743027f2b923ddbe8a94e3e844099b6fad02ec252b i3blocks.conf +26261d6291c4cc476a36a11291a3676413ecc4fc6ee76394fead14e0c8955d28e782d4a26180034637fcf176c41f8a345886daf242eebf7e91dfd6a4bd29edbe i3wm.conf 6c6a70667f37807089adbb343c09d1f62d47b8e6c9c0a54f44790b822f8bff3dccae73341ef736b799fd6740bbd6e1f48e6e122c2e08520f71f6ad7434a47d2c battery-bq27200 d9ef88c714e9fce8822f63b7a9d7fc3e1ed472c8c876b44ba524d44efea322839f13ddd2fa652420608427ecf7279bfaac302c9b67667f32796ca21da332164d calendar 82038d38f94cb975a8d38914afca49b64957446bef7490ab684efa1df47ede2ea1c769045789bb9fded673345eea01911fbbf85fdb54c28685cad8022bfaafac ofono @@ -246,6 +246,6 @@ e440ed7a3070c17e003b86b72dbe6d8194d01b577ca8dd56dd066f216b6dda32bb965c780950f178 c6012aef28b096141b924fced226ec99fb93eb53b69c064a8887d8fecdf8dc08a3ba3db399e18d88374c6ef4c59013a30699c7e4d76e5cb771040582573a0527 90-touchscreen-dev.rules 9b99feee42dd6bdd122769994c786d3127c41e0aa3321f19c82a9d3845cf07b522908621a31cbddd9599fe18c5c37127d9b4be4255cd7fa8e0e8983bf73eb41b upower.conf c7837e6688f09c7d650ac7479b8881d4bad709480a71a1dea8b5bba4f4215d6b48a3aebd3f58923bbd48813559478d4ef137dcc9838d321722e141f0aa6a6085 x11-keymap -183dfdd545ba05e216209b1abe45e4af4e0ee16b2e73cff0e7ea7b9524ee35a1cf85213a77f32a1a94287aee6546885dbd71c6de1f4f1a1e2961e638ff27cdf6 xdefaults a91f98daa60efa2beb2ff6b405097f92edca5f1bbb9e7675499139be52ca2570712f8f06f9032ef29f636f99c8f8da8b992f746eab6424aac04260c16158bcc2 xorg.conf +183dfdd545ba05e216209b1abe45e4af4e0ee16b2e73cff0e7ea7b9524ee35a1cf85213a77f32a1a94287aee6546885dbd71c6de1f4f1a1e2961e638ff27cdf6 xresources " diff --git a/device/community/device-nokia-n900/i3wm/config-checker b/device/community/device-nokia-n900/i3wm/config-checker new file mode 100644 index 000000000..64a9fbb40 --- /dev/null +++ b/device/community/device-nokia-n900/i3wm/config-checker @@ -0,0 +1,7 @@ +#!/bin/sh +if [ ! -f "$HOME"/.config/i3/config ]; then + pkill -f i3-config-wizard + touch "$HOME"/.config/i3/config + pkill -f i3-config-wizard +fi +exit 0 diff --git a/device/community/device-nokia-n900/i3wm/i3blocks.conf b/device/community/device-nokia-n900/i3wm/i3blocks.conf index d067ae82b..a344aed44 100644 --- a/device/community/device-nokia-n900/i3wm/i3blocks.conf +++ b/device/community/device-nokia-n900/i3wm/i3blocks.conf @@ -1,20 +1,18 @@ -command=/usr/libexec/i3blocks/$BLOCK_NAME - [battery-bq27200] -command=~/.config/i3blocks/battery-bq27200 +command=/usr/share/i3blocks/battery-bq27200 label=BAT: interval=10 [ofono] -command=~/.config/i3blocks/ofono +command=/usr/share/i3blocks/ofono label=M: interval=10 [wifi] -command=~/.config/i3blocks/wifi +command=/usr/share/i3blocks/wifi label=W: interval=10 [calendar] -command=~/.config/i3blocks/calendar +command=/usr/share/i3blocks/calendar interval=10 diff --git a/device/community/device-nokia-n900/i3wm/i3wm.conf b/device/community/device-nokia-n900/i3wm/i3wm.conf index 21a047f18..db5cf764e 100644 --- a/device/community/device-nokia-n900/i3wm/i3wm.conf +++ b/device/community/device-nokia-n900/i3wm/i3wm.conf @@ -33,7 +33,7 @@ mode "mpd" { } mode "command" { - bindsym t exec urxvt -e ~/.protip_shell.sh; mode "default" + bindsym t exec urxvt; mode "default" bindsym d exec dmenu_run; mode "default" bindsym q mode "default" bindsym k kill; mode "default" @@ -89,6 +89,10 @@ bar { } } +# ensure there is an i3 config in $HOME to prevent the wizard from trying to create one +exec --no-startup-id i3-config-checker +# Apply Xresources +exec --no-startup-id xrdb -merge /usr/share/X11/Xresources-mobile # Hide mouse cursor exec --no-startup-id unclutter-xfixes --fork # Do not handle gpio_key events as they are handled by acpid diff --git a/device/community/device-nokia-n900/i3wm/protip_shell.sh b/device/community/device-nokia-n900/i3wm/protip_shell.sh deleted file mode 100644 index 149264ff6..000000000 --- a/device/community/device-nokia-n900/i3wm/protip_shell.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -( - green="\033[32m" - reset="\033[0m" - echo -e "${green}PROTIP:${reset} ^i (ctrl+i) does autocompletion" -) -exec sh diff --git a/device/community/device-nokia-n900/xdefaults b/device/community/device-nokia-n900/xresources similarity index 100% rename from device/community/device-nokia-n900/xdefaults rename to device/community/device-nokia-n900/xresources