Compare commits

...

1 Commits

Author SHA1 Message Date
Martchus 9187815002 WIP: Add wxhexeditor 2022-07-11 21:37:50 +02:00
3 changed files with 115 additions and 0 deletions

View File

@ -0,0 +1,65 @@
From f30fc44b365a99f7a784f10d15054b0a661f626d Mon Sep 17 00:00:00 2001
From: gitfib <gitfib@users.noreply.github.com>
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

View File

@ -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;

View File

@ -0,0 +1,36 @@
# Maintainer: Steven Honeyman <stevenhoneyman at gmail com>
# Maintainer: Maxim Fomin <maxim at fomin one>
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
}