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

📄 make.sh

📁 linux下的终端管理工具源码
💻 SH
字号:
#!/bin/sh#set -xecho ""echo COLECTING DATA...VERSION_FILE="nxclient/VERSION"BASELINE_FILE="nxclient/BASELINE"DESC_FILE_TMP="nxclient/rpm/rpm_desc.tmp"PRE_FILE="nxclient/scripts/preinst.sh"POSTIN_FILE="nxclient/scripts/postinst.sh"POSTUN_FILE="nxclient/scripts/postrm.sh"SPEC_FILE_TEMPLATE="nxclient/rpm/nxclient-template.SPEC"SPEC_FILE_TMP1="nxclient/rpm/nxclient.SPEC.tmp1"SPEC_FILE_TMP2="nxclient/rpm/nxclient.SPEC.tmp2"SPEC_FILE="nxclient/rpm/nxclient.SPEC"NX_INSTALL_DIR="/usr/NX"NX_INSTALL_DIR_SHELL="\/usr\/NX"#echo -n "Detecting Linux distro: "#if test -e /etc/fedora-release; then#  DISTRO="RedHat"#  echo "                                 Fedora Core"#elif test -e /etc/redhat-release; then#  DISTRO="RedHat"#  echo "                                 RedHat"#elif test -e /etc/SuSE-release; then#  DISTRO="SuSE"#  echo "                                 SuSE"#else#  echo "                                 failed" #  exit 1#fiDISTRO="Linux"echo -n "Looking for '$VERSION_FILE' file: "if test -e $VERSION_FILE; then  echo "                    done"else  echo "                    failed"   exit 1fiNXCLIENT_VERSION=`cat $VERSION_FILE`if [ $NXCLIENT_VERSION ]; then  echo "NXCLIENT version is:                                     $NXCLIENT_VERSION"else  echo "NXCLIENT version is:                                     unknown"  exit 1fiif [ $# -ne 1 ]; then  RPM_VERSION=$NXCLIENT_VERSION  echo "RPM version not provided. Default:                       $NXCLIENT_VERSION"else  RPM_VERSION=$1  echo "RPM version provided:                                    $RPM_VERSION"fiRPM_VERSION_MAJOR=`echo $RPM_VERSION | awk -F '-' '{print $1}'`if [ $RPM_VERSION_MAJOR ]; then  echo "RPM version, major part:                                 $RPM_VERSION_MAJOR"else  echo "RPM version, major part:                                 unknown"  exit 1fiRPM_VERSION_MINOR=`echo $RPM_VERSION | awk -F '-' '{print $2}'`if [ $RPM_VERSION_MINOR ]; then  echo "RPM version, release part:                               $RPM_VERSION_MINOR"else  echo "RPM version, release part:                               unknown"  exit 1fiecho -n "Looking for '$BASELINE_FILE' file: "if test -e $BASELINE_FILE; then  echo "                   done"else  echo "                   failed"  exit 1fiNXCOMP_VERSION=`cat $BASELINE_FILE | grep nxcomp | awk '{print $2}'`if [ $NXCOMP_VERSION ]; then  echo "NXCOMP version is:                                       $NXCOMP_VERSION"else  echo "NXCOMP version is:                                       unknown"  exit 1fiNXSSH_VERSION=`cat $BASELINE_FILE | grep nxssh | awk '{print $2}'`if [ $NXCOMP_VERSION ]; then  echo "NXSSH version is:                                        $NXSSH_VERSION"else  echo "NXSSH version is:                                        unknown"  exit 1fiecho -n "Creating description file '$DESC_FILE_TMP': "if test -e $DESC_FILE_TMP; then            rm -f $DESC_FILE_TMPfitouch $DESC_FILE_TMPecho "This package contains the graphical front-end used to access X,"   >> $DESC_FILE_TMPecho "RDP and RFB sessions on a remote @PRODUCT_NAME@. It also includes"      >> $DESC_FILE_TMPecho "NX X compression libraries and utilities needed by the Client" >> $DESC_FILE_TMPecho ""                                                                  >> $DESC_FILE_TMPecho "Included packages:"                                                >> $DESC_FILE_TMPecho ""                                                                  >> $DESC_FILE_TMPecho "nxclient-$NXCLIENT_VERSION"                                        >> $DESC_FILE_TMPecho "nxcomp-$NXCOMP_VERSION"                                            >> $DESC_FILE_TMPecho "nxssh-$NXSSH_VERSION"                                              >> $DESC_FILE_TMPecho ""                                                                  >> $DESC_FILE_TMPecho "Source code of Client and NX X compression libraries are"      >> $DESC_FILE_TMPecho "released under the GNU General Public License. You can download"        >> $DESC_FILE_TMPecho "them from the 2X web site http://www.2X.com/."      >> $DESC_FILE_TMPecho "  done"echo -n "Creating spec file '$SPEC_FILE': "if test -e $SPEC_FILE_TMP; then        rm -f $SPEC_FILE_TMP;fiif test -e $SPEC_FILE_TMP2; then        rm -f $SPEC_FILE_TMP2;fiif test -e $SPEC_FILE; then        rm -f $SPEC_FILE;fised "/INSTALLDIR/s//`echo $NX_INSTALL_DIR_SHELL`/g" $SPEC_FILE_TEMPLATE  > $SPEC_FILE_TMP1sed "/RPMVERSION/s//$RPM_VERSION_MAJOR/g" $SPEC_FILE_TMP1 > $SPEC_FILE_TMP2sed "/RPMRELEASE/s//$RPM_VERSION_MINOR/g" $SPEC_FILE_TMP2 > $SPEC_FILE_TMP1sed "/DISTRIBUTION/s//$DISTRO/g" $SPEC_FILE_TMP1  > $SPEC_FILEecho "        done"echo ""echo CREATING RPM...echo -n Creating directory:if test -d $NX_INSTALL_DIR; then  echo "                                      $NX_INSTALL_DIR already exists."  echo -n Removing directory $NX_INSTALL_DIR  rm -rf $NX_INSTALL_DIR  if [ $? != 0 ]; then    echo "                              failed"    exit 1  fi  mkdir $NX_INSTALL_DIR  if [ $? != 0 ]; then    echo "                       failed"    exit 1  fi  echo "                                done"else  mkdir $NX_INSTALL_DIR  if [ $? != 0 ]; then    echo "                                      failed"    exit 1  fi  echo "                                      done"fiecho -n Copying files:cp -a NX.client/* $NX_INSTALL_DIR/if [ $? != 0 ]; then  echo "                                           failed"  exit 1fiecho "                                           done"echo -n Copying share directories and files :if test -d $NX_INSTALL_DIR/share/; then  echo "                                          allready exists"else  mkdir -p $NX_INSTALL_DIR/share/  cp -aR nxclient/applnk  nxclient/share/* $NX_INSTALL_DIR/share/  if [ $? != 0 ]; then    echo "                                          failed"    exit 1  fi  echo "                                          done"fiecho -n Copying profiles:if test -e /etc/profile.d/nx.sh; then  mv /etc/profile.d/nx.sh /etc/profile.d/nx.sh.BAK-RPM-TMPfiif test -e /etc/profile.d/nx.csh; then  mv /etc/profile.d/nx.csh /etc/profile.d/nx.csh.BAK-RPM-TMPfiif test -e nxclient/profile.d/nx.sh; then  cp -f nxclient/profile.d/nx.sh /etc/profile.d/nx.shelse  echo "                                        'nxclient/profile.d/nx.sh' not found"  exit 1fiif [ $? != 0 ]; then  echo "                                        failed"  exit 1fiif test -e nxclient/profile.d/nx.csh; then  cp -f nxclient/profile.d/nx.csh /etc/profile.d/nx.cshelse  echo "                                        'nxclient/profile.d/nx.csh' not found"  exit 1fiif [ $? != 0 ]; then  echo "                                        failed"  exit 1fiecho "                                        done"echo -n "Updating spec file with '$DESC_FILE_TMP':"echo "%description" >> $SPEC_FILEcat  $DESC_FILE_TMP >> $SPEC_FILEif [ $? != 0 ]; then  echo "     failed"  exit 1fiecho "     done"echo -n "Updating spec file with '$PRE_FILE':"echo "" >> $SPEC_FILEecho "%pre" >> $SPEC_FILEcat  $PRE_FILE >> $SPEC_FILEif [ $? != 0 ]; then  echo "   failed"  exit 1fiecho "   done"echo -n "Updating spec file with '$POSTIN_FILE':"echo "" >> $SPEC_FILEecho "%post" >> $SPEC_FILEcat  $POSTIN_FILE >> $SPEC_FILEif [ $? != 0 ]; then  echo "   failed"  exit 1fiecho "   done"echo -n "Updating spec file with '$POSTUN_FILE':"echo "%postun" >> $SPEC_FILEcat  $POSTUN_FILE >> $SPEC_FILEif [ $? != 0 ]; then  echo " failed"  exit 1fiecho "    done"echo "Building RPM:"rpmbuild -bb $SPEC_FILEif [ $? != 0 ]; then  echo "FAILED"  exit 1fiecho "DONE"echo ""echo CLEANING...echo -n "Removing files:"rm -f $SPEC_FILE_TMP1rm -f $SPEC_FILE_TMP2rm -rf $NX_INSTALL_DIRecho "                                          done"rm -rf /etc/profile.d/nx.shrm -rf /etc/profile.d/nx.cshif test -e /etc/profile.d/nx.sh.BAK-RPM-TMP; then  echo "Restoring old nx.sh"  mv /etc/profile.d/nx.sh.BAK-RPM-TMP /etc/profile.d/nx.shfiif test -e /etc/profile.d/nx.csh.BAK-RPM-TMP; then  echo "Restoring old nx.csh"  mv /etc/profile.d/nx.csh.BAK-RPM-TMP /etc/profile.d/nx.cshfiecho ""echo CONGRATULATIONS!!!echo ""

⌨️ 快捷键说明

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