Rename: Kometa -> M OS (Moscow OS), fix unpackaged files, drop pam-env

p11 2.0-alt1
Mikhail Novosyolov 3 years ago
parent 710e5e24e1
commit 4f52ccaf16
  1. 2
      .gear/rules
  2. 201
      kometa-xdg.spec
  3. 144
      mos-xdg.spec
  4. 2
      plasma5/XDG_CONFIG_DIRS/kdeglobals
  5. 24
      scripts/mos-xdg-env
  6. 4
      scripts/profile.sh
  7. 4
      scripts/systemd.sh
  8. 22
      scripts/test.sh

@ -1,2 +1,2 @@
tar: . name=kometa-xdg-@version@ base=kometa-xdg-@version@
tar: . name=@name@-@version@ base=@name@-@version@
copy: COPYING

@ -1,201 +0,0 @@
Name: kometa-xdg
Summary: XDG desktop settings for Kometa distros
Summary(ru): Настройки рабочего окружения дистрибутивов Комета
License: GPL-3.0
Group: Graphical desktop/Other
Version: 1.5
Release: alt1.1
Source0: kometa-xdg-%version.tar
Source1: COPYING
BuildArch: noarch
BuildRequires: rpm-macros-systemd
%description
XDG desktop settings for Kometa distros
%description -l ru_RU.UTF-8
Настройки рабочего окружения дистрибутивов Комета
#--------------------------------------------------------------
%package core
Summary: Engine to set distribution-specific desktop settings
Summary(ru): Движок установки дистрибутиво-специфичных настроек рабочего стола
Group: Graphical desktop/Other
Requires: sed
%description core
Engine to set distribution-specific desktop settings.
Sets environmental variables $XDG_CONFIG_DIRS and $XDG_DATA_DIRS,
adding /etc/xdg/kometa and /usr/share/kometa into them.
Can be used separately from Kometa.
%description -l ru_RU.UTF-8 core
Движок установки дистрибутиво-специфичных настроек рабочего стола.
Устонавливает переменные окружения $XDG_CONFIG_DIRS и $XDG_DATA_DIRS,
добавляя в них /etc/xdg/kometa и /usr/share/kometa.
Может быть использован вне кометы.
%files core
%doc COPYING
%dir /etc/xdg/kometa
%dir /usr/share/kometa
%_bindir/kometa-xdg-env
%_user_env_gen_dir/10-kometa-xdg.sh
/etc/profile.d/10-kometa-xdg.sh
#--------------------------------------------------------------
# alternatives between plasma5-classic, plasma5-foo etc. can be added later
%package plasma5-classic
Summary: KDE 5 desktop settings for classic variant of Kometa
Summary(ru): Настройки KDE 5 для классического варианта Кометы
Group: Graphical desktop/KDE
Requires: %name-core = %EVR
Requires: kometa-icons-theme-classic
%description plasma5-classic
KDE 5 desktop settings for classic variant of Kometa
%description -l ru_RU.UTF-8 plasma5-classic
Настройки KDE 5 для классического варианта Кометы
%files plasma5-classic
%doc COPYING
/etc/xdg/kometa/dolphinrc
/etc/xdg/kometa/kcminputrc
/etc/xdg/kometa/kdeglobals
/etc/xdg/kometa/kxkbrc
%dir /usr/share/kometa/kxmlgui5
%dir /usr/share/kometa/kxmlgui5/dolphin
/usr/share/kometa/kxmlgui5/dolphin/dolphinui.rc
#--------------------------------------------------------------
%define regex auth[[:space:]]([[:space:]]).*pam_env.so user_envfile=.kometa_env readenv=0 user_readenv=1
%package pam-env
Summary: Hack PAM configs to make Qt5 applications ran by usermode use Kometa icons
Summary(ru): Хак конфигов PAM, чтобы запущенные через usermode приложения на Qt5 использовали иконки Кометы
Group: System/Base
# %%_qt5_plugindir/platformthemes/libqgtk3.so
Requires: libqt5-gui
Requires: pam
Requires(post): /bin/echo
Requires(post): grep
Requires(post): pam-config
Requires(preun): grep
Requires(preun): sed
%description pam-env
Hack PAM configs to make Qt5 applications ran by usermode use Kometa icons.
%description -l ru_RU.UTF-8 pam-env
Некоторые приложения, например, acc (alterator-standalone), запускаются из-под
пользовательской сессии от root через usermode и при этом используют basealt
в качестве иконки. В KDE 5 под X11 приложение само после запуска устанавливает иконку
на панели задач. Темы иконок kometa* в качестве иконки basealt устанавливают логотип
Кометы вместо Базальта, чтобы не создавать ошибочное впечатление, что Комета — продукт
Базальта. Но из-под root Qt5 не узнает тему иконок и использует иконку basealt не из
темы Кометы. Этот пакет при установке подключает выставление переменной окружения
QT_QPA_PLATFORMTHEME=gtk3 для root, благодаря чему Qt5 начинает использовать
пользовательскую тему иконок под root. Удаление пакета отключает выставление переменной.
%files pam-env
# copied to /root/.kometa_env by scriptlet
%_datadir/kometa-pam-env
%post pam-env
# sisyphus_check does not allow to package files inside /root,
# that is why I have to make this hack.
# IMHO it's OK to package /root/* here as in rootfiles.
cp %_datadir/kometa-pam-env /root/.kometa_env
# This scriptlet sees if pam_env.so <...> exists in PAM configuration and adds it to there if it does not.
# It does not add if if a sysadmin manually commented it out.
# /etc/control.d/facilities/ seemed to be too complex and not easy to use for this task, so inventing a bicycle.
TEXT='auth\t\toptional\tpam_env.so user_envfile=.kometa_env readenv=0 user_readenv=1'
# based on /etc/control.d/facilities/pam_access
CONFIG_COMMON=/etc/pam.d/system-auth-common
CONFIG_SYSTEM=/etc/pam.d/system-auth
if [ -f "$CONFIG_COMMON" ]
then
CONFIG="$CONFIG_COMMON"
else
CONFIG="$(readlink -e "$CONFIG_SYSTEM")" || CONFIG="$CONFIG_SYSTEM"
fi
if ! grep -qE "%regex" "$CONFIG"
then
echo "Adding loading ~/.kometa_env into PAM configs..."
cp "$CONFIG" "$CONFIG".rpmsave
# do not rely that shell-builtin 'echo' is capable of '-e' (not POSIX sh)
/bin/echo -e "$TEXT" >> "$CONFIG"
fi
%preun pam-env
# Package removal, not upgrade
if [ "$1" -eq 0 ]; then
for file in /etc/pam.d/system-auth-common /etc/pam.d/system-auth
do
if grep -qE "^%regex" "$file"; then
echo "Removing loading ~/.kometa_env from PAM config ${file}..."
sed -i'.rpmsave' -E -e "/^%regex/d" "$file"
fi
done
unlink /root/.kometa_env
fi
#--------------------------------------------------------------
%prep
%setup -q
cp %SOURCE1 .
%build
:
%install
mkdir -p %buildroot%_bindir
mkdir -p %buildroot/etc/profile.d
mkdir -p %buildroot/usr/lib/systemd/user-environment-generators
install -m0755 scripts/kometa-xdg-env %buildroot%_bindir/kometa-xdg-env
# for console
install -m0755 scripts/profile.sh %buildroot/etc/profile.d/10-kometa-xdg.sh
# for dbus services
install -m0755 scripts/systemd.sh %buildroot%_user_env_gen_dir/10-kometa-xdg.sh
mkdir -p %buildroot/etc/xdg/kometa
cp -rv plasma5/XDG_CONFIG_DIRS/* %buildroot/etc/xdg/kometa
mkdir -p %buildroot/usr/share/kometa
cp -rv plasma5/XDG_DATA_DIRS/* %buildroot/usr/share/kometa
mkdir -p %buildroot%_datadir
echo QT_QPA_PLATFORMTHEME=gtk3 > %buildroot/%_datadir/kometa-pam-env
%check
cd scripts
./test.sh
%changelog
* Wed Feb 16 2022 Mikhail Novosyolov <mikhailnov@altlinux.org> 1.5-alt1.1
- Commit 1.5-alt1 by tema@
* Tue Feb 15 2022 Artem Proskurnev <tema@altlinux.org> 1.5-alt1
- Add power settings
- Add Dolphin filer panel
- Add "Set as wallpaper"
- Set Chromium as the default browser
* Fri Dec 24 2021 Mikhail Novosyolov <mikhailnov@altlinux.org> 1.4-alt1
- Add setting $XDG_DATA_DIRS, enable "Show Previews" button in Dolphin
- Tune description: note that kometa-xdg-core can be used just to set env outside of Kometa
* Thu Dec 16 2021 Mikhail Novosyolov <mikhailnov@altlinux.org> 1.3-alt1
- Turn off NumLock by default in KDE 5
* Thu Dec 16 2021 Mikhail Novosyolov <mikhailnov@altlinux.org> 1.2-alt1
- Hack to make alterator use correct icons (new subpackage kometa-xdg-pam-env)
- Use macro for directory with systemd user environment generators (thanks to ldv@)
* Tue Dec 14 2021 Mikhail Novosyolov <mikhailnov@altlinux.org> 1.1-alt1
- set default icon theme
* Tue Dec 14 2021 Mikhail Novosyolov <mikhailnov@altlinux.org> 1.0-alt1
- Init

@ -0,0 +1,144 @@
%define _unpackaged_files_terminate_build 1
Name: mos-xdg
Summary: XDG desktop settings for M OS distros
Summary(ru): Настройки рабочего окружения дистрибутивов М ОС
License: GPL-3.0
Group: Graphical desktop/Other
Version: 2.0
Release: alt1
Source0: %name-%version.tar
Source1: COPYING
BuildArch: noarch
BuildRequires: rpm-macros-systemd
%description
XDG desktop settings for M OS distros
%description -l ru_RU.UTF-8
Настройки рабочего окружения дистрибутивов М ОС
#--------------------------------------------------------------
%package core
Summary: Engine to set distribution-specific desktop settings
Summary(ru): Движок установки дистрибутиво-специфичных настроек рабочего стола
Group: Graphical desktop/Other
Requires: sed
# package was renamed
Obsoletes: kometa-xdg-core < 2.0
# this package was dropped as a very complex trick;
# icons are replaced by a filetrigger more reliably
Obsoletes: kometa-xdg-pam-env < 2.0
%description core
Engine to set distribution-specific desktop settings.
Sets environmental variables $XDG_CONFIG_DIRS and $XDG_DATA_DIRS,
adding /etc/xdg/mos and /usr/share/mos into them.
Can be used separately from M OS.
%description -l ru_RU.UTF-8 core
Движок установки дистрибутиво-специфичных настроек рабочего стола.
Устонавливает переменные окружения $XDG_CONFIG_DIRS и $XDG_DATA_DIRS,
добавляя в них /etc/xdg/mos и /usr/share/mos.
Может быть использован вне М ОС.
%files core
%doc COPYING
%dir /etc/xdg/mos
%dir /usr/share/mos
%_bindir/mos-xdg-env
%_user_env_gen_dir/10-mos-xdg.sh
/etc/profile.d/10-mos-xdg.sh
#--------------------------------------------------------------
# alternatives between plasma5-classic, plasma5-foo etc. can be added later
%package plasma5-classic
Summary: KDE 5 desktop settings for classic variant of M OS
Summary(ru): Настройки KDE 5 для классического варианта М ОС
Group: Graphical desktop/KDE
Requires: %name-core = %EVR
Requires: mos-icons-theme-classic
# package was renamed
Obsoletes: kometa-xdg-plasma5-classic < 2.0
%description plasma5-classic
KDE 5 desktop settings for classic variant of M OS
%description -l ru_RU.UTF-8 plasma5-classic
Настройки KDE 5 для классического варианта М ОС
%files plasma5-classic
%doc COPYING
/etc/xdg/mos/dolphinrc
/etc/xdg/mos/kcminputrc
/etc/xdg/mos/kdeglobals
/etc/xdg/mos/kxkbrc
/etc/xdg/mos/powermanagementprofilesrc
%dir /usr/share/mos/kxmlgui5
%dir /usr/share/mos/kxmlgui5/dolphin
%dir /usr/share/mos/kservices5
%dir /usr/share/mos/kservices5/ServiceMenus
/usr/share/mos/kxmlgui5/dolphin/dolphinui.rc
/usr/share/mos/kservices5/ServiceMenus/setAsWallpaper.desktop
#--------------------------------------------------------------
%prep
%setup -q
cp %SOURCE1 .
%build
:
%install
mkdir -p %buildroot%_bindir
mkdir -p %buildroot/etc/profile.d
mkdir -p %buildroot%_user_env_gen_dir
install -m0755 scripts/mos-xdg-env %buildroot%_bindir/mos-xdg-env
# for console
install -m0755 scripts/profile.sh %buildroot/etc/profile.d/10-mos-xdg.sh
# for dbus services
install -m0755 scripts/systemd.sh %buildroot%_user_env_gen_dir/10-mos-xdg.sh
mkdir -p %buildroot/etc/xdg/mos
cp -rv plasma5/XDG_CONFIG_DIRS/* %buildroot/etc/xdg/mos
mkdir -p %buildroot/usr/share/mos
cp -rv plasma5/XDG_DATA_DIRS/* %buildroot/usr/share/mos
%check
cd scripts
./test.sh
%changelog
* Tue Apr 26 2022 Mikhail Novosyolov <mikhailnov@altlinux.org> 2.0-alt1
- Rename from Kometa to M OS (Moscow OS)
- Drop pam-env hackery due to being useless (icons are reliably replaced by a filetrigger)
- Package /etc/xdg/mos/powermanagementprofilesrc
- Package /usr/share/mos/kservices5/ServiceMenus/setAsWallpaper.desktop
* Wed Feb 16 2022 Mikhail Novosyolov <mikhailnov@altlinux.org> 1.5-alt1.1
- Commit 1.5-alt1 by tema@
* Tue Feb 15 2022 Artem Proskurnev <tema@altlinux.org> 1.5-alt1
- Add power settings
- Add Dolphin filer panel
- Add "Set as wallpaper"
- Set Chromium as the default browser
* Fri Dec 24 2021 Mikhail Novosyolov <mikhailnov@altlinux.org> 1.4-alt1
- Add setting $XDG_DATA_DIRS, enable "Show Previews" button in Dolphin
- Tune description: note that mos-xdg-core can be used just to set env outside of Kometa
* Thu Dec 16 2021 Mikhail Novosyolov <mikhailnov@altlinux.org> 1.3-alt1
- Turn off NumLock by default in KDE 5
* Thu Dec 16 2021 Mikhail Novosyolov <mikhailnov@altlinux.org> 1.2-alt1
- Hack to make alterator use correct icons (new subpackage mos-xdg-pam-env)
- Use macro for directory with systemd user environment generators (thanks to ldv@)
* Tue Dec 14 2021 Mikhail Novosyolov <mikhailnov@altlinux.org> 1.1-alt1
- set default icon theme
* Tue Dec 14 2021 Mikhail Novosyolov <mikhailnov@altlinux.org> 1.0-alt1
- Init

@ -2,7 +2,7 @@
BrowserApplication=chromium.desktop
[Icons]
Theme=kometa-classic-light
Theme=mos-classic-light
[KDE]
SingleClick=false

@ -1,8 +1,8 @@
#!/bin/sh
KOMETA_XDG_TESTING="${KOMETA_XDG_TESTING:-0}"
KOMETA_XDG_TYPE="${KOMETA_XDG_TYPE:-}"
KOMETA_XDG_CONFIG_DIR=/etc/xdg/kometa
KOMETA_XDG_DATA_DIR=/usr/share/kometa
MOS_XDG_TESTING="${MOS_XDG_TESTING:-0}"
MOS_XDG_TYPE="${MOS_XDG_TYPE:-}"
MOS_XDG_CONFIG_DIR=/etc/xdg/mos
MOS_XDG_DATA_DIR=/usr/share/mos
XDG_CONFIG_DIRS="${XDG_CONFIG_DIRS:-}"
_check_runability(){
@ -10,7 +10,7 @@ _check_runability(){
systemd ) : ;;
profile ) : ;;
* )
echo 'Set $KOMETA_XDG_TYPE to systemd or profile!' >&2
echo 'Set $MOS_XDG_TYPE to systemd or profile!' >&2
return 1
;;
esac
@ -21,7 +21,7 @@ _check_runability(){
# and why does he do such a strange thing?!
# Example of what we have to do:
# convert XDG_CONFIG_DIRS=/home/user/.config/kdedefaults:/etc/kf5/xdg:/etc/xdg
# into XDG_CONFIG_DIRS=/home/user/.config/kdedefaults:/etc/xdg/kometa:/etc/kf5/xdg:/etc/xdg
# into XDG_CONFIG_DIRS=/home/user/.config/kdedefaults:/etc/xdg/mos:/etc/kf5/xdg:/etc/xdg
# I do not want to write very complex code to deal with all possible cases.
# Let's assume that current value:
# * is not a mess and is a valid value
@ -35,7 +35,7 @@ _mk_xdg_dirs(){
root1="$2"
# /etc/kf5/xdg, /usr/share/kf5
root2="$3"
# /etc/xdg/kometa, /usr/share/kometa
# /etc/xdg/mos, /usr/share/mos
add="$4"
case "$tmp" in
"" )
@ -58,7 +58,7 @@ _mk_xdg_dirs(){
;;
esac
case "$tmp" in
*:"$root1"/kometa:* | "$root1"/kometa:* )
*:"$root1"/mos:* | "$root1"/mos:* )
:
;;
*:"$root2":* )
@ -81,9 +81,9 @@ _main(){
_check_runability "$1"
# $XDG_DATA_DIRS may be added
local result_xdg_config_dirs
result_xdg_config_dirs="$(_mk_xdg_dirs "$XDG_CONFIG_DIRS" /etc/xdg /etc/kf5/xdg "$KOMETA_XDG_CONFIG_DIR")"
result_xdg_config_dirs="$(_mk_xdg_dirs "$XDG_CONFIG_DIRS" /etc/xdg /etc/kf5/xdg "$MOS_XDG_CONFIG_DIR")"
local result_xdg_data_dirs
result_xdg_data_dirs="$(_mk_xdg_dirs "$XDG_DATA_DIRS" /usr/share /usr/share/kf5 "$KOMETA_XDG_DATA_DIR")"
result_xdg_data_dirs="$(_mk_xdg_dirs "$XDG_DATA_DIRS" /usr/share /usr/share/kf5 "$MOS_XDG_DATA_DIR")"
case "$1" in
systemd )
echo XDG_CONFIG_DIRS="$result_xdg_config_dirs"
@ -96,6 +96,6 @@ _main(){
esac
}
if [ "$KOMETA_XDG_TESTING" = 0 ]; then
_main "$KOMETA_XDG_TYPE"
if [ "$MOS_XDG_TESTING" = 0 ]; then
_main "$MOS_XDG_TYPE"
fi

@ -1,3 +1,3 @@
#!/bin/sh
KOMETA_XDG_TYPE=profile
. kometa-xdg-env
MOS_XDG_TYPE=profile
. mos-xdg-env

@ -1,3 +1,3 @@
#!/bin/sh
KOMETA_XDG_TYPE=systemd
. kometa-xdg-env
MOS_XDG_TYPE=systemd
. mos-xdg-env

@ -2,20 +2,20 @@
set -x
set -e
trap 'if [ $? != 0 ]; then echo "ERROR!!!"; fi' EXIT
KOMETA_XDG_TESTING=1
KOMETA_XDG_CONFIG_DIR=/etc/xdg/kometa
KOMETA_XDG_DATA_DIR=/usr/share/kometa
MOS_XDG_TESTING=1
MOS_XDG_CONFIG_DIR=/etc/xdg/mos
MOS_XDG_DATA_DIR=/usr/share/mos
export PATH="$PWD:$PATH"
. ./kometa-xdg-env
. ./mos-xdg-env
# $XDG_CONFIG_DIRS
[ "$(_mk_xdg_dirs /etc/xdg /etc/xdg /etc/kf5/xdg "$KOMETA_XDG_CONFIG_DIR")" = $KOMETA_XDG_CONFIG_DIR:/etc/xdg ]
[ "$(_mk_xdg_dirs /etc/foo /etc/xdg /etc/kf5/xdg "$KOMETA_XDG_CONFIG_DIR")" = /etc/foo:$KOMETA_XDG_CONFIG_DIR:/etc/xdg ]
[ "$(_mk_xdg_dirs /etc/foo:/etc/xdg /etc/xdg /etc/kf5/xdg "$KOMETA_XDG_CONFIG_DIR")" = /etc/foo:$KOMETA_XDG_CONFIG_DIR:/etc/xdg ]
[ "$(_mk_xdg_dirs /etc/foo:$KOMETA_XDG_CONFIG_DIR:/etc/kf5/xdg:/etc/xdg /etc/xdg /etc/kf5/xdg "$KOMETA_XDG_CONFIG_DIR")" = /etc/foo:$KOMETA_XDG_CONFIG_DIR:/etc/kf5/xdg:/etc/xdg ]
[ "$(_mk_xdg_dirs /home/user/.config/kdedefaults:/etc/kf5/xdg:/etc/xdg /etc/xdg /etc/kf5/xdg "$KOMETA_XDG_CONFIG_DIR")" = /home/user/.config/kdedefaults:$KOMETA_XDG_CONFIG_DIR:/etc/kf5/xdg:/etc/xdg ]
[ "$(_mk_xdg_dirs /etc/xdg /etc/xdg /etc/kf5/xdg "$MOS_XDG_CONFIG_DIR")" = $MOS_XDG_CONFIG_DIR:/etc/xdg ]
[ "$(_mk_xdg_dirs /etc/foo /etc/xdg /etc/kf5/xdg "$MOS_XDG_CONFIG_DIR")" = /etc/foo:$MOS_XDG_CONFIG_DIR:/etc/xdg ]
[ "$(_mk_xdg_dirs /etc/foo:/etc/xdg /etc/xdg /etc/kf5/xdg "$MOS_XDG_CONFIG_DIR")" = /etc/foo:$MOS_XDG_CONFIG_DIR:/etc/xdg ]
[ "$(_mk_xdg_dirs /etc/foo:$MOS_XDG_CONFIG_DIR:/etc/kf5/xdg:/etc/xdg /etc/xdg /etc/kf5/xdg "$MOS_XDG_CONFIG_DIR")" = /etc/foo:$MOS_XDG_CONFIG_DIR:/etc/kf5/xdg:/etc/xdg ]
[ "$(_mk_xdg_dirs /home/user/.config/kdedefaults:/etc/kf5/xdg:/etc/xdg /etc/xdg /etc/kf5/xdg "$MOS_XDG_CONFIG_DIR")" = /home/user/.config/kdedefaults:$MOS_XDG_CONFIG_DIR:/etc/kf5/xdg:/etc/xdg ]
# https://bugzilla.altlinux.org/show_bug.cgi?id=41566
[ "$(_mk_xdg_dirs "" /etc/xdg /etc/kf5/xdg "$KOMETA_XDG_CONFIG_DIR")" = $KOMETA_XDG_CONFIG_DIR:/etc/kf5/xdg:/etc/xdg ]
[ "$(_mk_xdg_dirs "" /etc/xdg /etc/kf5/xdg "$MOS_XDG_CONFIG_DIR")" = $MOS_XDG_CONFIG_DIR:/etc/kf5/xdg:/etc/xdg ]
# $XDG_DATA_DIRS
[ "$(_mk_xdg_dirs /usr/share /usr/share /usr/share/kf5 "$KOMETA_XDG_DATA_DIR")" = $KOMETA_XDG_DATA_DIR:/usr/share ]
[ "$(_mk_xdg_dirs /usr/share /usr/share /usr/share/kf5 "$MOS_XDG_DATA_DIR")" = $MOS_XDG_DATA_DIR:/usr/share ]

Loading…
Cancel
Save