Skip to content

Commit c353cc8

Browse files
committed
Add compatibility with AppImage AppDir
Update lib4bin Update README
1 parent 19665f3 commit c353cc8

File tree

4 files changed

+245
-36
lines changed

4 files changed

+245
-36
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sharun"
3-
version = "0.1.2"
3+
version = "0.1.3"
44
readme = "README.md"
55
license = "MIT"
66
repository = "https://github.com/VHSgunzo/sharun"

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ cp ./target/$(uname -m)-unknown-linux-musl/release/sharun .
8484
./test/sharun bash --version
8585
```
8686

87+
You can also create a symlink from `sharun` to `AppRun` and write the name of the executable file from the `bin` directory to the `AppName` file for compatibility with [AppImage](https://appimage.org) `AppDir`
88+
8789
# Screenshots:
8890
![tree](img/tree.png)
8991

lib4bin

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ try_cp() {
180180
[ "$VERBOSE" == 1 ] && \
181181
echo -n "cp: "
182182
cp $varg -f "$1" "$2"||exit 1
183+
chmod $varg 755 "$2"||exit 1
183184
fi
184185
}
185186
@@ -380,6 +381,13 @@ for binary in "${BINARY_LIST[@]}"
380381
IS_ELF32="$(grep -q 'ELF 32-bit'<<<"$FILE_INFO")"
381382
IS_EXECUTABLE="$(grep -o 'executable'<<<"$FILE_INFO")"
382383
info_msg "$YELLOW[ $binary_number ]: $BLUE[$binary_name] ${GREEN}..."
384+
if [ "$HARD_LINKS" == 1 ] && [[ -n "$IS_SCRIPT" || -n "$IS_STATIC" ]]
385+
then
386+
hard_links=0
387+
with_sharun=1
388+
fi
389+
hard_links=${HARD_LINKS:=0}
390+
with_sharun=${WITH_SHARUN:=0}
383391
if [ -n "$IS_EXECUTABLE" ] && [[ "$ANY_EXECUTABLE" == 1 || -n "$IS_ELF" ]]
384392
then
385393
needed_libs="$(print_needed "$binary_src_pth")"
@@ -391,17 +399,12 @@ for binary in "${BINARY_LIST[@]}"
391399
if [[ -n "$LIBS" && ! -n "$IS_SCRIPT" && ! -n "$IS_STATIC" ]]
392400
then
393401
INTERPRETER="$(basename "$(grep 'ld-linux'<<<"$LIBS"|cut -d'=' -f1|sed 's|\t||' )")"
394-
[[ "$CREATE_LINKS" == 1 && "$HARD_LINKS" == 1 && ! -x "${dst_dir}/sharun" ]] && \
395-
WITH_SHARUN=1
402+
[[ "$CREATE_LINKS" == 1 && "$hard_links" == 1 && ! -x "${dst_dir}/sharun" ]] && \
403+
with_sharun=1
396404
else
397-
if [[ -n "$IS_SCRIPT" || -n "$IS_STATIC" ]]
398-
then
399-
[ "$HARD_LINKS" == 1 ] && \
400-
WITH_SHARUN=1 && HARD_LINKS=0
401-
fi
402405
bin_dir_pth="$sharun_bin_dir_pth"
403406
fi
404-
if [[ "$WITH_SHARUN" == 1 && ! -x "${dst_dir}/sharun" ]]
407+
if [[ "$with_sharun" == 1 && ! -x "${dst_dir}/sharun" ]]
405408
then
406409
TMP_SHARUN="/tmp/sharun-$(uname -m)$([ "$UPX_SHARUN" != 1 ]||echo -upx)"
407410
SHARUN="${SHARUN:="$(readlink -f "$(which_exe sharun)")"}"
@@ -455,7 +458,7 @@ for binary in "${BINARY_LIST[@]}"
455458
if [ "$CREATE_LINKS" == 1 ]
456459
then
457460
try_mkdir "$sharun_bin_dir_pth"
458-
[ "$HARD_LINKS" == 1 ] && \
461+
[ "$hard_links" == 1 ] && \
459462
ln_args='-Pf'||ln_args='-sf'
460463
(try_cd "$sharun_bin_dir_pth"
461464
[ "$VERBOSE" != 1 ]||echo -n "ln: "
@@ -489,7 +492,7 @@ for binary in "${BINARY_LIST[@]}"
489492
[[ -n "$lib_src_real_pth" && "${LIBRARIES["$lib_src_real_pth"]}" != 1 ]]
490493
then
491494
try_mkdir "$lib_dst_dir_pth"
492-
if [[ "$HARD_LINKS" == 1 && ! -L "${dst_dir}/${lib_dir}" ]]
495+
if [[ "$hard_links" == 1 && ! -L "${dst_dir}/${lib_dir}" ]]
493496
then
494497
(try_cd "$dst_dir"
495498
try_ln shared/$lib_dir $lib_dir)||exit 1

0 commit comments

Comments
 (0)