Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: fusl/tools/install.sh

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fusl/tools/add-cfi.x86_64.awk ('k') | fusl/tools/ld.musl-clang.in » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/sh
2 #
3 # This is an actually-safe install command which installs the new
4 # file atomically in the new location, rather than overwriting
5 # existing files.
6 #
7
8 usage() {
9 printf "usage: %s [-D] [-l] [-m mode] src dest\n" "$0" 1>&2
10 exit 1
11 }
12
13 mkdirp=
14 symlink=
15 mode=755
16
17 while getopts Dlm: name ; do
18 case "$name" in
19 D) mkdirp=yes ;;
20 l) symlink=yes ;;
21 m) mode=$OPTARG ;;
22 ?) usage ;;
23 esac
24 done
25 shift $(($OPTIND - 1))
26
27 test "$#" -eq 2 || usage
28 src=$1
29 dst=$2
30 tmp="$dst.tmp.$$"
31
32 case "$dst" in
33 */) printf "%s: %s ends in /\n", "$0" "$dst" 1>&2 ; exit 1 ;;
34 esac
35
36 set -C
37 set -e
38
39 if test "$mkdirp" ; then
40 umask 022
41 case "$2" in
42 */*) mkdir -p "${dst%/*}" ;;
43 esac
44 fi
45
46 trap 'rm -f "$tmp"' EXIT INT QUIT TERM HUP
47
48 umask 077
49
50 if test "$symlink" ; then
51 ln -s "$1" "$tmp"
52 else
53 cat < "$1" > "$tmp"
54 chmod "$mode" "$tmp"
55 fi
56
57 mv -f "$tmp" "$2"
58 test -d "$2" && {
59 rm -f "$2/$tmp"
60 printf "%s: %s is a directory\n" "$0" "$dst" 1>&2
61 exit 1
62 }
63
64 exit 0
OLDNEW
« no previous file with comments | « fusl/tools/add-cfi.x86_64.awk ('k') | fusl/tools/ld.musl-clang.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698