ranger: Fix sh call and avoid hard links

This commit is contained in:
Fredrik Fornwall 2015-11-29 18:36:59 -05:00
parent 17ea4d62a0
commit 38c333e01a
3 changed files with 35 additions and 2 deletions

View File

@ -1,6 +1,7 @@
TERMUX_PKG_HOMEPAGE=http://ranger.nongnu.org/
TERMUX_PKG_DESCRIPTION="File manager with VI key bindings"
TERMUX_PKG_VERSION=1.7.2
TERMUX_PKG_BUILD_REVISION=1
TERMUX_PKG_SRCURL=http://ranger.nongnu.org/ranger-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_DEPENDS="python, file"
TERMUX_PKG_FOLDERNAME=ranger-${TERMUX_PKG_VERSION}

View File

@ -0,0 +1,32 @@
Hard links do not work on Android starting from 6.0.
diff -u -r ../ranger-1.7.2/ranger/core/actions.py ./ranger/core/actions.py
--- ../ranger-1.7.2/ranger/core/actions.py 2015-10-03 19:46:45.000000000 -0400
+++ ./ranger/core/actions.py 2015-11-28 17:30:53.302748825 -0500
@@ -8,7 +8,7 @@
import string
import tempfile
from os.path import join, isdir, realpath, exists
-from os import link, symlink, getcwd, listdir, stat
+from os import symlink, getcwd, listdir, stat
from inspect import cleandoc
from stat import S_IEXEC
from hashlib import sha1
@@ -1191,7 +1191,7 @@
for f in self.copy_buffer:
try:
new_name = next_available_filename(f.basename)
- link(f.path, join(getcwd(), new_name))
+ symlink(f.path, join(getcwd(), new_name))
except Exception as x:
self.notify(x)
@@ -1214,7 +1214,7 @@
else:
if not exists(target_path) \
or stat(source_path).st_ino != stat(target_path).st_ino:
- link(source_path,
+ symlink(source_path,
next_available_filename(target_path))
def paste(self, overwrite=False, append=False):

View File

@ -6,7 +6,7 @@ diff -u -r ../ranger-1.7.0/ranger/config/commands.py ./ranger/config/commands.py
# Do the renaming
- self.fm.run(['/bin/sh', cmdfile.name], flags='w')
+ self.fm.run(['/system/bin/sh', cmdfile.name], flags='w')
+ self.fm.run(['@TERMUX_PREFIX@/bin/sh', cmdfile.name], flags='w')
cmdfile.close()
# Retag the files, but only if the script wasn't changed during review,
@ -18,7 +18,7 @@ diff -u -r ../ranger-1.7.0/ranger/ext/rifle.py ./ranger/ext/rifle.py
prefix = ['sudo', '-E', 'su', '-mc']
else:
- prefix = ['/bin/sh', '-c']
+ prefix = ['/system/bin/sh', '-c']
+ prefix = ['@TERMUX_PREFIX@/bin/sh', '-c']
cmd = prefix + [command]
if 't' in flags: