From 91878150028a3757a7e5a8c5e304dc59cd401988 Mon Sep 17 00:00:00 2001 From: Martchus Date: Mon, 11 Jul 2022 21:37:45 +0200 Subject: [PATCH] WIP: Add wxhexeditor --- .../default/01-add-pkexec-support.patch | 65 +++++++++++++++++++ .../default/02-remove-strange-output.patch | 14 ++++ wxhexeditor/default/PKGBUILD | 36 ++++++++++ 3 files changed, 115 insertions(+) create mode 100644 wxhexeditor/default/01-add-pkexec-support.patch create mode 100644 wxhexeditor/default/02-remove-strange-output.patch create mode 100644 wxhexeditor/default/PKGBUILD diff --git a/wxhexeditor/default/01-add-pkexec-support.patch b/wxhexeditor/default/01-add-pkexec-support.patch new file mode 100644 index 00000000..c37c7a2f --- /dev/null +++ b/wxhexeditor/default/01-add-pkexec-support.patch @@ -0,0 +1,65 @@ +From f30fc44b365a99f7a784f10d15054b0a661f626d Mon Sep 17 00:00:00 2001 +From: gitfib +Date: Sat, 10 Aug 2019 14:00:50 +0300 +Subject: [PATCH] Add pkexec support + +--- + src/FAL.cpp | 22 +++++++++++++++------- + 1 file changed, 15 insertions(+), 7 deletions(-) + +diff --git a/src/FAL.cpp b/src/FAL.cpp +index cccb6fa..fb48e6d 100644 +--- a/src/FAL.cpp ++++ b/src/FAL.cpp +@@ -247,18 +247,22 @@ bool FAL::OSDependedOpen(wxFileName& myfilename, FileAccessMode FAM, unsigned Fo + //Changing owner of file... + //I think it's better than changing permissions directly. Doesn't it? + //Will restore owner on file close. +- wxString cmd; +- if( wxFile::Exists( wxT("/usr/bin/gnomesu"))) ++ wxString cmd, spacer = wxT(" "); ++ if ( wxFile::Exists( wxT("/usr/bin/pkexec"))){ ++ cmd = wxT("pkexec --user root chown \""); ++ spacer = wxT("\" \""); ++ } ++ else if( wxFile::Exists( wxT("/usr/bin/gnomesu"))) + cmd = wxT("gnomesu -u root -c \"chown "); + else if( wxFile::Exists( wxT("/usr/bin/gksu"))) + cmd = wxT("gksu -u root \"chown "); + else if( wxFile::Exists( wxT("/usr/bin/gksudo"))) + cmd = wxT("gksudo -u root \"chown "); + else{ +- wxMessageBox(_("For using this function, please install \"gnomesu\" or \"gksu\" tools first."),_("Error"), wxOK|wxCANCEL|wxICON_ERROR); ++ wxMessageBox(_("For using this function, please install \"pkexec\", \"gnomesu\" or \"gksu\" tools first."),_("Error"), wxOK|wxCANCEL|wxICON_ERROR); + return false; + } +- cmd+=wxGetUserId() + wxT(" ")+ myfilename.GetFullPath() +wxT("\""); ++ cmd+=wxGetUserId() + spacer + myfilename.GetFullPath() +wxT("\""); + #ifdef _DEBUG_ + std::cout << "Changing permission of " << myfilename.GetFullPath().ToAscii() << std::endl; + std::cout << cmd.ToAscii() << std::endl; +@@ -358,14 +362,18 @@ FAL::~FAL(){ + #ifndef __WXMSW__ + if(!oldOwner.IsEmpty() ){ + //Will restore owner on file close. +- wxString cmd; +- if( wxFile::Exists( wxT("/usr/bin/gnomesu"))) ++ wxString cmd, spacer = wxT(" "); ++ if ( wxFile::Exists( wxT("/usr/bin/pkexec"))){ ++ cmd = wxT("pkexec --user root chown \""); ++ spacer = wxT("\" \""); ++ } ++ else if( wxFile::Exists( wxT("/usr/bin/gnomesu"))) + cmd = wxT("gnomesu -c \"chown "); + else if( wxFile::Exists( wxT("/usr/bin/gksu"))) + cmd = wxT("gksu -u root \"chown "); + else if( wxFile::Exists( wxT("/usr/bin/gksudo"))) + cmd = wxT("gksudo -u root \"chown "); +- cmd += oldOwner + wxT(" ")+ the_file.GetFullPath() +wxT("\""); ++ cmd += oldOwner + spacer + the_file.GetFullPath() +wxT("\""); + #ifdef _DEBUG_ + std::cout << "Changing permission of " << the_file.GetFullPath().ToAscii() << std::endl; + std::cout << cmd.ToAscii() << std::endl; +-- +2.22.0 + diff --git a/wxhexeditor/default/02-remove-strange-output.patch b/wxhexeditor/default/02-remove-strange-output.patch new file mode 100644 index 00000000..d9a20103 --- /dev/null +++ b/wxhexeditor/default/02-remove-strange-output.patch @@ -0,0 +1,14 @@ +diff --git a/src/HexEditor.cpp b/src/HexEditor.cpp +index 8a69ba7..ca15563 100644 +--- a/src/HexEditor.cpp ++++ b/src/HexEditor.cpp +@@ -42,9 +42,6 @@ HexEditor::HexEditor( wxWindow* parent, + tagpanel(tagpanel_), + dasmpanel(dasmpanel_) { + ComparatorHexEditor=NULL; +- // Here, code praying to the GOD for protecting our open file from wxHexEditor's bugs and other things. +- // This is really crucial step! Be adviced to not remove it, even if you don't believer. +- printf("Rahman ve Rahim olan Allah'ın adıyla.\n"); + myfile = NULL; + #ifndef DO_NOT_USE_THREAD_FOR_SCROLL + myscrollthread = NULL; diff --git a/wxhexeditor/default/PKGBUILD b/wxhexeditor/default/PKGBUILD new file mode 100644 index 00000000..a5c0c2ee --- /dev/null +++ b/wxhexeditor/default/PKGBUILD @@ -0,0 +1,36 @@ +# Maintainer: Steven Honeyman +# Maintainer: Maxim Fomin + +pkgname=wxhexeditor +pkgver=0.24 +pkgrel=5 +pkgdesc="A free hex editor / disk editor for Linux, Windows and MacOSX" +arch=('i686' 'x86_64') +url="http://www.wxhexeditor.org" +license=('GPL2') +depends=('wxwidgets-gtk3') +makedepends=('python') +optdepends=('gksu: For root access support' + 'polkit: For root access support') +source=("https://github.com/EUA/wxHexEditor/archive/v$pkgver.tar.gz" + "01-add-pkexec-support.patch" + "02-remove-strange-output.patch") +md5sums=('1b77bddc026e22797fd0e7a82e52cd28' + 'e62ae9e6b0aac2afdcc41b51cab39272' + '9f8f2ea86c7cc1d4706ac8c4862cfb51') + +prepare() { + cd "$srcdir/wxHexEditor-$pkgver" + patch -Np1 -i "${srcdir}/01-add-pkexec-support.patch" + patch -Np1 -i "${srcdir}/02-remove-strange-output.patch" +} + +build() { + cd "$srcdir/wxHexEditor-$pkgver" + make WXCONFIG="/usr/bin/wx-config-gtk3" +} + +package() { + cd "$srcdir/wxHexEditor-$pkgver" + make WXCONFIG="/usr/bin/wx-config-gtk3" DESTDIR="$pkgdir" PREFIX="/usr" install +}