diff --git a/Makefile b/Makefile index 7bb882f..f0e33cd 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,4 @@ #!/usr/bin/make -f -#!/usr/bin/make -f #SHELL := /bin/bash MAKEFILE_FILEPATH := $(abspath $(lastword $(MAKEFILE_LIST))) @@ -7,52 +6,58 @@ MAKEFILE_DIR := $(notdir $(patsubst %/,%,$(dir $(MAKEFILE_FILEPATH)))) MAKEFILE_PATH := $(dir $(MAKEFILE_FILEPATH)) CMAKE_COMMAND = cmake -#CMAKE_SOURCE_DIR = $(MAKEFILE_PATH)source -#CMAKE_BUILD_DIR = $(MAKEFILE_PATH)compile -CMAKE_SOURCE_DIR = ./source -CMAKE_BUILD_DIR = ./compile -DEPENDS = cmake -pkgname = $(MAKEFILE_DIR) -#pkgname = ublexec -pkgdir = ${DESTDIR} +CMAKE_SOURCE_DIR = $(MAKEFILE_PATH)source +CMAKE_BUILD_DIR = $(MAKEFILE_PATH)compile +#CMAKE_SOURCE_DIR = ./source +#CMAKE_BUILD_DIR = ./compile +FILE_VERSION = VERSION.md +DEPENDS = /bin/cmake +PREFIX ?= /usr +PKGNAME = $(MAKEFILE_DIR) +#PKGNAME = ublexec default_target: all + +.PHONY: all init depend debug prepare check build uninstall install clean up_ver help + all: init build init: @echo "Initialize ..."; \ - sed -r "s/(version_application = ).*/\1\"$$(grep 'VERSION' VERSION.md | cut -d" " -f2)\";/" -i source/ublexec.h; \ + sed -r "s/(version_application = ).*/\1\"$$(grep 'VERSION' ${FILE_VERSION} | cut -d" " -f2)\";/" -i source/ublexec.h; \ echo "-- Build path: ${CMAKE_BUILD_DIR}" depend: - @echo "Check depends ..."; \ - if [ ! -f /bin/${DEPENDS} ]; then \ - echo "-- Depend '${DEPENDS}' not fount !"; \ - exit 1; \ - fi; \ + @echo "Check depends ..." + @for FILE_DEPEND in $(DEPENDS); do \ + if [ ! -f $${FILE_DEPEND} ]; then \ + echo "ERROR: Depend '$${FILE_DEPEND}' not found !"; \ + exit 1; \ + fi; \ + done; \ echo "Check depends: OK" # $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 debug: @echo "Debug ..." if [ ! -d ${CMAKE_BUILD_DIR} ]; then \ - $(CMAKE_COMMAND) -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="/usr"; \ + $(CMAKE_COMMAND) -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="${PREFIX}"; \ fi; \ echo "Debug: OK" prepare: @echo "Prepare ..."; \ if [ ! -d ${CMAKE_BUILD_DIR} ]; then \ - $(CMAKE_COMMAND) -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/usr"; \ + $(CMAKE_COMMAND) -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}"; \ fi; \ echo "Prepare: OK" check: @echo "Check ..."; \ - if [ -f ${CMAKE_BUILD_DIR}/${pkgname} ]; then \ + if [ -f ${CMAKE_BUILD_DIR}/${PKGNAME} ]; then \ echo "Check: OK"; \ else \ - echo "Check: ${CMAKE_BUILD_DIR}/${pkgname} not fount !"; \ + echo "Check: ${CMAKE_BUILD_DIR}/${PKGNAME} not found !"; \ exit 1; \ fi @@ -66,53 +71,57 @@ uninstall: @for FILE_PO in $(wildcard *.po); do \ LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \ FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \ - PATH_FILE_MO="/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ - $(RM) "/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ + PATH_FILE_MO="${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ + $(RM) "${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ done @for SIZE in 16x16 32x32 48x48 scalable; do \ - $(RM) "/usr/share/icons/hicolor/$${SIZE}/apps/ru.ublinux.${pkgname}.svg"; \ - $(RM) "/usr/share/icons/hicolor/$${SIZE}/apps/ru.ublinux.${pkgname}.png"; \ + $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}/apps/com.ublinux.${PKGNAME}.svg"; \ + $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}/apps/com.ublinux.${PKGNAME}.png"; \ done @for FILE_SVG in $(wildcard *.svg); do \ for SIZE in 16x16 32x32 48x48 scalable; do \ - $(RM) "/usr/share/icons/hicolor/$${SIZE}/status/$${FILE_SVG%.*}".{svg,png,jpg}; \ + $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}/status/$${FILE_SVG%.*}".{svg,png,jpg}; \ done; \ done - @$(RM) "/usr/bin/${pkgname}" - @$(RM) "/usr/share/applications/${pkgname}.desktop" - @$(RM) "/usr/share/polkit-1/actions/ru.ublinux.pkexec.${pkgname}.exec.policy" - @$(RM) -rd "/usr/share/${pkgname}" - @gtk-update-icon-cache -fiq /usr/share/icons/hicolor/ &>/dev/null || true + @$(RM) "${DESTDIR}${PREFIX}/bin/${PKGNAME}" + @$(RM) "${DESTDIR}${PREFIX}/share/applications/${PKGNAME}.desktop" + @$(RM) "${DESTDIR}${PREFIX}/share/${PKGNAME}/images/logo-background.png" + @$(RM) "${DESTDIR}${PREFIX}/share/polkit-1/actions/com.ublinux.pkexec.${PKGNAME}.exec.policy" + @$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/com.ublinux.${PKGNAME}.svg" + @$(RM) -rd "${DESTDIR}${PREFIX}/share/${PKGNAME}" + @[ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true @update-desktop-database --quiet &>/dev/null || true - @touch /usr/share/applications &>/dev/null || true + @[ -d "${DESTDIR}${PREFIX}/share/applications" ] && touch "${DESTDIR}${PREFIX}/share/applications" &>/dev/null || true @echo "Uninstall: OK" install: check uninstall @echo "Install ..." @for FILE_PO in $(wildcard *.po); do \ LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \ - install -dm755 "${pkgdir}/usr/share/locale/$${LANG}/LC_MESSAGES"; \ + install -dm755 "${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES"; \ FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \ - PATH_FILE_MO="${pkgdir}/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ + PATH_FILE_MO="${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ echo $${FILE_PO}; \ msgfmt "$${FILE_PO}" -v -f -o "$${PATH_FILE_MO}"; \ done @for SIZE in 16 32 48; do \ - install -dm755 "${pkgdir}/usr/share/icons/hicolor/$${SIZE}x$${SIZE}/apps"; \ - rsvg-convert -w $${SIZE} -h $${SIZE} -f png --keep-image-data "ru.ublinux.${pkgname}.svg" -o "${pkgdir}/usr/share/icons/hicolor/$${SIZE}x$${SIZE}/apps/ru.ublinux.${pkgname}.png"; \ + install -dm755 "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps"; \ + rsvg-convert -w $${SIZE} -h $${SIZE} -f png --keep-image-data "com.ublinux.${PKGNAME}.svg" -o "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps/com.ublinux.${PKGNAME}.png"; \ done - @install -dm755 "${pkgdir}/usr/share/icons/hicolor/scalable/apps" - @install -Dm644 -t "${pkgdir}/usr/share/icons/hicolor/scalable/apps/" "ru.ublinux.${pkgname}.svg" - @install -Dm755 -t "${pkgdir}/usr/bin/" "${CMAKE_BUILD_DIR}/${pkgname}" - @install -Dm644 -t "${pkgdir}/usr/share/applications/" "${pkgname}.desktop" - @install -Dm644 -t "${pkgdir}/usr/share/polkit-1/actions/" "com.ublinux.pkexec.${pkgname}.exec.policy" - @install -dm755 "${pkgdir}/usr/share/${pkgname}"/{ui,css,images} - @install -Dm644 -t "${pkgdir}/usr/share/${pkgname}/ui/" "${pkgname}.glade" - @install -Dm644 -t "${pkgdir}/usr/share/${pkgname}/css/" style.css - @install -Dm644 -t "${pkgdir}/usr/share/${pkgname}/images/" "logo-background.png" - @gtk-update-icon-cache -fiq /usr/share/icons/hicolor/ &>/dev/null || true + @install -dm755 "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/" "com.ublinux.${PKGNAME}.svg" + @install -Dm755 -t "${DESTDIR}${PREFIX}/bin/" "${CMAKE_BUILD_DIR}/${PKGNAME}" + @install -dm755 "${DESTDIR}${PREFIX}/share/applications" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/applications/" "${PKGNAME}.desktop" + @install -dm755 "${DESTDIR}${PREFIX}/share/polkit-1/actions" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/polkit-1/actions/" "com.ublinux.pkexec.${PKGNAME}.exec.policy" + @install -dm755 "${DESTDIR}${PREFIX}/share/${PKGNAME}"/{ui,css,images} + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/ui/" "${PKGNAME}.glade" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/css/" "${PKGNAME}.css" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/images/" "logo-background.png" + @gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true @update-desktop-database --quiet &>/dev/null || true - @touch /usr/share/applications &>/dev/null || true + @touch "${DESTDIR}${PREFIX}/share/applications" &>/dev/null || true @echo "Install: OK" clean: @@ -124,6 +133,14 @@ clean: echo "Clean: OK"; \ fi +up_ver: + @CURRENT=$$(grep 'VERSION' ${FILE_VERSION} | cut -d" " -f2); \ + MAJOR=$$(cut -d. -f1 <<< $${CURRENT}); \ + MINOR=$$(cut -d. -f2 <<< $${CURRENT}); \ + VER="$${MAJOR}.$$(($${MINOR}+1))"; \ + sed "s/VERSION *[[:digit:]]*.*/VERSION $${VER}/" -i ${FILE_VERSION}; \ + echo "Updated version to VERSION.md: $${CURRENT} to $${VER}" + help: @echo "The following are some of the valid targets for this Makefile:" @echo "... all (the default if no target is provided)" diff --git a/ru.ublinux.ublexec.svg b/com.ublinux.ublexec.svg similarity index 100% rename from ru.ublinux.ublexec.svg rename to com.ublinux.ublexec.svg diff --git a/devel/update-version b/devel/update-version deleted file mode 100755 index e86b1b4..0000000 --- a/devel/update-version +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -## -## Update VERSION 1.4 -## $1 - Version -## Default - current Version value plus one (in minor section) -## - -FILE_VERSION="VERSION.md" -[[ $1 ]] && VER=$1 -if [[ -z ${VER} ]] ; then - SOURCE_FILE_VERSION=$(find ../ -maxdepth 1 -type f -iname "${FILE_VERSION}" -print -quit) - CURRENT=$(cat ${SOURCE_FILE_VERSION} | grep 'VERSION' | cut -d" " -f2) - MAJOR=$(echo ${CURRENT} | cut -d. -f1) - MINOR=$(echo ${CURRENT} | cut -d. -f2) - VER="${MAJOR}.$(echo $((${MINOR} +1)))" -fi -echo ":: Updated VERSION ${CURRENT} to ${VER}" -find ../ -maxdepth 2 -type f -iname "${FILE_VERSION}" -exec echo ":: Insert version in file: {}" \; -exec sed "s/VERSION *[[:digit:]]*.*/VERSION ${VER}/" -i {} \; \ No newline at end of file diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 543d234..ab85d20 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -7,12 +7,12 @@ pkg_check_modules(GTK REQUIRED gtkmm-3.0) include_directories(${GTK_INCLUDE_DIRS}) link_directories(${GTK_LIBRARY_DIRS}) add_definitions(${GTK_CFLAGS_OTHER}) -find_package(Threads REQUIRED) #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -std=c++2a -g") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wmissing-declarations -fdiagnostics-color=always") -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \ + -O2 -pipe -fno-plt -fexceptions \ + -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \ + -fstack-clash-protection -fcf-protection") set(SOURCE_FILES main.cc @@ -26,5 +26,5 @@ set(LIBRARIES pthread) add_executable(ublexec ${SOURCE_FILES}) -target_link_libraries(ublexec ${LIBRARIES} Threads::Threads) +target_link_libraries(ublexec ${LIBRARIES}) install(TARGETS ublexec DESTINATION bin) diff --git a/source/ublexec.cc b/source/ublexec.cc index 2639d41..402fc4c 100644 --- a/source/ublexec.cc +++ b/source/ublexec.cc @@ -3,7 +3,7 @@ using namespace std; const string path_app = "/usr/bin/"; const string path_glade = "/usr/share/ublexec/ui/ublexec.glade"; -const string path_css = "/usr/share/ublexec/css/style.css"; +const string path_css = "/usr/share/ublexec/css/ublexec.css"; const string app_name = "ublexec"; int socket_ext_id_I = 0; int socket_trd_id_I = 0; @@ -162,7 +162,7 @@ void MainWindow::localization() { btnStart->set_label(_("Run")); wndChooseFileWallpaper->set_title(_("Please select File")); dialogStartMenu->set_title(_("Selecting Programs")); - lblInfoHead->set_text(_("Running applications as a user with a\nspecified priority")); + lblInfoHead->set_text(_("Run applications as another user\nwith the specified priority")); lblinfoCmd->set_text(_("Command Line")); lblInfoTime->set_text(_("Team:")); labInfoExecutTerm->set_text(_("Run in the terminal emulator")); diff --git a/source/ublexec.h b/source/ublexec.h index b14107b..f236971 100644 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -201,7 +201,7 @@ public: Gtk::Widget *boxAbout; public: string termunal_cmd[3] = {"konsole -e ", "xfce4-terminal -x ", "xterm -e "}; - string version_application = "1.2"; + string version_application = "2.23"; string cmd_old = ""; string user_exec_app = ""; string user_cmd = ""; diff --git a/style.css b/ublexec.css similarity index 100% rename from style.css rename to ublexec.css diff --git a/ublexec.desktop b/ublexec.desktop index 32baff5..846ac40 100644 --- a/ublexec.desktop +++ b/ublexec.desktop @@ -8,7 +8,7 @@ Comment=Run as another user Comment[ru]=Выполнить от другого пользователя Type=Application Exec=ublexec -Icon=ru.ublinux.ublexec +Icon=com.ublinux.ublexec Terminal=false X-XfcePluggable=true X-UBLPluggable=true diff --git a/ublexec.glade b/ublexec.glade index c7e888b..b52d4cd 100644 --- a/ublexec.glade +++ b/ublexec.glade @@ -28,7 +28,7 @@ Подробнее в <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, версии 2 или позднее</a>. UBGroup UBGroup - ru.ublinux.ublexec + com.ublinux.ublexec True gpl-2-0 @@ -66,7 +66,7 @@ 410 240 False - ru.ublinux.ublexec + com.ublinux.ublexec True @@ -1019,7 +1019,7 @@ False - ru.ublinux.ublexec + com.ublinux.ublexec True @@ -1040,7 +1040,7 @@ 6 6 69 - ru.ublinux.ublexec + com.ublinux.ublexec False @@ -1059,8 +1059,8 @@ 5 6 6 - Running applications as a user with a -specified priority + Run applications as another user +with the specified priority @@ -1862,7 +1862,7 @@ specified priority True False 32 - ru.ublinux.ublexec + com.ublinux.ublexec @@ -1904,7 +1904,7 @@ specified priority False Внимание! - ru.ublinux.ublexec + com.ublinux.ublexec dialog @@ -1965,7 +1965,7 @@ specified priority 500 400 True - ru.ublinux.ublexec + com.ublinux.ublexec dialog True True diff --git a/ublexec.pot b/ublexec.pot index efdccec..78e8b67 100644 --- a/ublexec.pot +++ b/ublexec.pot @@ -1,8 +1,22 @@ -# Russian translations for PACKAGE package. -# Copyright (C) 2023 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Automatically generated, 2023. +# Language translations for ublexec package. +# Copyright (C) 2022, UBTech LLC +# This file is distributed under the same license as the ublexec package. +# UBLinux Team , 2022 # +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: ublexec 1.0\n" +"Report-Msgid-Bugs-To: info@ublinux.com\n" +"POT-Creation-Date: 2023-01-01 00:00+0600\n" +"PO-Revision-Date: 2023-01-01 00:00+0600\n" +"Last-Translator: UBLinux Team \n" +"Language-Team: UBLinux Team \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + msgid "" msgstr "" @@ -57,13 +71,13 @@ msgstr "" msgid "ОК" msgstr "" -msgid "Exit" +msgid "Cancel" msgstr "" msgid "Selecting Programs" msgstr "" -msgid "Running applications as a user with a\nspecified priority" +msgid "Run applications as another user\nwith the specified priority" msgstr "" msgid "Team" @@ -126,8 +140,5 @@ msgstr "" msgid "ublexec" msgstr "" -msgid "ubl-exec" -msgstr "" - msgid "Copyright © UBSoft LLC, 2022 - " msgstr "" \ No newline at end of file diff --git a/ublexec_ru.po b/ublexec_ru.po index a427543..84f982c 100644 --- a/ublexec_ru.po +++ b/ublexec_ru.po @@ -1,16 +1,17 @@ -# Russian translations for PACKAGE package. -# Copyright (C) 2023 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Automatically generated, 2023. +# Russian translations for ublexec package. +# Copyright (C) 2022, UBTech LLC +# This file is distributed under the same license as the ublexec package. +# UBLinux Team , 2022 # +#, fuzzy msgid "" msgstr "" "Project-Id-Version: ublexec 1.0\n" -"Report-Msgid-Bugs-To: info@ublinux.ru\n" -"POT-Creation-Date: 2023-03-01 23:22+0600\n" -"PO-Revision-Date: 2023-03-01 23:28+0600\n" -"Last-Translator: ublinux \n" -"Language-Team: Russian - UBLinux Team \n" +"Report-Msgid-Bugs-To: info@ublinux.com\n" +"POT-Creation-Date: 2023-01-01 00:00+0600\n" +"PO-Revision-Date: 2023-01-01 00:00+0600\n" +"Last-Translator: UBLinux Team \n" +"Language-Team: Russian - UBLinux Team \n" "Language: Russian\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -67,14 +68,14 @@ msgstr "Графика" msgid "ОК" msgstr "ОК" -msgid "Exit" -msgstr "Выход" +msgid "Cancel" +msgstr "Отмена" msgid "Selecting Programs" msgstr "Выбор программ" -msgid "Running applications as a user with a\nspecified priority" -msgstr "Запуск приложений от имени пользователя с\nуказанным приоритетом" +msgid "Run applications as another user\nwith the specified priority" +msgstr "Запускать приложения от имени другого пользователя\nс указанным приоритетом" msgid "Team:" msgstr "Команда:" @@ -139,8 +140,5 @@ msgstr "Внимание!" msgid "ublexec" msgstr "Выполнить как..." -msgid "ubl-exec" -msgstr "ubl-exec" - msgid "Copyright © UBSoft LLC, 2022 - " msgstr "Авторские права © ООО \"Юбисофт\", 2022 - " \ No newline at end of file