File: install.sh

package info (click to toggle)
kxdocker-data 0.8-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,292 kB
  • ctags: 9
  • sloc: xml: 308; sh: 104; makefile: 56
file content (113 lines) | stat: -rwxr-xr-x 2,993 bytes parent folder | download
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash

KXDRSCVER="0.0.8"

echo "KXDocker Resource installer" $KXDRSCVER

find_KDE_global()
{
	MYKDE="$1"

	if ! [ "$MYKDE" == "" ];
	then
		echo "$MYKDE";
		return;
	fi

	if ! [ "$KDEDIR" == "" ];
	then
		MYKDE="$KDEDIR";
	echo "$MYKDE"
		return;
	fi

	MYKDE=`kde-config --prefix`
	echo "$MYKDE"
	return;
}

find_KDE_local()
{
	MYKDE="$1"

	if ! [ "$MYKDE" == "" ];
	then
		echo "$MYKDE";
		return;
	fi

	MYKDE=`kde-config --localprefix`
	echo "$MYKDE"
	return;
}

pass3()
{
		 case "$1" in
			 yes)
			 echo "installing to:  ${KXDPREFIX}/share/apps/kxdocker"
			 ! mkdir -p ${KXDPREFIX}/share/apps/kxdocker/themes && kdialog --error "Error while creating: ${KXDPREFIX}/share/apps/kxdocker/themes" && exit 1
			 ! tar -jxf themes.tar.bz2 -C ${KXDPREFIX}/share/apps/kxdocker/ && kdialog --error "Error while decompressing themes" && exit 1
			 ! mkdir -p ${KXDPREFIX}/share/apps/kxdocker/plugins && kdialog --error "Error while creating: ${KXDPREFIX}/share/apps/kxdocker/plugins" && exit 1
			 ! tar -jxf plugins.tar.bz2 -C ${KXDPREFIX}/share/apps/kxdocker/ && kdialog --error "Error while decompressing plugins" && exit 1
			 ! mkdir -p ${KXDPREFIX}/share/apps/kxdocker/sounds && kdialog --error "Error while creating: ${KXDPREFIX}/share/apps/kxdocker/sounds" && exit 1
			 ! tar -jxf sounds.tar.bz2 -C ${KXDPREFIX}/share/apps/kxdocker/ && kdialog --error "Error while decompressing sounds" && exit 1
			 
			 kdialog --msgbox "Installation successfully into: ${KXDPREFIX}/share/apps/kxdocker"
			
			SURE2=`kdialog --yesno "Do you like to install default configuration into: ${KXDPREFIX}/share/apps/kxdocker/kxdocker_conf.xml? (pass 1/1)" && echo "yes"`;
			if [ "$SURE2" == "yes" ];
			then
				! cp kxdocker_conf.xml ${KXDPREFIX}/share/apps/kxdocker/ && kdialog --error "Error while installing configuration: ${KXDPREFIX}/share/apps/kxdocker/kxdocker_conf.xml" && exit 1
				
				kdialog --msgbox "Installation successfully into: ${KXDPREFIX}/share/apps/kxdocker"
			fi
			 
			 ;;
			 *)
		echo "Installation aborted";
		exit 1;

			 ;;
		 esac
}

pass2()
{
	KXDPREFIX=`kdialog --inputbox "Please insert PREFIX where install resources (pass 2/3)" "$KXDPREFIX"`
	if ! [ "$KXDPREFIX" == "" ];
	then
		SURE=`kdialog --yesno "Are you sure to install KXDocker resources in ${KXDPREFIX}/share/apps/kxdocker? (pass 3/3)" && echo "yes"`;
		pass3 $SURE;
	else
              echo "Installation aborted";
              exit 1;
	fi
}


if ! [ "$DISPLAY" == "" ];
then
	kdialog --msgbox "KXDocker Resource installer $KXDRSCVER";
	ISLOCAL=`kdialog --radiolist "Where do you like to install resources (pass 1/3)" local "Local user directory (HOME)" 0 global "Global MultiUser install (KDEDIR)" 0`

	case "$ISLOCAL" in
		global)
			KXDPREFIX=`find_KDE_global "$1"`
			pass2
		;;
		local)
			KXDPREFIX=`find_KDE_local "$1"`
			pass2
		;;
		*)
		echo "Installation aborted";
		exit 1;
		;;
	esac

else
	echo "You have to run this script under X environment with KDE correctly installed";
	exit 1;
fi