File: installer

package info (click to toggle)
basket 1.80-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 7,668 kB
  • ctags: 2,926
  • sloc: cpp: 28,186; sh: 441; makefile: 48; xml: 31
file content (222 lines) | stat: -rwxr-xr-x 7,238 bytes parent folder | download
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#!/bin/bash

function error
{
  echo ""
  echo "    ========================================================================  "
  echo "  ((                      An Error has Been Encountered                     ))"
  echo "    ========================================================================  "
  echo ""
  echo ""
  echo "        In the most cases, some libraries are missing or cannot be found."
  echo "      Think to install the *-dev or *-devel packages of your distribution."
  echo "                     For example, if libmng cannot be found,"
  echo "  please check if libmng AND libmng-devel packages are installed on your system."
  echo "      See the reported errors to know which librarie need to be installed."
  echo "      If it complains about not being able to find the file FindGpgme.cmake, "
  echo "                 you will need the -devel package of kdepimlibs."
  echo "         Consult the INSTALL document  for a full list of the requirements."
  echo ""
  echo $'\a' # Beep to avert user of the error
  exit 1
}

function prefix_cmd
{
	if test -n "$1"; then
		echo '-DCMAKE_INSTALL_PREFIX='$1''
	fi
}

function do_warning
{
	warn_backup=yes
	if test "yes" = "$warn_backup"; then
		echo "                                ==========="
		echo "                                  WARNING"
		echo "                                ==========="
		echo " You are installing an early development version of BasKet; please back up "
		echo " your baskets before using it if you have a previous version of BasKet "
		echo " installed."
	fi
}

##echo "  ((                      An error has been encountered                     ))"
##echo "  ((654321 987654321 987654321 98765432  23456789 123456789 123456789 123456))"
##echo" ((654321 987654321 987654321 98765432  23456789 123456789 123456789 123456))"

clear
echo ""
echo "    ========================================================================  "
echo "  ((                    BasKet Note Pads Quick Installer                    ))"
echo "    ========================================================================  "
echo ""
echo ""
echo "              Welcome to the BasKet Note Pads installer assistant."
echo "             It will configure, build and install BasKet Note Pads."
echo ""
echo ""
echo "                             What do you want to do?"
echo ""
echo "  1/ Install BasKet Note Pads system wide (you will need root access)"
echo "  2/ Install BasKet Note Pads in your user folder"
#echo "  3/ Uninstall BasKet Note Pads (you should not: it is so fantastic ;-) )"
echo ""

echo -n "Your choice (default is 1): "
read -n 1 WHAT_TO_DO
echo ""

if [ "_$WHAT_TO_DO" == "_2" ]; then
  SYS_WIDE=0
  WHAT_TO_DO=2 # To transform it from string to int
else
#  if [ $WHAT_TO_DO == 3 ]; then
#    SYS_WIDE=1
#  else  # [ WHAT_TO_DO == 1 ] or default
    SYS_WIDE=1
    WHAT_TO_DO=1 # If user entered another number than those he should
#  fi
fi

if [ $SYS_WIDE == 0 ]; then
  prefix=`kde4-config --localprefix --expandvars`
else
  prefix=`kde4-config --prefix --expandvars`
fi

isDevel=alpha

clear
echo ""
echo "    ========================================================================  "
echo "  ((                    BasKet Note Pads Quick Installer                    ))"
echo "    ========================================================================  "
echo ""
echo ""
do_warning
echo ""
echo ""
echo "      If you do not know what they are, you can ignore errors or warnings."
echo ""
echo "                      The process can take several minutes."
echo "                  A beep will notify you when it will be done."
echo ""
echo "                              Press ENTER to start."
echo ""
echo ""

read -s -n 1 # read 1 character without echo, ended by ENTER

clear
echo ""
echo "    ========================================================================  "
echo "  ((                       Step 1 / 3 : Configuration                       ))"
echo "    ========================================================================  "
echo ""
echo ""

# No one is going to have a file named "build" here, right?
if test ! -d build ; then
	mkdir build
fi

cd build

if [ "_$isDevel" == "_" ]; then
  cmake .. $(prefix_cmd $prefix) || error
else
  cmake .. -DCMAKE_BUILD_TYPE=debugfull $(prefix_cmd $prefix) || error
fi

clear
echo ""
echo "    ========================================================================  "
echo "  ((                        Step 2 / 3 : Compilation                        ))"
echo "    ========================================================================  "
echo ""
echo ""

echo "make"
make || error

clear
echo ""
echo "    ========================================================================  "
echo "  ((                        Step 3 / 3 : Installation                       ))"
echo "    ========================================================================  "
echo ""
echo ""
echo "                 The application has successfuly been compiled."
echo ""
echo ""

echo $'\a' # Beep to avert user the configuration/compilation is ended and he must act to enter the password

if [ "_$SYS_WIDE" == "_n" ]; then
  # First make the bin folder to not copy basket file to bin file if bin/ doesn't exist
  make install
else
  echo "            Please now enter the password in order to install "
  echo "                        BasKet Note Pads on the system."
  echo ""
  echo 'Installing in "'$prefix'"...'
  sudo make install || exit 1
  echo ""
  echo ""
fi

clear
echo ""
echo "    ========================================================================  "
echo "  ((                  End of BasKet Note Pads Installation                  ))"
echo "    ========================================================================  "
echo ""
echo ""
echo "                    Do you want to run BasKet Note Pads now?"
echo "       If an older version is currently running it will be exited before."
echo ""
echo "   Notice that you won't have to exit BasKet : it will be restored each time"
echo "                               you log in to KDE."
echo ""
echo ""

echo -n "Start or restart BasKet Note Pads? [y/n] (default is y): "
read -n 1 RESTART
if [ "_$RESTART" != "_" ]; then # If pressed Enter, a new line was already print
  echo ""
fi

if [ "_$RESTART" != "_n" ]; then
  # Get the pid of the process basket, if currently running
  pid=`ps aux | awk '$11 == "basket" { print $2 }'`
  if [ "_$pid" == "_" ]; then
    dummy=0
  else
    kill -s SIGTERM $pid
  fi

  if [ "_$SYS_WIDE" == "_n" ]; then
    echo "$prefix/bin/basket"
    $prefix/bin/basket
  else
    echo "basket"
    basket
  fi
fi

clear
echo ""
echo "    ========================================================================  "
echo "  ((   Congratulation: BasKet Note Pads is now Installed onto your System   ))"
echo "    ========================================================================  "
echo ""
echo ""
echo "   In the future, if you want to uninstall BasKet Note Pads, you will have to"
if [ "_$SYS_WIDE" == "_n" ]; then
  echo "                enter the command make uninstall in this folder."
else
  echo "            enter the command su -c 'make uninstall' in this folder."
fi
echo ""
echo ""