Skip to content

Commit 53f4c77

Browse files
authored
remove PATH_MAPPING_RELATIVE (#85)
There is no point in using this anymore, `PATH_MAPPING_HARDCODED` is better and happens automatically as well.
1 parent f847f7a commit 53f4c77

File tree

2 files changed

+11
-43
lines changed

2 files changed

+11
-43
lines changed

useful-tools/lib/exec.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,6 @@ static int exec_common(execve_func_t function, const char *filename, char* const
197197
}
198198
}
199199

200-
// Change working directory to ORIGINAL_WORKING_DIR if set
201-
const char* original_working_dir = getenv("ORIGINAL_WORKING_DIR");
202-
if (original_working_dir) {
203-
if (chdir(original_working_dir) == 0) {
204-
DEBUG_PRINT("Changed working directory to ORIGINAL_WORKING_DIR: %s\n", original_working_dir);
205-
unsetenv("ORIGINAL_WORKING_DIR");
206-
} else {
207-
DEBUG_PRINT("Failed to change working directory to: %s\n", original_working_dir);
208-
}
209-
}
210-
211200
int ret = function(filename, argv, env);
212201

213202
if (fullpath != filename)

useful-tools/quick-sharun.sh

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -690,14 +690,7 @@ _map_paths_ld_preload_open() {
690690
}
691691

692692
_map_paths_binary_patch() {
693-
if [ "$PATH_MAPPING_RELATIVE" = 1 ]; then
694-
EXEC_WRAPPER=1
695-
sed -i -e 's|/usr|././|g' "$APPDIR"/shared/bin/*
696-
echo 'ORIGINAL_WORKING_DIR=${PWD}' >> "$APPDIR"/.env
697-
echo 'SHARUN_WORKING_DIR=${SHARUN_DIR}' >> "$APPDIR"/.env
698-
_echo "* Patched away /usr from binaries..."
699-
echo ""
700-
elif [ "$PATH_MAPPING_HARDCODED" = 1 ]; then
693+
if [ "$PATH_MAPPING_HARDCODED" = 1 ]; then
701694
set -- "$APPDIR"/shared/bin/*
702695
for bin do
703696
_patch_away_usr_bin_dir "$bin"
@@ -879,13 +872,9 @@ _patch_away_usr_bin_dir() {
879872
return 1
880873
fi
881874

882-
if [ "$PATH_MAPPING_RELATIVE" = 1 ]; then
883-
sed -i -e 's|/usr|././|g' "$1"
884-
else
885-
sed -i -e "s|/usr/bin|/tmp/$_tmp_bin|g" "$1"
886-
if ! grep -q "_tmp_bin='$_tmp_bin'" "$APPDIR"/.env 2>/dev/null; then
887-
echo "_tmp_bin='$_tmp_bin'" >> "$APPDIR"/.env
888-
fi
875+
sed -i -e "s|/usr/bin|/tmp/$_tmp_bin|g" "$1"
876+
if ! grep -q "_tmp_bin='$_tmp_bin'" "$APPDIR"/.env 2>/dev/null; then
877+
echo "_tmp_bin='$_tmp_bin'" >> "$APPDIR"/.env
889878
fi
890879

891880
_echo "* patched away /usr/bin from $1"
@@ -902,14 +891,9 @@ _patch_away_usr_lib_dir() {
902891
return 1
903892
fi
904893

905-
if [ "$PATH_MAPPING_RELATIVE" = 1 ]; then
906-
sed -i -e 's|/usr|././|g' "$1"
907-
else
908-
sed -i -e "s|/usr/lib|/tmp/$_tmp_lib|g" "$1"
909-
910-
if ! grep -q "_tmp_lib='$_tmp_lib'" "$APPDIR"/.env 2>/dev/null; then
911-
echo "_tmp_lib='$_tmp_lib'" >> "$APPDIR"/.env
912-
fi
894+
sed -i -e "s|/usr/lib|/tmp/$_tmp_lib|g" "$1"
895+
if ! grep -q "_tmp_lib='$_tmp_lib'" "$APPDIR"/.env 2>/dev/null; then
896+
echo "_tmp_lib='$_tmp_lib'" >> "$APPDIR"/.env
913897
fi
914898

915899
_echo "* patched away /usr/lib from $1"
@@ -926,14 +910,9 @@ _patch_away_usr_share_dir() {
926910
return 1
927911
fi
928912

929-
if [ "$PATH_MAPPING_RELATIVE" = 1 ]; then
930-
sed -i -e 's|/usr|././|g' "$1"
931-
else
932-
sed -i -e "s|/usr/share|/tmp/$_tmp_share|g" "$1"
933-
934-
if ! grep -q "_tmp_share='$_tmp_share'" "$APPDIR"/.env 2>/dev/null; then
935-
echo "_tmp_share='$_tmp_share'" >> "$APPDIR"/.env
936-
fi
913+
sed -i -e "s|/usr/share|/tmp/$_tmp_share|g" "$1"
914+
if ! grep -q "_tmp_share='$_tmp_share'" "$APPDIR"/.env 2>/dev/null; then
915+
echo "_tmp_share='$_tmp_share'" >> "$APPDIR"/.env
937916
fi
938917

939918
_echo "* patched away /usr/share from $1"
@@ -1096,7 +1075,7 @@ if [ "$DEPLOY_GEGL" = 1 ]; then
10961075
fi
10971076

10981077
# some libraries may need to look for a relative ../share directory
1099-
# normally this is for when they are located in /usr/share
1078+
# normally this is for when they are located in /usr/lib
11001079
# however with sharun this structure is not present, instead
11011080
# we have the libraries inside `shared/lib` and `share` is one level
11021081
# further back, so we make a relative symlink to fix this issue

0 commit comments

Comments
 (0)