File: finish_install

package info (click to toggle)
dar 2.6.13-2
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 10,364 kB
  • sloc: cpp: 77,385; sh: 6,192; ansic: 776; makefile: 435; python: 242; csh: 95; perl: 43; sed: 16
file content (65 lines) | stat: -rwxr-xr-x 1,554 bytes parent folder | download | duplicates (2)
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
58
59
60
61
62
63
64
65
#!/bin/bash

if [ -z "$1" -o -z "$2" -o -z "$3" -o -z "$4" ] ; then
    echo "usage: $0 <path to dar_static> <dar archive> <temporary directory> <name of the uninstall script to build> [<target install dir>]"
    exit 1
fi

dar_static=`realpath "$1"`
source=`realpath "$2"`
tmpdir=`realpath "$3"`
uninst=`realpath "$4"`
destin="$5"

if [ -z "$destin" ] ; then
    destin="/"
    destprefix=""
else
    destin=`realpath "$destin"`
    destprefix="$destin"
fi

inst="$uninst.tmp"

if [ -e "$tmpdir" ] ; then
    echo "$tmpdir already exists, aborting"
    exit 2
else
    mkdir -p "$tmpdir"
fi

if ! $dar_static -x "$source" -R "$tmpdir" -O -w -q -Q -u "system.nfs4_acl" -N ; then
    echo "failed restoring $source to $tmpdir, $dar_static returned $?"
    exit 2
fi

cat < /dev/null > "$uninst"
cat < /dev/null > "$inst"

cd "$tmpdir"
for f in `find . -depth | sed -r 's#^./##'` ; do
    if [ ! -e "$desprefix/$f" ] ; then
	if [ -d "./$f" ] ; then
	    echo "rmdir --ignore-fail-on-non-empty \"$destprefix/$f\"" >> "$uninst"
	else
	    echo "rm -f \"$destprefix/$f\"" >> "$uninst"
	    echo "$destprefix/$f" >> "$inst"
	fi
    else
	if [ ! -d "$destprefix/$f" ] ; then
	    echo "File to install $destprefix/$f already exists, aborting"
	    exit 2
	fi
    fi
done

if ! $dar_static -x "$source" "-[" "$inst" -R "$destin" -O -n -q -Q -u "system.nfs4_acl" -N ; then
    echo "failed restoring $source with filter to $destin, $dar_static returned $?"
    rm -f "$inst" "$uninst"
    rm -rf "$tmpdir"
else
    rm -f "$inst"
    rm -rf "$tmpdir"
fi

ldconfig