summaryrefslogtreecommitdiff
path: root/recipes/callrec/callrec_svn.bb
blob: 6930648ecc5c17263a1fcd7b718f2699dac51192 (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
DESCRIPTION = "a call recording application"
HOMEPAGE = "none"
SECTION = "system/applications"
LICENSE = "GPLv3 or later"
SRCNAME = "callrec"
DEPENDS = "gtk+"
RDEPENDS += "alsa-utils-alsactl alsa-utils-aplay"
PV = "0.2.4+svnr${SRCPV}"
PR = "r0"

S = "${WORKDIR}/trunk"
inherit autotools 

SRC_URI = "svn://svn.projects.openmoko.org/svnroot/callrec;module=trunk"
FILES_${PN} += "${datadir} ${sysconfdir}"

pkg_postinst_callrec_append() {
	#!/bin/sh
	#still a bit buggy, if the state path change for instance
	files0="gsmhandset.state"
	files1="gsmheadset.state"
	files2="gsmspeakerout.state"
	state_dir=`sed -n "s/^scenario_dir\s*=\s*//p" /etc/frameworkd.conf`
	callrec_dir="/usr/share/callrec"
	
	for index in 0 1 2
	do
 		eval filename=\${files${index}}
		current_file=${state_dir}/${filename}
		patched="0"
		
		if [ -r ${callrec_dir}/${filename} ]; then
			echo "Backup of ${filename} already exists"
			echo "Replacing ${filename} with callrec-${filename}"
			cp ${callrec_dir}/callrec-${filename} ${current_file}
		else
			echo "Backing up ${filename}"
			cp ${current_file} ${callrec_dir}/
			
			#fix the patch
			sed -i "s!@STATE_PATH@!${current_file}!g" ${callrec_dir}/${filename}.patch
			echo "Patching ${filename}"
			patch -p0 < ${callrec_dir}/${filename}.patch && patched="1"
		fi
	
		if [ $patched -eq 0 ]; then
			echo "Failed patching ${filename}"
			echo "Replacing ${filename} with callrec-${filename}"
			echo "Backup is at ${callrec_dir}"
			cp ${callrec_dir}/callrec-${filename} ${current_file}
		fi
	done
}
pkg_prerm_callrec_append() {
	#!/bin/sh
	files0="gsmhandset.state"
	files1="gsmheadset.state"
	files2="gsmspeakerout.state"
	state_dir=`sed -n "s/^scenario_dir\s*=\s*//p" /etc/frameworkd.conf`
	
	for index in 0 1 2
	do
		eval filename=\${files${index}}
		current_file=${state_dir}/${filename}
		echo "Restoring ${filename} from backup"
		cp /usr/share/callrec/${filename} ${current_file}
		echo "Removing backups"
		rm /usr/share/callrec/${filename}
	done
}