⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 install

📁 一套客户/服务器模式的备份系统代码,跨平台,支持linux,AIX, IRIX, FreeBSD, Digital Unix (OSF1), Solaris and HP-UX.
💻
📖 第 1 页 / 共 4 页
字号:
	fi	if matches "$server_args1""/" ^"$servinstdir""/" ; then	  :	else	  echo 'The program path in this entry is wrong (it must be '$servinstdir'/$prognam).'	  def="Yes"	fi	user=`get_xinetd_param $servnam user $inetdfile`	if [ "$user" != "$username" ] ; then	  echo 'The username in this entry is wrong (should be '"$username"').'	  def="Yes"	fi	prot=`get_xinetd_param "$servnam" protocol "$inetdfile" | tolowercase`	wait=`get_xinetd_param "$servnam" wait "$inetdfile"`	sockt=`get_xinetd_param "$servnam" socket_type "$inetdfile"`	if [ "$prot" != "$protnam" -o "$wait" != "$waityesno" -o "$sockt" != "stream" ] ; then	  echo 'The protocol in this entry is wrong (we are allowing'	  if [ "$waitforexit" = "nowait" ] ; then	    echo 'several server processes).'	  else	    echo 'only one server process)'	  fi	  def="Yes"	fi	flags=`get_xinetd_param "$servnam" flags "$inetdfile"`	echo "$flags" | egrep '^(.* )?REUSE( .*$)?' >/dev/null	reuse="$?"	echo "$flags" | egrep '^(.* )?NAMEINARGS( .*$)?' >/dev/null	nameinargs="$?"	if [ $nameinargs -ne 0 -o $reuse -ne 0 ] ; then	  echo 'The flags in this entry are wrong (REUSE and NAMEINARGS must be set)'	  def="Yes"	fi      fi      if [ $def != "No" ] ; then	echo " "      fi      echo 'Should we remove this entry and create a new one ?'      if yes_no "$def" ; then	panic=0	cp -p "$inetdfile" "$inetdfile.$$"	saved_files="$saved_files $inetdfile.$$"	if [ ! -f "$inetdfile.$$" ] ; then	  echo "Panic: cannot make backup copy of $inetdfile."	  echo "I'll not go on to add the entry. You have to do it yourself."	  panic=1	else	  if [ $use_xinetd -ne 0 ] ; then	    NEWINETDF=`strip_xinetd_entry "$servnam" "$inetdfile" | comb_empty_lines`	  else	    NEWINETDF=`egrep -v '^[ 	]*'"$servnam"'([ 	].*)?$' "$inetdfile"`	  fi	  echo "$NEWINETDF" > "$inetdfile".tmp.$$ \	   && /bin/mv "$inetdfile".tmp.$$ "$inetdfile"	  if [ $? -ne 0 ] ; then	    echo "Error: removing entry from the system file failed."	    panic=1	  fi	fi	if [ $panic -ne 0 ] ; then	  echo "The following line must be removed from $inetdfile"	  echo ' '	  echo "$inetdline"	  echo " "	  echo "Please hit enter when you are done with it."	  read a	fi	continue      else	if [ $use_xinetd -ne 0 ] ; then	  user=`get_xinetd_param "$servnam" user "$inetdfile"`	else	  line=`egrep '^[ 	]*'"$servnam"'([ 	].*)?$' "$inetdfile"`	  I=1	  N=`echo "$line" | wc -w`	  while [ $I -le $N ] ; do	    eval line$I'="'`echo "$line" | awk '{print $'"$I"'}'`'"'	    I=`expr $I + 1`	  done	  username="$line5"	fi      fi    else      echo ' '      echo "Should we add an entry to $inetdfile for this"      echo 'service ? Default username is '$username'. If you do not'      echo 'want to add an entry, just enter no. If you would like'      echo 'to run the server under a different username, enter it.'      echo 'If everything is ok, enter yes.'      # askaddinetd:      echo ' '      echo_n "Your choice (Yes/No/username) [Yes]: "      c=""      read c      if [ _"$c" = _ ] ; then	c="Yes"      fi      if matches "$c" '^(ye?s?|no?)$' ; then	:      else	username="$c"      fi      if matches "$c" '^no?$' ; then	:      else	if [ $use_xinetd -ne 0 ] ; then	  cut -c14- >> $inetdfile << EOF           >            > service $servnam           > {           >         flags           = REUSE NAMEINARGS           >         socket_type     = stream           >         protocol        = $protnam           >         wait            = $waityesno           >         user            = $username           >         server          = $servinstdir/server/bin/$prognam           >         server_args     = $servinstdir/server/bin/$prognam $servinstdir/server/etc/backup.conf           > }EOF	else	  echo "$servnam	stream	$protnam	$waitforexit	$username	$servinstdir/server/bin/$prognam $servinstdir/server/bin/$prognam $servinstdir/server/etc/backup.conf" >> $inetdfile	fi      fi    fi    break  done}####### add user and group entry to /etc/passwd and /etc/groupadd_user_group(){  myusername="$1"  userid="$2"  groupid="$3"  passwdfile="$adminprefix/passwd"  if [ `matches "$OSNAME" OpenBSD` ] ; then    passwdfile="$adminprefix/master.passwd"  fi  if [ `grep -c '[ 	]*'"$myusername": $passwdfile` -lt 1 ] ; then    echo "No user entry found for $myusername in $passwdfile."    echo ' '    echo_n 'Should we add an entry ? '    if yes_no Yes ; then      if [ _"$userid" = _ ] ; then	userid=2988      fi      while [ `cut -f3 -d: $passwdfile|grep -c "^$userid"'$'` -gt 0 ] ; do	userid=`expr $userid + 1`      done      echo " "      echo "The default user-ID is $userid. If this is ok, just"      echo "enter yes. If not, enter the desired ID."      # askforuserid:      while true ; do	echo " "	echo_n 'Your choice (Yes/No/userid) [Yes]: '	read c	if [ _"$c" = _ ] ; then	  c='Yes'	fi	if matches "$c" '^(ye?s?|no?|[0-9][0-9]*)$' ; then	  if matches "$c" '^[0-9][0-9]*$' ; then	    userid="$c"	  elif matches "$c" '^n' ; then	    echo "Please enter the desired user-ID."	    continue	  fi	  break	fi	echo ' '	echo 'This is not a valid choice. Please try again.'      done      if [ `cut -f3 -d: $passwdfile|grep -c "^$userid"'$'` -gt 0 ] ; then	echo "Warning: A user entry with the user-ID $userid already exists"	echo "     on the system. Using it nonetheless."      fi      if [ _"$groupid" = _ ] ; then	groupid=14      fi      while [ `cut -f3 -d: $adminprefix/group|grep -c "^$groupid"'$'` -lt 1 ] ; do	groupid=`expr $groupid - 1`	if [ $groupid -eq 0 ] ; then	  break	fi      done      while [ `cut -f3 -d: $adminprefix/group|grep -c "^$groupid"'$'` -lt 1 ] ; do	groupid=`expr $groupid + 1`      done      echo " "      echo "The default group-ID is $groupid. If this is ok, just"      echo "enter yes. If not, enter the desired ID."      # askforgroupid:      while true ; do	echo " "	echo_n 'Your choice (Yes/No/groupid) [Yes]: '	read c	if [ _"$c" = _ ] ; then	  c='Yes'	fi	if matches "$c" '^(ye?s?|no?|[0-9][0-9]*)$' ; then	  if matches "$c" '^[0-9][0-9]*$' ; then	    groupid="$c"	    if [ `cut -f3 -d: "$adminprefix"/group|grep -c "^$groupid"'$'` -lt 1 ] ; then	      echo "Warning: A group entry with this group-ID does not exist"	      echo "    in the system. Using it nonetheless."	    fi	  elif matches "$c" '^n' ; then	    echo "Please enter the desired group-ID."	    continue	  fi	  break	fi	echo ' '	echo 'This is not a valid choice. Please try again.'      done      panic=0      /bin/cp -p $passwdfile $passwdfile.$$      saved_files="$saved_files $passwdfile.$$"      tmppasswdfile="$passwdfile.tmp.$$"      if [ ! -f $passwdfile.$$ ] ; then	echo "Panic: cannot make backup copy of $passwdfile."	echo "I'll not go on to add the user. You have to do it yourself."	panic=1      else	if [ `grep -c '^+' $passwdfile` -gt 0 ] ; then	  /bin/rm -f $tmpfile	  echo "/^+/ i\\" > $tmpfile	  echo "$myusername":x:"$userid":"$groupid":"Backup Server:$servinstdir/server:" \  		>>$tmpfile	  NEWPASSWDF=`sed -f $tmpfile $passwdfile`	  if [ $? -ne 0 ] ; then	    echo "Error: adding the user to the system file failed."  	    panic=1	  else	    if matches "$OSNAME" OpenBSD ; then	      echo "$NEWPASSWDF" > $tmppasswdfile \	       && pwd_mkdb $tmppasswdfile \	       && echo "$NEWPASSWDF" > $tmppasswdfile \	       && pwd_mkdb -p $tmppasswdfile \	       && /bin/rm -f $tmppasswdfile # just in case pwd_mkdb forgets it	      EST=$?	    else  	      echo "$NEWPASSWDF" > $passwdfile	      EST=$?	    fi	    if [ $EST -ne 0 ] ; then	      echo "Error: adding the user to the system file failed."	      panic=1	    fi	  fi	else	  if matches "$OSNAME" OpenBSD ; then	    /bin/rm -f $tmpfile \	     && /bin/cp -p $passwdfile $tmpfile \	     && echo "$myusername":x:"$userid":"$groupid":"Backup Server:$servinstdir/server:" \		>> $tmpfile \	     && /bin/cp -p $tmpfile $tmppasswdfile \	     && pwd_mkdb $tmppasswdfile \	     && /bin/cp -p $tmpfile $tmppasswdfile \	     && pwd_mkdb -p $tmppasswdfile # just in case pwd_mkdb forgets it	    EST=$?	  else	    echo "$myusername":x:"$userid":"$groupid":"Backup Server:$servinstdir/server:" \		>> $passwdfile	    EST=$?	  fi          if [ $EST -ne 0 ] ; then  	    echo "Error: adding the user to the system file failed."  	    panic=1	  fi	fi      fi    fi    if [ $panic -ne 0 ] ; then      echo "The following line must be added to $passwdfile"      echo '(before the line starting with a +, if present):'      echo ' '      echo "$myusername":x:"$userid":"$groupid":"Backup Server:$servinstdir/server:"      echo " "      echo "Please hit enter when you are done with it."      read a    fi  fi  username="$myusername"}################################################################################intrexit(){  echo ' '  save_cache_vars  exit `expr 128 + $1`}############################################################################### resolve all symlinks in path, the only argument#resolvepath(){  oldpath="$1"  newpath="$oldpath"_  while [ _"$newpath" != _"$oldpath" ] ; do    newpath="$oldpath"    oldpath=`echo "$oldpath"|sed 's#/\./#/#g;s#/\.$##g;s#//*#/#g;s#^\./##g;s#^/\.\./#/#g'`    if [ "$oldpath" != '/' ] ; then      oldpath=`echo "$oldpath"|sed 's#/*$##g'`    fi  done  if [ _`echo "$oldpath"|cut -c1` = _"/" ] ; then    oldhead="/"`echo "$oldpath"|cut -c2-|sed 's#/.*$##g'`    oldtail=`echo "$oldpath"|cut -c2-|sed 's#^[^/]*/##'`  else    oldhead=`echo "$oldpath"|sed 's#/.*$##g'`    oldtail=`echo "$oldpath"|sed 's#^[^/]*/##'`  fi  if [ _"$oldpath" = _"$oldhead" ] ; then    oldtail=""  fi  while true ; do    if [ _"$oldhead" = _ ] ; then      oldhead="."    fi    if [ ! -f "$oldhead" -a ! -d "$oldhead" ] ; then      echo ""      return 0    fi    linkchar=`ls -ld "$oldhead"|cut -c1`    if [ $linkchar = 'l' ] ; then      points_to=`ls -ld "$oldhead"|sed 's#^.*->[ 	]*##g'`      if [ `echo "$points_to"|cut -c1` = '/' ] ; then        newpath="$points_to"/"$oldtail"      else        newpath=`dirname "$oldhead"`/"$points_to"/"$oldtail"      fi      echo `resolvepath "$newpath"`      return $?    fi    if [ _"$oldtail" = _ ] ; then      oldpath="$oldhead"      break    fi    oldhead="$oldhead"/`echo "$oldtail"|sed 's#/.*$##g'`    if [ `echo "$oldtail"|grep /|wc -l` -lt 1 ] ; then      oldtail=''    else      oldtail=`echo "$oldtail"|sed 's#^[^/]*/##g'`    fi  done  newpath="$oldpath"_  while [ _"$newpath" != _"$oldpath" ] ; do    newpath="$oldpath"    oldpath=`echo $oldpath|sed 's#[^/][^/]*/\.\./##g;s#[^/][^/]*/\.\.$##g;s#/\./#/#g;s#/\.$##g;s#//*#/#g;s#^\./##g;s#^/\.\./#/#g'`    if [ "$oldpath" != '/' ] ; then      oldpath=`echo "$oldpath"|sed 's#/*$##g'`    fi  done  echo "$newpath"  return 0}########################## returns 1 if GNU make, 0 if vendor non-GNU make#which_make(){  gmake=`find_program gmake`  if [ `echo $gmake | wc -w` -gt 0 ] ; then    if matches "$gmake" "^/" ; then      echo $gmake      return 1    fi  fi  make=`find_program make`  if [ `echo $make | wc -w` -gt 0 ] ; then    $make -v -n >/dev/null 2>&1    if [ $? -ne 0 ] ; then      echo $make      return 0    fi  fi  # GNU make in disguise  if [ `make -v -n 2>&1 | grep GNU | wc -l` -gt 0 ] ; then    echo make    return 1  fi  echo gmake  return 1}### SERVER ONLY ###server_only(){  echo " "  echo "Ok, we're going to install only the server side on this"  echo_n "machine. "  server_install}### CLIENT ONLY ###client_only(){  echo " "  echo "Ok, we're going to install only the client side on this"  echo_n "machine. "  client_install}### REMOTELY STARTED CLIENT ###remclient(){  echo " "  echo "Ok, we're going to install the client with remote start"  echo_n "option. "  server_install}### CLIENT, SERVER AND REMOTE START OPTION ###all(){  echo " "  echo "Ok, we will install the client, server and remote start"  echo_n "option. "  server_install}################## CLIENT INSTALLATION ##################client_install(){  while true ; do    # ask_for_clntinstdir:    echo "First you have to choose where we should install"    echo "the files and programs. Please enter a directory"    echo 'of your choice (you may supply the same directory'    echo 'as for the server side).'    echo 'Enter yes if '"$clntinstdir"' is ok.'    echo 'Otherwise please enter an alternate directory.'    # choose_clntinstdir:    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	  clntinstdir="$choice"	  break	fi      fi      if matches "$choice" '^/' ; then	clntinstdir="$choice"      fi      if matches "$choice" '^(ye?s?|no?|/.*)$' ; then	break      fi      echo " "      echo "That's no valid choice. Please Try again."    done    choose_DES    echo " "    choose_ZLIB    echo " "    choose_optimization    echo " "    echo "Do you want ordinary users to be able to restore their"    echo "own files and/or directories without administrator help ?"    # orduserclnt:    yes_no $orduserrestore    orduserrestore=$yesno    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"    echo '(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="$clntinstdir" --without-prefixext \		--with-rexecdir="$clntinstdir"/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 " "    $MAKECMD client $MAKEOPTS OPTIMIZE="$optimizer_flags"    s="$?"    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 " "    $MAKECMD install.client $MAKEOPTS OPTIMIZE="$optimizer_flags"    s="$?"    if [ $s = 0 && `matches "$orduserrestore" 'ye?s?'` ] ; then      $MAKECMD install.userrestore $MAKEOPTS OPTIMIZE="$optimizer_flags"      s="$?"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -