build.sh 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. #! /bin/sh
  2. # Please have a TMP or TMPDIR environment variable if you don't trust /tmp.
  3. export PATH=/usr/local/bin:/usr/local/sbin:$PATH
  4. if [ -z "$dialog" ] ; then
  5. if [ -n "$DISPLAY" ] ; then
  6. Xdialog --msgbox 'Welcome to the Pure-FTPd configuration tool' 8 60 2> /dev/null && dialog='Xdialog'
  7. gauge='--gauge'
  8. fi
  9. fi
  10. if [ -z "$dialog" ] ; then
  11. dialog --msgbox 'Welcome to the Pure-FTPd configuration tool' 8 60 2> /dev/null && dialog='dialog'
  12. # Workaround for old versions of 'dialog' (Slackware)
  13. if "$dialog" 2>&1 | grep gauge > /dev/null ; then
  14. gauge='--gauge'
  15. elif "$dialog" 2>&1 | grep guage > /dev/null ; then
  16. gauge='--guage'
  17. else
  18. gauge=''
  19. fi
  20. fi
  21. if [ -z "$dialog" ] ; then
  22. lxdialog --msgbox 'Welcome to the Pure-FTPd configuration tool' 8 60 2> /dev/null && dialog='lxdialog'
  23. fi
  24. if [ -z "$dialog" ] ; then
  25. /usr/src/linux/scripts/lxdialog/lxdialog --msgbox 'Welcome to the Pure-FTPd configuration tool' 8 60 2> /dev/null && dialog='/usr/src/linux/scripts/lxdialog/lxdialog'
  26. fi
  27. if [ -z "$dialog" ] ; then
  28. echo "No 'dialog' found, GUI installation impossible"
  29. exit 1
  30. fi
  31. # Find a writable temporary directory
  32. tempdir=''
  33. for tmpdir in "$TMP" "$TMPDIR" /tmp /var/tmp; do
  34. if [ -z "$tempdir" ] && [ -d "$tmpdir" ] && [ -w "$tmpdir" ]; then
  35. tempdir="$tmpdir"
  36. fi
  37. done
  38. if [ -z "$tempdir" ]; then
  39. echo 'Unable to find a suitable temporary directory'
  40. exit 1
  41. fi
  42. # Create a temporary file
  43. tmp=`mktemp $tempdir/build.gui.XXXXXX` || exit 1
  44. trap "rm -f $tmp; exit 1" 1 2 11 15
  45. $dialog \
  46. --title 'Compile-time options' \
  47. --separate-output \
  48. --checklist 'Defaults should be fine for most users' \
  49. 20 78 10 \
  50. 'without-standalone' "Don't compile the standalone server code" off \
  51. 'without-inetd' "Don't support super-servers (like inetd)" off \
  52. 'without-capabilities' "Don't use Linux capabilities (default=detect)" off \
  53. 'without-shadow' "Don't use shadow passwords (default=detect)" off \
  54. 'without-usernames' "Use only numerical UIDs/GIDs" off \
  55. 'without-iplogging' "Never log remote IP addresses (confidentiality)" off \
  56. 'without-humor' "Disable humor (enabled by default)" off \
  57. 'without-ascii' "Don't support 7-bits (ASCII) transfers" off \
  58. 'without-nonalnum' "Only allow minimal alpha-numeric characters" off \
  59. 'without-unicode' "Disable utf8 non-latin characters" off \
  60. 'without-globbing' "Don't include the globbing code" off \
  61. 'without-sendfile' "Don't use zero-copy optimizations" off \
  62. 'without-privsep' "Disable privilege separation" off \
  63. 'with-brokenrealpath' "If your C library has a broken realpath()" off \
  64. 'with-probe-random-dev' "To check for /dev/*random at run-time" off \
  65. 'with-minimal' "Build only a minimal server for embedded systems" off \
  66. 'with-paranoidmsg' "Use paranoid, but not admin-friendly messages" off \
  67. 'with-sysquotas' "Use system (not virtual) quotas" off \
  68. 'with-ldap' "Users database is an LDAP directory" off \
  69. 'with-mysql' "Users database is a MySQL database" off \
  70. 'with-altlog' "Support alternative log format (Apache-like)" on \
  71. 'with-pam' 'Enable PAM authentication' off \
  72. 'with-puredb' 'Support virtual (FTP-only) users' on \
  73. 'with-extauth' 'Support external authentication modules' on \
  74. 'with-cookie' "Support 'fortune' cookies" on \
  75. 'with-throttling' "Support bandwidth throttling" on \
  76. 'with-ftpwho' "Support the pure-ftpwho command" on \
  77. 'with-ratios' "Support upload/download ratios" on \
  78. 'with-quotas' "Support .ftpquota files" on \
  79. 'with-welcomemsg' "welcome.msg files backward compatibility" off \
  80. 'with-uploadscript' "Allow running scripts after upload (experimental)" on \
  81. 'with-virtualhosts' "Allow a distinct content for each IP address" on \
  82. 'with-virtualchroot' "Follow symlinks outside a chroot jail" off \
  83. 'with-diraliases' "Support directory aliases" on \
  84. 'with-peruserlimits' "Support per-user concurrency limits" on \
  85. 'with-tls' "Support SSL/TLS security layer (experimental)" off \
  86. 'with-bonjour' "Support Bonjour on MacOS X" off \
  87. 2> $tmp
  88. cfgline='';
  89. for z in $(cat $tmp) ; do
  90. cfgline="$cfgline --$z"
  91. done
  92. $dialog \
  93. --title 'Compile-time options' \
  94. --radiolist 'Choose a language for server messages' \
  95. 20 78 10 \
  96. 'english' "This is the default" on \
  97. 'albanian' "Contributed by Moisi Xhaferaj" off \
  98. 'german' "Contributed by Mathias Gumz" off \
  99. 'romanian' "Contributed by Claudiu Costin" off \
  100. 'french' "Contributed by Ping" off \
  101. 'french-funny' "Silly french messages" off \
  102. 'polish' "Contributed by Arkadiusz Miskiewicz" off \
  103. 'spanish' "Contributed by Luis Llorente Campo" off \
  104. 'danish' "Contributed by Isak Lyberth" off \
  105. 'dutch' "Contributed by Johan Huisman" off \
  106. 'italian' "Contributed by Stefano F." off \
  107. 'brazilian-portuguese' "Contributed by Roger C. Demetrescu" off \
  108. 'slovak' "Contributed by Robert Varga" off \
  109. 'korean' "Contributed by Im Eunjea" off \
  110. 'swedish' "Contributed by Ulrik Sartipy" off \
  111. 'norwegian' "Contributed by Kurt Inge Smadal" off \
  112. 'russian' "Contributed by Andrey Ulanov" off \
  113. 'traditional-chinese' "Contributed by Hether Fygul" off \
  114. 'simplified-chinese' "Contributed by Hether Fygul" off \
  115. 'czech' "Contributed by Martin Sarfy" off \
  116. 'turkish' "Contributed by Mehmet Cokcevik" off \
  117. 'hungarian' "Contributed by Banhalmi Csaba" off \
  118. 'catalan' "Contributed by Oriol Magrano" off \
  119. 2> $tmp
  120. z=$(cat $tmp)
  121. cfgline="$cfgline --with-language=$z"
  122. $dialog \
  123. --title 'Compile-time options' \
  124. --inputbox 'Installation prefix (/usr/local is not a bad idea)' \
  125. 10 78 \
  126. '/usr/local' \
  127. 2> $tmp
  128. prefix=$(cat $tmp)
  129. rm -f "$tmp" 2>/dev/null >&2
  130. if [ -n "$prefix" ] ; then
  131. cfgline="$cfgline --prefix=$prefix"
  132. else
  133. prefix='/usr/local'
  134. fi
  135. if [ ! -f "configure" ] ; then
  136. cd ..
  137. if [ ! -f "configure" ] ; then
  138. echo 'Setup problem... try to install manually'
  139. exit 1
  140. fi
  141. fi
  142. if [ -n "$gauge" ] ; then
  143. (
  144. echo "./configure $cfgline" > build.gui.log
  145. echo 20
  146. rm -f config.cache 2>/dev/null >&2
  147. echo 30
  148. ./configure $cfgline >&2 >> build.gui.log
  149. echo 50
  150. make clean >&2 >> build.gui.log
  151. echo 60
  152. make >&2 >> build.gui.log
  153. echo 80
  154. make install-strip >&2 >> build.gui.log
  155. export instfailure
  156. echo 100
  157. ) | $dialog \
  158. --title 'Compilation and installation' \
  159. "$gauge" 'Please wait...' 10 78 10
  160. else
  161. echo "./configure $cfgline" > build.gui.log
  162. rm -f config.cache 2>/dev/null >&2
  163. ./configure $cfgline >&2 >> build.gui.log
  164. make clean >&2 >> build.gui.log
  165. make >&2 >> build.gui.log
  166. make install-strip >&2 >> build.gui.log
  167. export instfailure
  168. fi
  169. touch "$prefix/pure-ftpd" 2> /dev/null || instfailure="yes"
  170. if [ -z "$instfailure" ] ; then
  171. $dialog --msgbox \
  172. "Congratulation, the server is now installed on your system.\nPlease read the documentation to know how to run it." \
  173. 10 78
  174. else
  175. $dialog --msgbox \
  176. "Compilation was successful, but you need to be root in\norder to install the files to the selected prefix.\nPlease run 'make install' as root." \
  177. 10 78
  178. fi