Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
epmgpi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
epmgpi
Commits
72bfce45
Commit
72bfce45
authored
Jul 30, 2024
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added multilingual support
parent
70347a16
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
191 additions
and
45 deletions
+191
-45
Makefile
Makefile
+8
-1
epmgpi
bin/epmgpi
+51
-43
epmgpi.spec
epmgpi.spec
+2
-1
LINGUAS
po/LINGUAS
+2
-0
epmgpi.pot
po/epmgpi.pot
+64
-0
ru.po
po/ru.po
+64
-0
No files found.
Makefile
View file @
72bfce45
...
...
@@ -10,8 +10,9 @@ version := $(PKGVER)-$(PKGREL)
PREFIX
=
/usr
DATADIR
=
$(PREFIX)
/share
LOCALEDIR
=
$(DATADIR)
/locale
install
:
install_common
install
:
install_common
install_locale
install_common
:
mkdir
-p
$(DESTDIR)$(PREFIX)
/bin
...
...
@@ -20,3 +21,9 @@ install_common:
install
-p
-Dm
0644
epmgpi.desktop
$(DESTDIR)$(DATADIR)/applications/epmgpi.desktop
install
-p
-Dm
0644
epmgpi.svg
$(DESTDIR)$(DATADIR)/pixmaps/epmgpi.svg
install_locale
:
@
for
lang
in
$(
shell
cat
po/LINGUAS
)
;
do
\
mkdir
-p
$(DESTDIR)$(LOCALEDIR)
/
$$
lang/LC_MESSAGES
;
\
msgfmt
-o
$(DESTDIR)$(LOCALEDIR)
/
$$
lang/LC_MESSAGES/epmgpi.mo po/
$$
lang.po
;
\
done
bin/epmgpi
View file @
72bfce45
#!/bin/bash
export
TEXTDOMAIN
=
epmgpi
export
TEXTDOMAINDIR
=
/usr/share/locale
gtxt
()
{
gettext
"
$@
"
}
if
[
$(
id
-u
)
-eq
0
]
;
then
echo
"Нельзя запускать epmgpi от пользователя root
."
gtxt
"epmgpi cannot be run as root user
."
exit
1
fi
#
Временные файлы
#
Temporary files
clean_up_tmp
()
{
rm
-fr
"
$EPMGPI_TMP
"
}
EPMGPI_TMP
=
$(
mktemp
-d
-t
epmgpi.XXXXXXX
)
# shellcheck disable=SC2064
trap
"clean_up_tmp
$EPMGPI_TMP
"
EXIT
EPMGPI_LOG_FILE
=
"
$EPMGPI_TMP
/epmgpi.log"
#
Дефолтные параметры yad
#
Default yad parameters
YAD_DEFAULT
=
"/usr/bin/yad --window-icon=epmgpi --title=epmgpi --class=epmgpi"
VALID_FILE_EXTENSIONS
=(
...
...
@@ -24,22 +29,21 @@ VALID_FILE_EXTENSIONS=(
"*.appimage"
"*.AppImage"
"*.Appimage"
)
#
Уведомления
#
Notifications
ntf
()
{
notify-send
--icon
=
epmgpi
"
$1
"
}
#
Уведомление об ошибке
#
Error notification
ntf_error
()
{
notify-send
--icon
=
error
"
$1
"
}
#
Функция для вопроса пользователю, перепаковать ли пакет
#
Function to ask the user if the package should be repacked
repackq
()
{
# Не rpm файлы перепаковываются и без ключа --repack
if
[[
$PKG_PATH
==
*
.rpm
]]
;
then
$YAD_DEFAULT
--image
=
"dialog-question"
--text
"Перепаковать ли rpm файл для переопределения зависимостей?"
\
# Non-rpm files are repacked without --repack key
if
[[
$PKG_PATH
==
*
.rpm
]]
;
then
$YAD_DEFAULT
--image
=
"dialog-question"
--text
=
"
$(
gtxt
"Do you want to repack the rpm file to override dependencies?"
)
"
\
--button
=
"yad-yes:0"
\
--button
=
"yad-no:1"
...
...
@@ -56,13 +60,13 @@ repackq() {
echo
"
$EEPM_ARGS
"
}
# GUI
селектор пакетов
# GUI
package selector
pkgselection
()
{
$YAD_DEFAULT
--file
--file-filter
=
"
${
VALID_FILE_EXTENSIONS
[*]
}
"
}
yad_log_view
()
{
$YAD_DEFAULT
--title
=
"
Лог ошибки
"
--no-buttons
--text-align
=
center
\
$YAD_DEFAULT
--title
=
"
$(
gtxt
"Error Log"
)
"
--no-buttons
--text-align
=
center
\
--text-info
--show-uri
--wrap
--width
=
1200
--height
=
550
--uri-color
=
red
\
--filename
=
"
$EPMGPI_LOG_FILE
"
rm
"
$EPMGPI_LOG_FILE
"
...
...
@@ -73,7 +77,7 @@ epmgpi_logging() {
tee
-a
"
$EPMGPI_LOG_FILE
"
}
#
Проверка, пакет ли файл
#
Check if the file is a package
hack_for_paths_with_spaces
()
{
PKG_PATH
=
"
$1
"
local
PKG_NAME
...
...
@@ -83,70 +87,75 @@ hack_for_paths_with_spaces() {
echo
"
$PKG_SYMB_LINK_PATH
"
}
#
Установка пакета
#
Install package
installpkg
()
{
local
PKG_PATH
=
"
$1
"
local
EEPM_ARGS
=
"
$2
"
# Pkexec для выполнения от рута
# Тут есть костыль, который каждую строку с помощью sed делает с решеткой. YAD воспринимает только так.
(
# shellcheck disable=SC2086
# Pkexec for executing as root
(
/usr/bin/pkexec /usr/bin/epm
$EEPM_ARGS
"
$PKG_PATH
"
2>&1
exit_code
=
$?
case
$exit_code
in
0
)
echo
"Команда завершилась успешно"
ntf
"Пакет установлен!"
gtxt
"Command completed successfully"
echo
ntf
"
$(
gtxt
"Package installed!"
)
"
exit
0
;;
100
)
ntf_error
"
Пакет не установлен. Команда завершилась с ошибкой.
"
echo
"!!!
ОШИБКА EPMGPI
"
>>
"
$EPMGPI_LOG_FILE
"
ntf_error
"
$(
gtxt
"Package not installed. Command failed."
)
"
echo
"!!!
EPMGPI ERROR
"
>>
"
$EPMGPI_LOG_FILE
"
;;
126
)
ntf_error
"
Пакет не установлен. Действие прервано пользователем.
"
ntf_error
"
$(
gtxt
"Package not installed. Action canceled by the user."
)
"
exit
1
;;
*
)
ntf_error
"
Пакет не установлен.
"
echo
"!!!
ОШИБКА EPMGPI
"
>>
"
$EPMGPI_LOG_FILE
"
ntf_error
"
$(
gtxt
"Package not installed."
)
"
echo
"!!!
EPMGPI ERROR
"
>>
"
$EPMGPI_LOG_FILE
"
;;
esac
)
| epmgpi_logging |
sed
-u
's/^/# /'
|
$YAD_DEFAULT
\
--title
=
"
Установка пакета
"
\
--title
=
"
$(
gtxt
"Package Installation"
)
"
\
--progress
--width
=
800
--height
=
500
\
--enable-log
=
"
Лог
"
--log-expanded
--log-on-top
\
--enable-log
=
"
$(
gtxt
"Log"
)
"
--log-expanded
--log-on-top
\
--auto-kill
--auto-close
}
show_help
()
{
echo
"Использование:
$0
[опция] [путь-к-пакету]"
echo
"Опции:"
echo
" --help, -h Показать эту справку"
echo
" --version, -v Показать информацию о версии"
echo
"Передайте путь к пакету, если не хотите использовать окно выбора файла."
gtxt
"Usage: epmgpi [option] [path-to-package]"
echo
gtxt
"Options:"
echo
gtxt
" --help, -h Show this help"
echo
gtxt
" --version, -v Show version information"
echo
gtxt
"Pass the path to the package if you don't want to use the file selection dialog."
echo
}
main
()
{
local
PKG_PATH
local
FILE_PATH
FILE_PATH
=
"
$1
"
#
Проверка и вызов окна выбора файлов, если PKG_PATH не установлен
#
Check and call file selection dialog if PKG_PATH is not set
if
[[
-z
"
$FILE_PATH
"
]]
;
then
echo
"Путь к пакету не указан. Вызов функции выбора пакета
..."
gtxt
"Package path not specified. Calling package selection function
..."
FILE_PATH
=
$(
pkgselection
)
fi
if
[
!
-f
"
$FILE_PATH
"
]
;
then
echo
"Ошибка:
$FILE_PATH
- это не файл.
"
printf
"
$(
gtxt
"Error: %s is not a file."
)
\n
"
"
$FILE_PATH
"
exit
1
fi
if
echo
"
$FILE_PATH
"
|
grep
-q
" "
;
then
echo
"Путь к пакету содержит пробелы"
gtxt
"Package path contains spaces"
echo
PKG_PATH
=
$(
hack_for_paths_with_spaces
"
$FILE_PATH
"
)
else
PKG_PATH
=
$FILE_PATH
...
...
@@ -154,7 +163,7 @@ main() {
installpkg
"
$PKG_PATH
"
"
$(
repackq
)
"
if
grep
-q
"!!!
ОШИБКА EPMGPI
"
"
$EPMGPI_LOG_FILE
"
;
then
if
grep
-q
"!!!
EPMGPI ERROR
"
"
$EPMGPI_LOG_FILE
"
;
then
yad_log_view
fi
}
...
...
@@ -162,7 +171,6 @@ main() {
if
[[
$#
-eq
0
]]
;
then
main | epmgpi_logging
else
# Обработка аргументов
while
[[
$#
-gt
0
]]
;
do
case
"
$1
"
in
--help
|
-h
)
...
...
@@ -170,14 +178,15 @@ else
exit
0
;;
--version
|
-v
)
echo
"Версия 1.4"
gtxt
"Version:"
echo
" 1.5"
exit
0
;;
*
)
echo
"Переданы аргументы:
$1
"
printf
"
$(
gtxt
"Arguments passed: %s"
)
\n
"
"
$1
"
main
"
$(
realpath
"
$1
"
)
"
| epmgpi_logging
shift
;;
esac
done
fi
\ No newline at end of file
fi
epmgpi.spec
View file @
72bfce45
...
...
@@ -23,8 +23,9 @@ EPM GUI Package Installer was created to install packages
%install
%makeinstall_std
%find_lang %name
%files
%files
-f %name.lang
%doc LICENSE
%_bindir/epmgpi
%_desktopdir/epmgpi.desktop
...
...
po/LINGUAS
0 → 100644
View file @
72bfce45
ru
\ No newline at end of file
po/epmgpi.pot
0 → 100644
View file @
72bfce45
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Language: ru\n"
msgid "epmgpi cannot be run as root user."
msgstr ""
msgid "Do you want to repack the rpm file to override dependencies?"
msgstr ""
msgid "Command completed successfully"
msgstr ""
msgid "Package installed!"
msgstr ""
msgid "Package not installed. Command failed."
msgstr ""
msgid "Package not installed. Action canceled by the user."
msgstr ""
msgid "Package not installed."
msgstr ""
msgid "Package Installation"
msgstr ""
msgid "Error Log"
msgstr ""
msgid "Log"
msgstr ""
msgid "Version:"
msgstr "Версия:"
msgid "Usage: epmgpi [option] [path-to-package]"
msgstr ""
msgid "Options:"
msgstr ""
msgid " --help, -h Show this help"
msgstr ""
msgid " --version, -v Show version information"
msgstr ""
msgid "Pass the path to the package if you don't want to use the file selection dialog."
msgstr ""
msgid "Package path not specified. Calling package selection function..."
msgstr ""
msgid "Error: %s is not a file."
msgstr ""
msgid "Package path contains spaces"
msgstr ""
msgid "Arguments passed: %s"
msgstr ""
po/ru.po
0 → 100644
View file @
72bfce45
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Language: ru\n"
msgid "epmgpi cannot be run as root user."
msgstr "Нельзя запускать epmgpi от пользователя root."
msgid "Do you want to repack the rpm file to override dependencies?"
msgstr "Перепаковать ли rpm файл для переопределения зависимостей?"
msgid "Command completed successfully"
msgstr "Команда завершилась успешно"
msgid "Package installed!"
msgstr "Пакет установлен!"
msgid "Package not installed. Command failed."
msgstr "Пакет не установлен. Команда завершилась с ошибкой."
msgid "Package not installed. Action canceled by the user."
msgstr "Пакет не установлен. Действие прервано пользователем."
msgid "Package not installed."
msgstr "Пакет не установлен."
msgid "Package Installation"
msgstr "Установка пакета"
msgid "Error Log"
msgstr "Лог ошибки"
msgid "Log"
msgstr "Лог"
msgid "Version:"
msgstr "Версия:"
msgid "Usage: epmgpi [option] [path-to-package]"
msgstr "Использование: epmgpi [опция] [путь-к-пакету]"
msgid "Options:"
msgstr "Опции:"
msgid " --help, -h Show this help"
msgstr " --help, -h Показать эту справку"
msgid " --version, -v Show version information"
msgstr " --version, -v Показать информацию о версии"
msgid "Pass the path to the package if you don't want to use the file selection dialog."
msgstr "Передайте путь к пакету, если не хотите использовать окно выбора файла."
msgid "Package path not specified. Calling package selection function..."
msgstr "Путь к пакету не указан. Вызов функции выбора пакета..."
msgid "Error: %s is not a file."
msgstr "Ошибка: %s - это не файл."
msgid "Package path contains spaces"
msgstr "Путь к пакету содержит пробелы"
msgid "Arguments passed: %s"
msgstr "Переданы аргументы: %s"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment