Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
prsabahrami committed Nov 27, 2024
1 parent 112970c commit 69cb2ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,12 @@ archive_begin=$((archive_begin + 2))
archive_end=$((archive_end - 1))
pixi_pack_start=$(($archive_end + 2))

echo $(tail -n +$archive_begin "$0" | head -n $(($archive_end - $archive_begin + 1))) > "$TEMPDIR/archive_temp"
echo $(tail -n +$pixi_pack_start "$0") > "$TEMPDIR/pixi-pack_temp"

if [[ $(base64 --version | grep -q 'GNU') ]]; then
# BSD/macOS version
base64 -d -i "$TEMPDIR/archive_temp" > "$TEMPDIR/archive.tar"
base64 -d -i "$TEMPDIR/pixi-pack_temp" > "$TEMPDIR/pixi-pack"
else
# GNU version
base64 -d "$TEMPDIR/archive_temp" > "$TEMPDIR/archive.tar"
base64 -d "$TEMPDIR/pixi-pack_temp" > "$TEMPDIR/pixi-pack"
fi
echo $(tail -n +$archive_begin "$0" | head -n $(($archive_end - $archive_begin + 1))) | base64 -d > "$TEMPDIR/archive.tar"
echo $(tail -n +$pixi_pack_start "$0") | base64 -d > "$TEMPDIR/pixi-pack"

chmod +x "$TEMPDIR/pixi-pack"

CMD="\"$TEMPDIR/pixi-pack\" unpack $@ \"$TEMPDIR/archive.tar\""

# Execute the command
eval "$CMD"
"$TEMPDIR/pixi-pack" unpack $@ "$TEMPDIR/archive.tar"

exit 0
@@END_HEADER@@
1 change: 1 addition & 0 deletions src/pack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ async fn create_self_extracting_executable(
.await?;

// Make the script executable
// This won't be executed when cross-packing due to Windows FS not supporting Unix permissions
#[cfg(not(target_os = "windows"))]
if !platform.is_windows() {
let mut perms = final_executable.metadata().await?.permissions();
Expand Down

0 comments on commit 69cb2ac

Please sign in to comment.