summaryrefslogtreecommitdiffstats
path: root/kdpkg-install/sh/kdpkg-sh
blob: 59b3ad1428040e3b8e49a7408c8d7fc4aa904d2f (plain)
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
#!/bin/bash
# (c) 2010 Timothy Pearson
# (c) Fabian Wuertz Feb 2008


if [ "$1" == "update" ]; then
	apt-get update
	if [ $? -eq 0 ]; then
		echo ""
		echo "Update OK"
	else
		echo ""
		echo "Errors were encountered while updating the package index"
		echo "Please press enter to continue"
		read
	fi
fi 

if [ "$1" == "install" ]; then
	if [ "$3" != "none" ]; then
		installPackage=$(echo ${3//","/" "})
		apt-get install $installPackage
	fi
	if [ "$4" != "none" ]; then
		removePackage=$(echo ${4//","/" "})
		apt-get remove $removePackage
	fi
	dpkg -i $2
	if [ $? -eq 0 ]; then
		apt-get install -f
		if [ $? -eq 0 ]; then
			echo ""
			echo "Installation OK"
		else
			echo ""
			echo "Errors were encountered while installing your package"
			echo "Please press enter to exit"
			read
		fi
	else
		echo ""
		echo "Errors were encountered while installing your package"
		echo "Please press enter to continue"
		read
	fi
fi