]> wagnertech.de Git - projects.git/blob - Configure
libcob-ocesql build
[projects.git] / Configure
1 #!/bin/bash
2 set -e
3
4 function usage {
5         cat <<USAGE
6 configure PROJECT
7 PROJECT = libcob-ocesql mconnect webssh
8 USAGE
9 }
10
11 function write_deb {
12         # $1: package name
13         # $2: compile_typ
14         cat <<ANY_DEB >debian/$1.conf
15 # generated by configure
16 compile_type=$2
17 target_type=DEB
18 ANY_DEB
19 }
20
21 function write_changelog {
22         # $1: package name
23         cat <<CHANGELOG >debian/$1.changelog
24 projects (%VERSION%-%BUILD%) unstable; urgency=medium
25   * generated by configure
26  -- Michael Wagner <info@wagnertech.de>  Fri, 05 Dec 2025 20:03:04 +0100
27 CHANGELOG
28 }
29
30 function write_eclipse_control {
31         # $1: package name
32         cat <<CONTROL >debian/$1.control
33 Source: projects
34 Section: main
35 Priority: optional
36 Maintainer: Michael Wagner <michael@wagnertech.de>
37 Build-Depends: git, mbuild
38  
39 Package: $1
40 Architecture: _DEB_HOST_ARCH
41 Depends: $2
42 Description: http://eclipse.org
43 CONTROL
44 }
45
46 function write_eclipse_cp {
47         # $1: package name
48         cat <<CP >debian/$1.cp
49 #!/bin/bash
50 set -e
51
52 mkdir -p \$1/opt/$1/
53 cp -a Downloads/eclipse/* \$1/opt/$1/
54 CP
55 }
56
57 function write_eclipse_postinst {
58         # $1: package name
59         cat <<POSTINST >debian/$1.postinst
60 #!/bin/bash
61 set -e
62
63 for user in user nutzer kurs; do
64         if [ -d /home/\$user ]; then
65                 echo "Install eclipse for user \$user"
66                 pushd /home/\$user >/dev/null
67
68                         if [ -d Schreibtisch ]; then
69                                 pushd Schreibtisch >/dev/null
70                                         su \$user -c "ln -sf /opt/eclipse-cpp/eclipse ."
71                                 popd >/dev/null
72                         fi
73
74                         if [ -d Desktop ]; then
75                                 pushd Desktop >/dev/null
76                                         su \$user -c "ln -sf /opt/eclipse-cpp/eclipse ."
77                                 popd >/dev/null
78                         fi
79                 popd >/dev/null
80         fi
81 done
82 POSTINST
83 }
84
85 function write_eclipse_prepare {
86         # $1: package name
87         # $2: ECLIPSE_PATTERN
88         cat <<PREPARE >debian/$1.prepare
89 #!/bin/bash
90 set -e
91
92 debian/eclipse.prepare $2
93 PREPARE
94 }
95
96 function configure_eclipse {
97         # $1: package name
98         # $2: ECLIPSE_PATTERN
99         # $3: additional dependencies
100
101         write_deb $1 NONE
102         write_changelog $1
103         write_eclipse_control $1 "$3"
104         write_eclipse_cp $1
105         chmod 755 debian/$1.cp
106         write_eclipse_postinst $1
107         chmod 755 debian/$1.postinst
108         write_eclipse_prepare $1 $2
109         chmod 755 debian/$1.prepare
110         mconfigure -V $1
111 }
112
113 if [ -z "$1" ]; then
114         usage
115         exit 7
116 fi
117
118 case $1 in
119
120 eclipse-cpp)
121         configure_eclipse eclipse-cpp "eclipse-cpp*.tar.gz" "build-essential,gdb"
122         ;;
123         
124 eclipse-php)
125         configure_eclipse eclipse-php "eclipse-php*.tar.gz" php
126         ;;
127         
128 libcob-ocesql)
129         if [ -z "$2" ]; then
130                 echo "supply version as 2nd parameter"
131                 exit 131
132         fi
133         write_deb libcob-ocesql ANY
134         mconfigure -v $2 libcob-ocesql
135         ;;
136
137 mconnect)
138         write_deb mconnect ANY
139         mconfigure mconnect
140         ;;
141
142 webssh)
143         write_deb webssh ANY
144         mconfigure -V webssh
145         ;;
146
147 *)
148         echo "Invalid project."
149         usage
150         exit 25
151         ;;
152 esac
153