From d50d35717333f089b5febf6a456f9042b6655687 Mon Sep 17 00:00:00 2001 From: ngn Date: Thu, 22 Feb 2024 20:31:10 +0300 Subject: [PATCH] fix: Fix path for the locales, return error when running as root --- Makefile | 6 +++--- locale/tr/LC_MESSAGES/xcfg.po | 30 ++++++++++++++++++------------ src/main.c | 7 ++++++- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 8f33d41..64fc176 100644 --- a/Makefile +++ b/Makefile @@ -20,16 +20,16 @@ dist/xcfg: $(SRCS) $(HEADERS) $(PO_FILES) fi; \ done @for po in $(PO_DIRS) ; do \ - msgfmt $$po/xcfg.po -o $$po/mp.mo ; \ + msgfmt $$po/xcfg.po -o $$po/xcfg.mo ; \ done install: mkdir -p $(DESTDIR)$(prefix)/bin install -m755 dist/xcfg $(DESTDIR)$(prefix)/bin/xcfg @for po in $(PO_DIRS) ; do \ - echo "installing locale: $$po/mp.mo" ; \ + echo "installing locale: $$po/xcfg.mo" ; \ mkdir -pv $(DESTDIR)/usr/share/$$po ; \ - cp $$po/mp.mo $(DESTDIR)/usr/share/$$po ; \ + cp $$po/xcfg.mo $(DESTDIR)/usr/share/$$po ; \ done uninstall: diff --git a/locale/tr/LC_MESSAGES/xcfg.po b/locale/tr/LC_MESSAGES/xcfg.po index f681872..56b7289 100644 --- a/locale/tr/LC_MESSAGES/xcfg.po +++ b/locale/tr/LC_MESSAGES/xcfg.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-02-21 22:39+0300\n" +"POT-Creation-Date: 2024-02-22 20:30+0300\n" "PO-Revision-Date: 2024-02-20 20:36+0300\n" "Last-Translator: \n" "Language-Team: Turkish \n" @@ -17,7 +17,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: src/main.c:101 src/main.c:238 +#: src/main.c:101 src/main.c:243 #, fuzzy msgid "Failed to get the home directory" msgstr "Ev dizini bulmak başarısız oldu" @@ -32,46 +32,52 @@ msgstr "%s dosyasını okumak için açmak başarısız oldu" msgid "Failed to open %s for writing" msgstr "%s dosyasını yazmak için açmak başarısız oldu" -#: src/main.c:152 src/main.c:244 +#: src/main.c:152 src/main.c:249 #, c-format msgid "Failed to write to %s" msgstr "%s dosyasına yazmak başarısız oldu" -#: src/main.c:184 +#: src/main.c:164 +msgid "You should use this script as a regular user, not as root!" +msgstr "" +"Bu betiği normal bir kullanıcı olarak kullanmalısınız, kök kullanıcı olarak " +"değil!" + +#: src/main.c:189 #, fuzzy msgid "mp is not installed!" msgstr "mp kurulu değil" -#: src/main.c:193 +#: src/main.c:198 msgid "Install doas or sudo to use this script" msgstr "Bu betiği kullanmak için doas ya da sudo kurun" -#: src/main.c:211 +#: src/main.c:216 msgid "Choose a desktop enviroment" msgstr "Bir masaüstü ortamı seçin" -#: src/main.c:217 +#: src/main.c:222 msgid "Yes" msgstr "Evet" -#: src/main.c:217 +#: src/main.c:222 msgid "No" msgstr "Hayır" -#: src/main.c:224 +#: src/main.c:229 msgid "Add auto-startx to shell configuration?" msgstr "Otomatik-startx kabuk konfigürasyonu ekle?" -#: src/main.c:250 +#: src/main.c:255 msgid "Configuration has been saved!" msgstr "Konfigürasyon kaydedildi!" -#: src/main.c:252 +#: src/main.c:257 #, fuzzy, c-format msgid "Installing %s" msgstr "%s kuruluyor" -#: src/main.c:258 +#: src/main.c:263 #, fuzzy msgid "Installation failed" msgstr "Kurulum başarısız oldu" diff --git a/src/main.c b/src/main.c index 9f9681c..a02cd2c 100644 --- a/src/main.c +++ b/src/main.c @@ -160,6 +160,11 @@ END: } int main(int argc, char** argv, char** envp){ + if(getuid()==0){ + error(_("You should use this script as a regular user, not as root!")); + return EXIT_FAILURE; + } + signal(SIGINT, SIG_IGN); setlocale(LC_ALL, ""); textdomain("mp"); @@ -185,7 +190,7 @@ int main(int argc, char** argv, char** envp){ return EXIT_FAILURE; } free(mpi_path); - + char* doas_path = check_path("doas"); if(NULL==doas_path) { doas_path = check_path("sudo");