📄 install
字号:
# /bin/rm -f $clntinstdir/client/bin/afrestore \# $clntinstdir/client/bin/afbackout \# $clntinstdir/client/bin/backout \# $clntinstdir/client/bin/restore# cp $clntinstdir/client/bin/full_backup \# $clntinstdir/client/bin/afrestore# ln $clntinstdir/client/bin/afrestore $clntinstdir/client/bin/afbackout# ln -s afbackout $clntinstdir/client/bin/backout# ln -s afrestore $clntinstdir/client/bin/restore# chmod 4755 $clntinstdir/client/bin/afrestore# chmod 755 $clntinstdir/client/bin/xafrestore $clntinstdir/client/bin/__packpats fi echo " " if [ $s -ne 0 ] ; then echo "Oops, something went wrong. Maybe your directory choice is" echo "somewhat problematic. Choose one of: Abort, Retry (A/R)" mult_choice R '[AaRr]' if [ _"$the_choice" = _ ] ; then the_choice="r" fi if matches "$the_choice" '^a' ; then do_exit 1 else continue fi fi break done add_backup_service servicename tcp port echo ' ' echo 'Do you want to add an entry to '"$adminprefix/services" echo 'for the multi stream server ?' yes_no "$add_mservice" add_mservice=$yesno if [ "$add_mservice" = "yes" ] ; then add_backup_service mservicename tcp mport fi echo " " echo "You might now want to move the variable part of the" echo "client side installation to the /var-directory. The" echo "default directory is $clntvarinstdir. If you want to" echo "do this and this directory is ok, just enter yes. If" echo 'the directory is not ok, enter the desired one (you' echo 'may supply the same as for the server side). If you' echo "want to skip this step, just enter no." # mvclntvar: while true ; do echo ' ' echo_n 'Your choice (Yes/No/path) [No]: ' read c if [ "$c" = "" ] ; then c="no" fi if matches "$c" '^(ye?s?|no?|/.*)$' ; then break fi echo ' ' echo "Invalid choice. Please try again." done if matches "$c" '^/' ; then clntvarinstdir="$c" fi if matches "$c" '^no?$' ; then : else mkdir -p "$clntvarinstdir" curwd=`pwd` cd "$clntinstdir"/client if issymlink var ; then echo " " echo "Warning: The directory seems to have been moved already." echo " Please check where $clntinstdir/client/var" echo " points to. Not moving anything." else tar cf - var | (cd "$clntvarinstdir"; tar xf -) mv "$clntvarinstdir"/var "$clntvarinstdir"/client /bin/rm -rf var ln -s "$clntvarinstdir"/client var fi fi echo ' ' echo "Now we may run the program $clntinstdir/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 "$clntinstdir"/client/bin/clientconfig fi}################ SERVER INSTALLATION #################server_install(){ while true ; do echo "First you have to specify where to install the" echo "files and programs. Please enter a directory of" echo 'your choice (you may supply the same directory' echo 'as for the client side).' echo "If '$servinstdir' is fine enter yes." echo 'Otherwise enter an alternate directory, please.' while true ; do echo ' ' echo_n 'Your choice (Yes/No/path) [Yes]: ' read choice if [ _"$choice" = _ ] ; then choice="yes" fi if matches "$choice" 'no?' ; then echo_n "Please enter the directory: " read choice if matches "$choice" '^/' ; then serverinstdir="$choice" break fi fi if matches "$choice" '^/' ; then servinstdir="$choice" fi if matches "$choice" '^(ye?s?|no?|/.*)$' ; then break fi echo " " echo "That's no valid choice. Please Try again." done clntinstdir="$servinstdir" choose_DES echo " " choose_ZLIB echo " " if [ $mode != "clntrem" -a $mode != "servonly" ] ; then echo " " echo "Do you want ordinary users to be able to restore their" echo "own files and/or directories without administrator help ?" yes_no $orduserrestore orduserrestore=$yesno fi choose_threads choose_optimization echo " " echo "Now we have to build the programs. Please stand by" echo "and watch for error messages. If any occur you have" echo "a problem. Warnings can usually be ignored. If errors" echo 'occur, drop a mail to the author (af@muc.de)' echo 'with the fault message(s) of make or try to patch the' echo "stuff yourself. If you succeed, please also drop a" echo "mail to the author, so your changes can be added to the" echo "distribution." echo " " echo "Running configure now ..." echo " " $CONF_INTERPR ./configure -prefix="$servinstdir" --without-prefixext \ --with-rexecdir="$servinstdir"/server/rexec \ $configure_options s="$?" echo " " if [ $s -ne 0 ] ; then echo "Damn. Something went wrong. Please contact the author." echo "Stopping here." do_exit 1 fi if matches "$libdesbug_enabled" '^yes$' ; then if [ `grep -c LIBDESBUG_COMPATIBILITY des_aux.h` -lt 1 ] ; then echo '#define LIBDESBUG_COMPATIBILITY 1' >> des_aux.h fi fi echo "Running make now ..." echo " " if [ $mode = "all" -o $mode = "clntrem" ] ; then $MAKECMD $MAKEOPTS OPTIMIZE="$optimizer_flags" s="$?" else $MAKECMD server $MAKEOPTS OPTIMIZE="$optimizer_flags" s="$?" fi echo " " if [ $s -ne 0 ] ; then echo "Damn. Something went wrong. Please contact the author." echo "Stopping here." do_exit 1 fi ask_install echo " " echo "We're now going to install the files and programs." echo " " if [ $mode = "all" -o $mode = "clntrem" ] ; then $MAKECMD install install.rclient $MAKEOPTS OPTIMIZE="$optimizer_flags" s="$?" else $MAKECMD install.server $MAKEOPTS OPTIMIZE="$optimizer_flags" s="$?" fi if test $s -eq 0 && matches "$orduserrestore" 'ye?s?' ; then $MAKECMD install.userrestore $MAKEOPTS OPTIMIZE="$optimizer_flags" s="$?"# /bin/rm -f $servinstdir/client/bin/afrestore \# $servinstdir/client/bin/afbackout \# $servinstdir/client/bin/backout \# $servinstdir/client/bin/restore# cp $servinstdir/client/bin/full_backup \# $servinstdir/client/bin/afrestore# ln $servinstdir/client/bin/afrestore $servinstdir/client/bin/afbackout# ln -s afbackout $servinstdir/client/bin/backout# ln -s afrestore $servinstdir/client/bin/restore# chmod 4755 $servinstdir/client/bin/afrestore# chmod 755 $servinstdir/client/bin/xafrestore $servinstdir/client/bin/__packpats fi echo " " if [ $s -ne 0 ] ; then echo "Oops, something went wrong. Maybe your directory choice is" echo "somewhat problematic. Choose one of: Abort, Retry (A/R)" mult_choice R '[AaRr]' if [ _"$the_choice" = _ ] ; then the_choice="r" fi if matches "$the_choice" '^a' ; then do_exit 1 else continue fi fi break done /bin/rm -f $tmpfile add_backup_service servicename tcp port if [ _"$username" = _ ] ; then if [ $mode = "all" -o $mode = "clntrem" ] ; then username="root" else username="backup" fi fi echo ' ' add_inetd_entry "$servicename" nowait afserver echo ' ' echo 'Do you want to activate the multi stream server ?' yes_no "$activate_mserver" activate_mserver="$yesno" if [ "$activate_mserver" = "yes" ] ; then echo ' ' echo 'The multi-stream server should use a different port than the' echo 'normal server, so we now configure the appropriate entries' echo 'for the system files.' add_backup_service mservicename tcp mport echo ' ' add_inetd_entry "$mservicename" wait afmserver fi echo ' ' add_user_group "$username" "$userid" "$groupid" RESTRSERVERFILES="afmserver afserver label_tape cartready" for SF in $RESTRSERVERFILES ; do chown "$username" "$servinstdir"/server/bin/$SF done if [ "$username" != "root" ] ; then echo ' ' echo "The user ID the server will run under is not root." echo "So we are now going do change the ownership of the" echo "directory containing varying serverside files and" echo "storing persistent information for the server to the" echo "user $username. Furthermore all the files residing in" echo "this directory will change the owner the same way. If" echo "we wouldn't do so, the server would not be able to modify" echo "these files. That could result in really bad situations." echo "If you consider this as dangerous or disadvantageous, or " echo "if there's any reason to not like it then enter no now." echo ' ' echo "Change owner of $servinstdir/server/var/* to $username ?" yes_no "$chown_server_var" chown_server_var="$yesno" if [ "$chown_server_var" = yes ] ; then chown "$username" "$servinstdir"/server/var "$servinstdir"/server/var/* if [ $? -ne 0 ] ; then echo ' ' echo "Whoaaa, this failed, probably it must be done by the superuser." echo "Please press Return after having entered" echo ' ' echo " chown $username $servinstdir/server/var $servinstdir/server/var/*" echo ' ' echo "or if you want to skip this step" read a fi fi echo ' ' fi if [ $mode != "clntrem" ] ; then echo " " echo "Now we should change the owner of your tape device" echo "to user $username and grant him exclusive access to it." echo "You may now enter a filename pattern or no if you" echo "want to skip this step. Here are the usual streamer" echo "device name patterns for some OS-es:" echo " " echo "Solaris: /dev/rmt/[0-9]*" echo "AIX: /dev/rmt[0-9]*" echo "IRIX: /dev/rmt/tps[0-9]*" echo "HP-UX: /dev/rmt/[0-9]*" echo "Linux: /dev/st[0-9]* /dev/nst[0-9]*" echo "Digital UNIX: /dev/rmt[0-9]* /dev/nrmt[0-9]*" echo "FreeBSD: /dev/rst[0-9]* /dev/nrst[0-9]*" echo "OpenBSD: /dev/rst[0-9]* /dev/nrst[0-9]*" case $OSNAME in SunOS) osdefdev="/dev/rmt/0*" ;; AIX) osdefdev="/dev/rmt0*" ;; IRIX) osdefdev="/dev/rmt/tps0d4*" ;; HPUX) osdefdev="/dev/rmt/0*" ;; Linux) osdefdev="/dev/st0* /dev/nst0*" ;; OSF1) osdefdev="/dev/rmt0* /dev/nrmt0*" ;; FreeBSD) osdefdev="/dev/sa0* /dev/nsa0*" ;; OpenBSD) osdefdev="/dev/rst0* /dev/nrst0*" ;; *) osdefdev="" esac if [ _"$defdev" = _ ] ; then defdev="$osdefdev" fi echo " " echo_n "Your choice [$defdev]: " read c if [ _"$c" = _ ] ; then c="$defdev" fi if matches _"$c" '^_ye?s?' ; then c="$osdefdev" fi if matches "$c" '^no?$' ; then : else chown "$username" $c r=$? chmod 600 $c r2=$? if [ $r -ne 0 -o $r2 -ne 0 ] ; then echo "Oops, this did not work. Please do it manually by " echo 'entering the following lines:' echo " " echo " chown $username $c" echo " chmod 600 $c" echo " " echo "Please hit return when you are done with it or" echo "want to skip this step." read c fi fi defdev="$c" fi echo ' ' inetdline=`PS1|grep -v grep|grep inetd` running_inetds=`PS1|grep -v grep|grep inetd|wc -l` if [ $running_inetds = 0 ] ; then echo "Sorry, i'm unable to determine the process ID of " echo 'inetd. Would you do me a favour and enter it here ?' # askforinetdpid: while true ; do echo ' ' echo_n 'Process ID: ' read pid if matches "$pid" '^[0-9][0-9]*$' ; then : else echo "Invalid input. Please try again." continue fi PS2 $pid >/dev/null 2>&1 if [ $? -eq 0 ] ; then break else echo "This is not the pid of the inetd. Please try again." fi done inetdline=`PS2 $pid|grep -v grep|grep inetd` fi if [ $running_inetds -gt 1 ] ; then echo "Sorry, I found several processes looking like inetd." echo "Would you please give me a hint and tell me the real" echo 'process ID ? You may evaluate the following lines:' echo ' ' PS1|grep -v grep|grep inetd # askfipid2: while true ; do echo ' ' echo_n 'Process ID: ' read pid if matches "$pid" '^[0-9][0-9]*$' ; then : else echo ' ' echo "Invalid input. Please try again." continue fi PS2 $pid >/dev/null 2>&1 if [ $? -eq 0 ] ; then break else echo ' ' echo "This is not the pid of the inetd. Please try again." fi done inetdline=`PS2 $pid|grep -v grep|grep inetd` fi inetdline=`echo "$inetdline"|sed 's/[?*\[]/_/g;s/\]/_/g'` if [ $running_inetds -eq 1 ] ; then pid=`echo "$inetdline" | awk '{print $2}'` fi echo ' ' echo "The process ID of the inetd seems to be $pid, the" echo "respective entry in the process list is:" echo ' ' echo "$inetdline" echo ' ' if [ $use_xinetd -eq 0 ] ; then INETDNAME=inetd SIG="HUP" else INETDNAME=xinetd SIG="USR2" fi echo "To activate the backup service we can now send a $SIG signal" echo_n "to $INETDNAME"'. Do you want to do this ? ' yes_no Yes c="$yesno" if [ $c = yes ] ; then sh -c "kill -$SIG $pid" if [ $? -ne 0 ] ; then echo " " echo "Heyaa, couldn't send signal to the inetd. Probably this" echo "should be done as the superuser. Please press Return after" echo "having done it manually by entering 'kill -$SIG $pid'" echo "or if you want to skip this step." read a fi fi echo " " echo "You might now want to move the variable part of the" if [ $mode = "all" -o $mode = "clntrem" ] ; then echo_n "backup service" else echo_n "server side" fi echo " installation to the /var-directory. The" echo "default directory is $servvarinstdir. If you want to" echo "do this and this directory is ok, just enter yes. If" echo 'the directory is not ok, enter the desired one (you' echo 'may supply the same as for the client side). If you' echo "want to skip this step, just enter no." # mvservvar: while true ; do echo ' ' echo_n 'Your choice (Yes/No/path) [No]: ' read c if [ "$c" = "" ] ; then c="no" fi if matches "$c" '^(ye?s?|no?|/.*)$' ; then break fi echo ' ' echo "Invalid choice. Please try again." done if matches "$c" '^/' ; then servvarinstdir="$c" fi if matches "$c" '^no?$' ; then : else mkdir -p "$servvarinstdir" curwd=`pwd` cd "$servinstdir"/server if issymlink var ; then echo "Warning: The directory seems to have already been moved." echo " Please check where $servinstdir/server/var" echo " points to. Not moving anything." else tar cf - var | (cd "$servvarinstdir"; tar xf -) mv "$servvarinstdir"/var "$servvarinstdir"/server /bin/rm -rf var ln -s "$servvarinstdir"/server var fi if [ $mode = "all" -o $mode = "clntrem" ] ; then cd "$servinstdir"/client if issymlink var ; then echo "Warning: The directory seems to have already been moved." echo " Please check, where $servinstdir/client/var" echo " points to. Not moving anything." else tar cf - var | (cd "$servvarinstdir"; tar xf -) mv "$servvarinstdir"/var "$servvarinstdir"/client /bin/rm -rf var ln -s "$servvarinstdir"/client var fi fi cd "$curwd" fi if [ $mode = "all" -o $mode = "servonly" ] ; then echo ' ' echo "Now we may run the program $servinstdir/server/bin/serverconfig" echo "so you can configure the server side of the backup system. Would"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -