summaryrefslogtreecommitdiff
path: root/compiz-fusion-git-retrieve
blob: 9f36a1b84c83069ba3ddc8d926c1eb7ef09edcba (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
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
#!/bin/bash
# Compiz Fusion Git Retrieval Script

### DO NOT EDIT BELOW THIS LINE ###

source $(dirname ${0})/compiz-fusion-git-functions
source $(dirname ${0})/compiz-fusion-git-config

function get_repo() {
	git_path="${1}" # The path to the package upstream

	shift 1 # Remove git_path from "$@"
	packages="$@" # Remove the path from packages

	for package in $packages
	do
		echo "==> Git Cloning/Pulling '${package}': "

		if [[ ! -d $package ]]; then
			git clone ${GIT_URI}${git_path}/${package} || die "\n*** ERROR: Failed to complete 'git clone ${GIT_URI}/${package}'"
		else
			cd $package
			git pull || die "\n*** ERROR: Failed to complete 'git pull ${package}'"
			cd ../
		fi

		echo ""
	done
}

if [[ "${GIT_USER#!}" == "dev" ]]; then
	# Developers
	GIT_URI="git+ssh://git.opencompositing.org/git"
else
	# Users
	GIT_URI="git://anongit.opencompositing.org"
fi

# Check for git
if [[ ! -x $(which git) ]]; then
	echo "You must have GIT installed to use this script."

	# Detect what command to install git with. All debian derivitives must come before ubuntu

	if [[ -e /etc/arch-release ]]; then
		echo "To install GIT, please run 'pacman -S git'"

	elif [[ -e /etc/lsb-release && -n $(cat /etc/lsb-release | grep Ubuntu) ]]; then
		echo "To install GIT, please run 'sudo apt-get install git-core"
		echo "If you have installed 'git' before 'git-core',"
		echo "Please run 'sudo update-alternatives --config git' and select the correct"
		echo "git package"

	elif [[ -e /etc/debian_version ]]; then
		echo "To install GIT, please run 'apt-get install git-core'"

	elif [[ -e /etc/gentoo-release ]]; then
		echo "To install GIT, please run 'emerge git'"

	fi

	exit 1
fi

# Calculate the packages we will be retrieving

COMPIZ=$(remove_unwanted_packages ${COMPIZ[*]})
FUSION=$(remove_unwanted_packages ${FUSION[*]})
MISC=$(remove_unwanted_packages ${MISC[*]})
LIBS=$(remove_unwanted_packages ${LIBS[*]})
CONFIG=$(remove_unwanted_packages ${CONFIG[*]})
DECORATORS=$(remove_unwanted_packages ${DECORATORS[*]})
PLUGIN_CONTAINERS=$(remove_unwanted_packages ${PLUGIN_CONTAINERS[*]})
PLUGINS=$(remove_unwanted_packages ${PLUGINS[*]})

# Create the location dir if it doesn't exist
if [[ ! -e $GIT_LOCATION ]]; then
	mkdir -p $GIT_LOCATION
fi

# Checkout Process

cd $GIT_LOCATION

get_repo "" $COMPIZ # Compiz doesn't have a path
get_repo "/fusion" $FUSION
get_repo "/fusion/misc" $MISC
get_repo "/fusion/libraries" $LIBS
get_repo "/fusion/compizconfig" $CONFIG
get_repo "/fusion/decorators" $DECORATORS
get_repo "/fusion" $PLUGIN_CONTAINERS
get_repo "/fusion/plugins" $PLUGINS

echo "Compiz Fusion has been cloned/pulled"
exit 0