Skip to content

Commit

Permalink
set original permissions for unpacked files
Browse files Browse the repository at this point in the history
Currently the following scenario is broken:

  developer@dev-machine$ makeself.sh --notemp app/ app.run app

  ...

  root@user-machine# cd /opt && ~/Downloads/app.run
  user@user-machine$ /opt/app/bin/app
  bash: /opt/app/bin/app: Permission denied

The problem is that users on user-machine cannot access unpacked files,
since they are created with umask 077.

The proposed solution is to use the original umask for untar.
  • Loading branch information
mephi42 committed Jul 22, 2015
1 parent e1f1cbb commit e75285d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion makeself-header.sh
Expand Up @@ -2,6 +2,7 @@ cat << EOF > "$archname"
#!/bin/sh
# This script was generated using Makeself $MS_VERSION
ORIG_UMASK=\`umask\`
umask 077
CRCsum="$CRCsum"
Expand Down Expand Up @@ -465,7 +466,7 @@ fi
for s in \$filesizes
do
if MS_dd_Progress "\$0" \$offset \$s | eval "$GUNZIP_CMD" | ( cd "\$tmpdir"; UnTAR xp ) 1>/dev/null; then
if MS_dd_Progress "\$0" \$offset \$s | eval "$GUNZIP_CMD" | ( cd "\$tmpdir"; umask \$ORIG_UMASK ; UnTAR xp ) 1>/dev/null; then
if test x"\$ownership" = xy; then
(PATH=/usr/xpg4/bin:\$PATH; cd "\$tmpdir"; chown -R \`id -u\` .; chgrp -R \`id -g\` .)
fi
Expand Down

0 comments on commit e75285d

Please sign in to comment.