Browse Source

Fixed install

master
Rémi BERTHO 7 months ago
parent
commit
35f33b2c64
Signed by: Rémi BERTHO <remi.bertho@dalan.fr> GPG Key ID: EE3B917931C07B64
1 changed files with 23 additions and 16 deletions
  1. 23
    16
      utility.sh

+ 23
- 16
utility.sh View File

@@ -23,23 +23,30 @@ check_dir()
23 23
 
24 24
 install()
25 25
 {
26
-	DIR=$1
27
-	check_dir "$DIR"
26
+	DESTDIR=$1
27
+	check_dir "$DESTDIR"
28
+	if [ -z "$2" ]; then
29
+		PREFIX=$DESTDIR
30
+	else
31
+		PREFIX="$2"
32
+		DESTDIR=$DESTDIR$PREFIX
33
+		echo $DESTDIR
34
+	fi
28 35
 	
29
-	mkdir -p "$DIR/share/SimplePanoramaViewer/"
30
-	mkdir -p "$DIR/bin/"
31
-	mkdir -p "$DIR/share/applications"
32
-	mkdir -p "$DIR/share/mime/image"
33
-	cp SimplePanoramaViewer "$DIR/share/SimplePanoramaViewer"
34
-	cp -r css "$DIR/share/SimplePanoramaViewer"
35
-	cp -r html "$DIR/share/SimplePanoramaViewer"
36
-	cp -r js "$DIR/share/SimplePanoramaViewer"
37
-	cp install/SimplePanoramaViewer.desktop "$DIR/share/applications"
38
-	cp install/pjpg.xml "$DIR/share/mime/image"
36
+	mkdir -p "$DESTDIR/share/SimplePanoramaViewer/"
37
+	mkdir -p "$DESTDIR/bin/"
38
+	mkdir -p "$DESTDIR/share/applications"
39
+	mkdir -p "$DESTDIR/share/mime/image"
40
+	cp SimplePanoramaViewer "$DESTDIR/share/SimplePanoramaViewer"
41
+	cp -r css "$DESTDIR/share/SimplePanoramaViewer"
42
+	cp -r html "$DESTDIR/share/SimplePanoramaViewer"
43
+	cp -r js "$DESTDIR/share/SimplePanoramaViewer"
44
+	cp install/SimplePanoramaViewer.desktop "$DESTDIR/share/applications"
45
+	cp install/pjpg.xml "$DESTDIR/share/mime/image"
39 46
 	echo "#!/bin/bash
40
-	$DIR/share/SimplePanoramaViewer/SimplePanoramaViewer \"\$@\"" > "$DIR/bin/SimplePanoramaViewer"
41
-	chmod a+x "$DIR/bin/SimplePanoramaViewer"
42
-	sudo chmod -R a+r "$DIR/share/SimplePanoramaViewer"
47
+$PREFIX/share/SimplePanoramaViewer/SimplePanoramaViewer \"\$@\"" > "$DESTDIR/bin/SimplePanoramaViewer"
48
+	chmod a+x "$DESTDIR/bin/SimplePanoramaViewer"
49
+	chmod -R a+r "$DESTDIR/share/SimplePanoramaViewer"
43 50
 }
44 51
 
45 52
 uninstall()
@@ -80,7 +87,7 @@ case "$1" in
80 87
 		print_help
81 88
 		;;
82 89
 	"-i" | "--install")
83
-		install "$2"
90
+		install "$2" "$3"
84 91
 		;;
85 92
 	"-u" | "--uninstall")
86 93
 		uninstall "$2"

Loading…
Cancel
Save