File: cmdline-install

package info (click to toggle)
pcp 4.3.2%2Breally4.3.1-0.1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 175,188 kB
  • sloc: ansic: 261,305; sh: 123,606; xml: 107,279; cpp: 72,127; perl: 18,283; python: 15,453; yacc: 8,249; lex: 2,585; makefile: 1,957; fortran: 60; java: 52
file content (57 lines) | stat: -rwxr-xr-x 1,180 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
#
# install a PCP *.dmg package from the command line ...
# run from the build/mac directory in a PCP build tree after Makepkgs
#
tmp=`mktemp -d /var/tmp/pcp.XXXXXXXXX` || exit 1
sts=1
trap "rm -rf $tmp; exit \$sts" 0 1 2 3 15

disk_image=`echo pcp-*.dmg | sed -e 's/$/ /' -e 's/[^ ]*\.tmp\.dmg / /' -e 's/ $//'`
if [ "$disk_image" = "pcp-*.dmg" ]
then
    echo "Error: no .dmg file?"
    exit
fi

n=`echo "$disk_image" | wc -w | sed -e 's/ //'`
if [ "$n" -gt 1 ]
then
    echo "Error: more than one .dmg file: $disk_image"
    exit
fi

base=`echo $disk_image | sed -e 's/\.dmg$//'`
if hdiutil attach $disk_image >$tmp/out 2>&1
then
    :
else
    cat $tmp/out
    echo "Error: hdiutil attach failed"
    exit
fi

if [ -d /Volumes/$base/$base.pkg ]
then
    if sudo installer -verbose -pkg /Volumes/$base/$base.pkg -target / >$tmp/out 2>&1
    then
	sts=0
    else
	cat $tmp/out
	echo "Error: installer failed"
    fi
else
    ls -l /Volumes/$base/
    echo "Error: no package directory /Volumes/$base/$base.pkg?"
    exit
fi

if hdiutil detach /Volumes/$base >$tmp/out 2>&1
then
    :
else
    cat $tmp/out
    echo "Error: hdiutil detach failed"
    sts=1
    exit
fi