📄 install
字号:
echo 'you like to do this now ?' yes_no "$runserverconfig" runserverconfig="$yesno" if matches "$runserverconfig" 'ye?s?' ; then "$servinstdir"/server/bin/serverconfig fi fi if [ $mode = "all" -o $mode = "clntrem" ] ; then echo ' ' echo "Now we may run the program $servinstdir/client/bin/clientconfig" echo "so you can configure the client side of the backup system. Would" echo 'you like to do this now ?' yes_no "$runclientconfig" runclientconfig="$yesno" if matches "$runclientconfig" 'ye?s?' ; then "$servinstdir"/client/bin/clientconfig fi fi}###########################################################################mult_choice(){ defaultsel="$1" shift validchre="$1" shift validchoices="$@" while true ; do echo " " echo_n 'Your choice ['"$defaultsel"']: ' read the_choice if [ _"$the_choice" = _ ] ; then the_choice="$defaultsel" fi if [ _"$validchre" != _ -a _"$validchre" != _- ] ; then if matches "$the_choice" '^'"$validchre"'$' ; then break fi else foundch=no for ch in $validchoices ; do if [ _"$ch" = _"$the_choice" ] ; then foundch=yes fi done if [ $foundch = yes ] ; then break fi fi echo ' ' echo 'This is not a valid choice. Please try again.' done}###########################################################################choose_DES(){ echo " " echo "Will we use 128 Bit DES encryption for authenticating the" echo "client to the server ? (Eric Young's DES library (version" echo "4.04b or higher) is required and by default expected in the" echo "directory ../libdes. Alternative is the libcrypto from the" echo "openssl project (see www.openssl.org). The defaults can be" echo "modified in the following section, when answering yes. If" echo "no, the old style encryption is performed." yes_no $use_des use_des=$yesno if [ $use_des = "no" ] ; then return fi configure_options="$configure_options --with-des" echo " " echo "Please enter the name of the DES-library's header file" mult_choice "$des_header" '[^ ]*' des_header="$the_choice" echo " " echo "Please enter the directory where "$des_header" can be found or no," echo "if it resides in a place where it is found by default (don't" echo "supply /usr/include, when comiling with gcc)" mult_choice "$des_include" '[^ ]*' des_include="$the_choice" if matches "$des_include" '^no?$' ; then des_include="." else if [ ! -f $des_include/$des_header ] ; then echo " " echo "Warning: File '$des_include/$des_header' does not exist." fi fi configure_options="$configure_options --with-des-include=$des_include" configure_options="$configure_options --with-des-header=$des_header" echo " " echo "Please enter the specifier of the DES-library for linking" mult_choice "$des_lib" '[^ ]*' des_lib="$the_choice" if matches "$des_lib" '^lib' ; then des_lib=`echo $des_lib|sed 's#^lib#-l#g;s#[.].*##g'` fi deslibfile=`echo $des_lib|sed 's#^-l#lib#g'`'.*' if [ _"$des_libdir" = _ ] ; then if [ _"$des_include" != _ ] ; then if [ $des_include = "." ] ; then des_libdir="no" else des_libdir=`echo $des_include|sed 's#/include$#/lib#g'` fi else des_libdir="../libdes" fi fi echo " " echo "Please enter the directory where the DES library can be found," echo "or no if it resides in a place, where it is found by default" mult_choice "$des_libdir" '[^ ]*' des_libdir="$the_choice" if matches "$des_libdir" '^no?$' ; then des_libdir="." else /bin/ls $des_libdir/$deslibfile >/dev/null 2>&1 if [ $? -ne 0 ] ; then echo " " echo "Warning: File '$des_libdir/$deslibfile' does not exist." else deslibfile=`basename $des_libdir/$deslibfile` fi fi configure_options="$configure_options --with-des-libdir=$des_libdir" configure_options="$configure_options --with-des-ldflag=$des_lib" echo " " echo "Changes in the encryption routines were necessary due to a bug" echo "in all libdes versions. Thus the newly built programs are unable" echo "to authenticate successfully with existing installations." echo "Furthermore if the __descrpt program was used to encrypt files," echo "they cannot be decrypted with this program any longer." echo "Nonetheless it is possible to build the package using the buggy" echo "function, so backward compatibility for existing installations" echo "is provided. Should the buggy function be used ?" yes_no $libdesbug_enabled libdesbug_enabled=$yesno}###########################################################################choose_ZLIB(){ echo " " echo "Will we use the libz compression library to have" echo "built-in compression available ?" yes_no "$use_zlib" use_zlib="$yesno" if [ $yesno = "no" ] ; then return fi configure_options="$configure_options --with-zlib" echo " " echo "Please enter the directory where zlib.h can be found or no," echo "if it resides in a place where it is found by default (don't" echo "supply /usr/include when comiling with gcc)" mult_choice $zlib_include '[^ ]*' zlib_include="$the_choice" if matches "$zlib_include" '^no?$' ; then zlib_include="." else if [ ! -f $zlib_include/zlib.h ] ; then echo " " echo "Warning: File '$zlib_include/zlib.h' does not exist." fi fi configure_options="$configure_options --with-zlib-include=$zlib_include" if [ _"$zlib_libdir" = _ ] ; then if [ _"$zlib_include" != _ ] ; then if [ $zlib_include = "." ] ; then zlib_libdir="no" else zlib_libdir=`echo $zlib_include|sed 's#/include$#/lib#g'` fi else zlib_libdir="/usr/local/lib" fi fi echo " " echo "Please enter the directory where the libz library can be found" echo "or no, if it resides in a place where it is found by default" mult_choice "$zlib_libdir" '[^ ]*' zlib_libdir="$the_choice" if matches "$zlib_libdir" '^no?$' ; then zlib_libdir="." else ls $zlib_libdir/libz.* >/dev/null 2>&1 if [ $? -ne 0 ] ; then echo " " echo "Warning: File '$zlib_libdir/libz.*' does not exist." fi fi configure_options="$configure_options --with-zlib-libdir=$zlib_libdir"}###########################################################################choose_threads(){ echo " " echo "Do you wish to disable threads even if they are" echo "available on your system? If unsure enter no." yes_no $disable_threads disable_threads="$yesno" if [ $yesno = yes ] ; then configure_options="$configure_options --disable-threads" fi}###########################################################################choose_optimization(){ echo " " echo "On some systems with some compilers high optimization seems to" echo "corrupt the coded algorithms, so the behaviour of the program is" echo "not like intended by the programmer. Then it might be desirable" echo "to reduce the level of optimization. Performance loss should" echo "be small as most of the time the CPU spends in system calls or" echo "library functions (e.g. libz calls). Please enter the desired" echo "compiler flags, if different from the default:" mult_choice "$optimizer_flags" '.*' optimizer_flags="$the_choice" echo ."$optimizer_flags" | grep '^.-' >/dev/null if [ $? -ne 0 ] ; then optimizer_flags="-$optimizer_flags" fi}##########################################################################ask_install(){ echo ' ' echo 'Now we are going to install the software. If you want to' echo 'stop here for whatever reason, enter no.' echo ' ' echo_n 'Install the software now ? ' yes_no "$do_install" do_install="$yesno" if [ $do_install = no ] ; then do_exit 0 fi}###################################################################### choose appropriate routines for PS1 (display all processes)# and PS2 (display a certain process)#ps -uxawwww >/dev/null 2>&1if [ $? -eq 0 ] ; then ps -uxawwww 2>&1 | egrep -i 'bad.*syntax.*bogus' >/dev/null if [ $? -eq 0 ] ; then PS1(){ ps uxawwww } else PS1(){ ps -uxawwww } fielse ps uxawwww >/dev/null 2>&1 if [ $? -eq 0 ] ; then PS1(){ ps uxawwww } else PS1(){ ps -ef } fifiPS2(){ ps1 | awk '$2 = '"$1"' { print $0 }'}################################################################### choose an appropriate routine for echo_n (echo without newline)#if [ _`find_program printf` != _ ] ; then echo_n(){ printf "%s" "$@" }else ( echo -n hallo ; echo _ ) | grep '^hallo' >/dev/null if [ $? -eq 0 ] ; then echo_n(){ echo -n "$@" } else ( echo 'hallo\c' ; echo _ ) | grep 'hallo_$' >/dev/null if [ $? -eq 0 ] ; then echo_n(){ echo "$@"'\c' } else echoprog=`find_program echo` ( $echoprog -n hallo ; $echoprog _ ) | grep '^hallo' >/dev/null if [ $? -eq 0 ] ; then echo_n(){ $echoprog -n "$@" } else ( $echoprog 'hallo\c' ; $echoprog _ ) | grep 'hallo_$' >/dev/null if [ $? -eq 0 ] ; then echo_n(){ $echoprog "$@"'\c' } else echo_n(){ # the final crutch echo "$@" | head -1 | awk '{printf "%s", $0}' } fi fi fi fifi######################################################################## extend the path by some directories that according to experience# contain useful programs#pathext=" /usr/bin /bin /usr/ccs/bin /usr/ccs/lib /opt/gnu/bin /usr/local/bin /usr/local/gnu/bin /opt/bin /opt/gnu /opt/GNU/bin /opt/GNU /opt/TWWfsw/bin"for newdir in $pathext ; do if [ ! -d $newdir ] ; then continue fi found=0 for dir in `echo "$PATH" | tr : ' '` ; do if [ "$dir" = "$newdir" ] ; then found=1 break fi done if [ $found -lt 1 ] ; then PATH="$PATH"":$newdir" fidoneexport PATH######################################################## main program#CONF_INTERPR=""if matches "$OSNAME" HPUX ; then CONF_INTERPR="ksh"fiif [ _"$adminprefix" = _ ] ; then adminprefix="/etc"fiinetdfile="$adminprefix/inetd.conf"use_xinetd=0xinetd_running=`PS1 | grep -v grep | grep xinetd | wc -l`if [ -f $adminprefix/xinetd.conf -a $xinetd_running -eq 0 ] ; then use_xinetd=1 inetdfile="$adminprefix/xinetd.conf"fiinetdfile=`resolvepath $inetdfile`tmpfile="/tmp/core.tmp.$$"saved_files=""modes="servonly clntonly clntrem all"unset GNU_MAKETHE_MAKE=`which_make`if [ $? -eq 1 ] ; then GNU_MAKE="$THE_MAKE"fiMAKEOPTS="EXTRA_CFLAGS=-DORIG_DEFAULTS"MAKECMD="make"if [ _"$GNU_MAKE" != _ ] ; then MAKEOPTS="$MAKEOPTS MAKECMD=$GNU_MAKE" MAKECMD="$GNU_MAKE"ficonfigure_options=""clearecho " "echo 'Welcome to the installation procedure for'echo " "echo "AF's backup system *"echo '===================='echo " "echo ' 'echo 'You can interrupt this program any time hitting Ctrl-C. For the'echo 'most of the following questions a default answer is offered in'echo "square brackets. If you don't want to change this or if you are"echo "unsure, it is quite safe to confirm the offered choice, so please"echo "feel free to just hit the Return key."echo " "echo "First you have to decide, which functionality you"echo 'would like to have on this machine.'echo " "echo '(1) Backup server only'echo '(2) Backup client only (also to start backups on other hosts)'echo '(3) Backup client only with remote start option'echo '(4) Backup server, client and client remote start option'echo " "sel=0while true ; do if matches "$sel" '^[1-4]$' ; then break fi echo_n 'Please enter your choice [1-4]: ' read sel if matches "$sel" '^[1-4]$' ; then : else echo "This is not a valid choice. Please try again." echo " " fidonemode=`echo "$modes" | awk '{print $'$sel'}'`if matches "$OSNAME" SunOS || matches "$OSNAME" HPUX ; then the_gcc=`find_program gcc` echo ' ' echo 'Shall we use gcc to build afbackup (strongly recommended) ?' defaultusegcc="Yes" if [ `echo $the_gcc | wc -w` -lt 1 ] ; then echo '(Unfortunately gcc is not found in the current $PATH)' defaultusegcc="No" fi if [ _"$usegcc" = _ ] ; then usegcc="$defaultusegcc" fi yes_no $usegcc usegcc="$yesno" if [ $usegcc = yes ] ; then CC="gcc" export CC fififor SIG in INT TERM ABRT HUP BUS PIPE ; do SIGNUM=`signalbyname $SIG` if [ _"$SIGNUM" != _ ] ; then trap "intrexit $SIGNUM" $SIGNUM fidonecase "$sel" in 1) server_only ;; 2) client_only ;; 3) remclient ;; 4) all ;;esacecho " "if [ $mode = client_only -o $mode = remclient -o $mode = all ] ; then echo "When the server has been configured properly, the following" echo "commands can be used to do backup, verify and restore (all" echo "in $clntinstdir/client/bin):" echo " full_backup to make a full backup" echo " incr_backup to make an incremental backup" echo " afverify to verify the latest backup" echo " afrestore ... to make restores" echo "For more information see the INTRO file and the manual pages."fiecho 'All done. The input supplied during this installation procedure'echo 'is saved in the file "Install.cache". This file can be copied'echo 'somewhere else to have the input present as default for the next'echo 'upgrade or installation on other architectures. The file will be'echo 'erased when you do a "make distclean".'if [ `echo $saved_files | wc -w` -gt 0 ] ; then echo " " echo "The following files are safety copies of files, that" echo "are crucial for your system. If up to now everything" echo "worked fine then you can safely remove them:" echo " " echo $saved_files echo ' 'fido_exit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -