-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpi_build_inkscape.sh
executable file
·119 lines (92 loc) · 1.96 KB
/
pi_build_inkscape.sh
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
114
115
116
117
118
119
#!/bin/bash
deg=0
export DH_VERBOSE=1
function pause_proc {
#renice -n 15 $1
kill -TSTP $1
for i in `ps -ef| awk '$3 == '$1' { print $2 }'`
do
#echo "pausing $i"
pause_proc $i
done
}
function resume_proc {
kill -CONT $1
for i in `ps -ef| awk '$3 == '$1' { print $2 }'`
do
#echo "restarting $i"
resume_proc $i
done
}
function get_temp {
cpu=$(</sys/class/thermal/thermal_zone0/temp)
deg=$((cpu/1000))
}
function run_proc {
#ps $1
stopped=0
sleep=1
get_temp
echo "$deg c " `date +%X`
while kill -0 "$1"; do #run this loop while the process is running
#cpu=$(</sys/class/thermal/thermal_zone0/temp)
#deg=$((cpu/1000))
get_temp
if [ $deg -ge 49 ] ; then
#if [ $stopped -eq 0 ]; then
echo "too hot! $deg c " `date +%X`
#fi
pause_proc $1
sleep 1
pause_proc $1
stopped=1
if [ $sleep -eq 5 ] ; then
sleep=10
elif [ $sleep -eq 10 ] ; then
sleep=15
elif [ $sleep -lt 10 ] ; then
sleep=10
fi
fi
if [ $stopped -eq 1 ] ;then
#echo "paused"
if [ $deg -le 47 ]
then
echo "cool enough $deg c " `date +%X`
resume_proc $1
stopped=0
sleep=1
fi
fi
#echo "$deg c stopped=$stopped" `date +%X`
sleep $sleep
done
}
dir=`pwd`
cd ~/Downloads
if [ ! -e ~/Downloads/0.91.x ]; then
bzr branch lp:inkscape/0.91.x &
run_proc $!
fi
if [ ! -e ~/Downloads/0.91.x/debian ]; then
if [ ! -e ./inkscape_0.91.orig.tar.xz ]; then
cd 0.91.x
nice dh_make --createorig -s -p inkscape_0.91 -y &
run_proc $!
cd ..
fi
if [ ! -e inkscape-0.48.5 ]; then
apt-get source inkscape &
run_proc $!
fi
mv 0.91.x/debian/rules 0.91.x/debian/rules.orig
cp inkscape-0.48.5/debian/rules 0.91.x/debian
rm -r inkscape-0.48.*
# cd ../../0.91.x
fi
cd ~/Downloads/0.91.x
nice -n 15 dpkg-buildpackage -uc -us -rfakeroot &
build=$!
run_proc $build
cd $dir
echo "built!"