mirror of
https://github.com/openwrt/packages.git
synced 2025-12-19 00:51:19 +00:00
python,python3: Fix overridden usr/bin symlinks
Currently, all files in usr/bin (presumably all Python scripts) are run through sed to replace the shebang; sed will overwrite the file whether or not a match is found. This causes symlinks to be overridden and made into copies of their targets. python[3]-base and python[3]-dev are affected by this. This adds the --follow-symlinks flag to sed, in addition to using $(SED), so that symlinks are not overridden. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
This commit is contained in:
@@ -58,6 +58,8 @@ python="$4"
|
||||
mode="$5"
|
||||
filespec="$6"
|
||||
|
||||
SED="${SED:-sed -e}"
|
||||
|
||||
find "$src_dir" -name "*\.exe" -exec rm -f {} \;
|
||||
|
||||
process_filespec "$src_dir" "$dst_dir" "$filespec" || {
|
||||
@@ -68,7 +70,7 @@ process_filespec "$src_dir" "$dst_dir" "$filespec" || {
|
||||
usr_bin_dir="$dst_dir/usr/bin"
|
||||
|
||||
if [ -d "$usr_bin_dir" ] ; then
|
||||
sed "1"'!'"b;s,^#"'!'".*python.*,#"'!'"/usr/bin/python${ver}," -i $usr_bin_dir/*
|
||||
$SED "1"'!'"b;s,^#"'!'".*python.*,#"'!'"/usr/bin/python${ver}," -i --follow-symlinks $usr_bin_dir/*
|
||||
fi
|
||||
|
||||
if [ "$mode" == "sources" ] ; then
|
||||
|
||||
Reference in New Issue
Block a user