File: Setup.sh

package info (click to toggle)
kshutdown 3.0~beta4-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 1,528 kB
  • sloc: cpp: 4,353; sh: 291; makefile: 5
file content (73 lines) | stat: -rwxr-xr-x 1,548 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
#!/bin/bash

default_item=""
kshutdown_full_version=`sed 2!d tools/VERSION`

function doError()
{
	echo
	echo "ERROR: $1"
	echo
	exit 1
}

function doCompile()
{
	clear
	if [ $1 == "kshutdown" ]; then
		if ./Setup-kde4.sh; then
			pushd build.tmp
			echo
			echo "INFO: Enter the \"root\" password to install KShutdown:"
			echo
			sudo make install
			popd
		else
			doError "Build failed. See README.html for troubleshooting information."
		fi
	elif [ $1 == "kshutdown-qt" ]; then
		if ./Setup-qt4.sh; then
			dialog \
				--msgbox \
"Compiled KShutdown program (\"kshutdown-qt\" file)\n
can be found in the \"${PWD}\" directory.\n
\n
Installation is not required.\n
However, you can run \"cd src; sudo make install\"\n
to setup menu shortcut (Utilities section),\n
and copy \"kshutdown-qt\" to the \"/usr/bin\" directory." \
				0 0
		else
			doError "Build failed. See README.html for troubleshooting information."
		fi
	else
		doError "Unknown build type: $1"
	fi
}

function doQuit()
{
	clear
}

if [[ $DESKTOP_SESSION == *kde* ]]; then
	default_item="kshutdown"
else
	default_item="kshutdown-qt"
fi

out=`dialog \
	--backtitle "KShutdown $kshutdown_full_version Setup" \
	--default-item "$default_item" \
	--ok-label "OK, compile!" \
	--cancel-label "Maybe later" \
	--stdout \
	--title "Select a KShutdown version to build:" \
	--menu "" 0 0 0 \
	"kshutdown" "Version for KDE 4 with additional features" \
	"kshutdown-qt"  "Version for Xfce, LXDE, etc. - lightweight, no KDE 4 libraries"`

case $? in
	0) doCompile $out;;
	*) doQuit;;
esac