📄 make.sh
字号:
#!/bin/sh#set -xecho ""echo COLECTING DATA...VERSION_FILE="nxclient/VERSION"BASELINE_FILE="nxclient/BASELINE"DESC_FILE_TMP="nxclient/deb/deb_desc.tmp"PREINST_FILE="nxclient/scripts/preinst.sh"POSTRM_FILE="nxclient/scripts/postrm.sh"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#fiecho -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 DEB_VERSION=$NXCLIENT_VERSION echo "DEB version not provided. Default: $NXCLIENT_VERSION"else DEB_VERSION=$1 echo "DEB version provided: $DEB_VERSION"fiDEB_VERSION_MAJOR=`echo $DEB_VERSION | awk -F '-' '{print $1}'`if [ $DEB_VERSION_MAJOR ]; then echo "DEB version, major part: $DEB_VERSION_MAJOR"else echo "DEB version, major part: unknown" exit 1fiDEB_VERSION_MINOR=`echo $DEB_VERSION | awk -F '-' '{print $2}'`if [ $DEB_VERSION_MINOR ]; then echo "DEB version, release part: $DEB_VERSION_MINOR"else echo "DEB 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 "Description: @PRODUCT_NAME@ Client and Libraries." >> $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 @PRODUCT_NAME@" >> $DESC_FILE_TMPecho " 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 ""echo CREATING DEB...echo -n Creating directory:if test -d debpkg; then echo " 'debpkg' already exists." echo -n Removing 'debpkg': rm -rf debpkg if [ $? != 0 ]; then echo " failed" exit 1 fi mkdir debpkg mkdir -p debpkg$NX_INSTALL_DIR mkdir -p debpkg/DEBIAN if [ $? != 0 ]; then echo " failed" exit 1 fi echo " done"else mkdir debpkg mkdir -p debpkg$NX_INSTALL_DIR mkdir -p debpkg/DEBIAN if [ $? != 0 ]; then echo " failed" exit 1 fi echo " done"fiecho -n Copying files:cp -a NX/* debpkg$NX_INSTALL_DIR/if [ $? != 0 ]; then echo " failed" exit 1fiecho " done"echo -n Copying applnk:if test -d debpkg$NX_INSTALL_DIR/share/applnk; then echo " allready exists"else cp -a nxclient/applnk debpkg$NX_INSTALL_DIR/share/ if [ $? != 0 ]; then echo " failed" exit 1 fi echo " done"fi#echo -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-TMP#fi#if test -e /etc/profile.d/nx.csh; then# mv /etc/profile.d/nx.csh /etc/profile.d/nx.csh.BAK-RPM-TMP#fi#if test -e nxclient/profile.d/nx.sh; then# cp -f nxclient/profile.d/nx.sh /etc/profile.d/nx.sh#else# echo " 'nxclient/profile.d/nx.sh' not found"# exit 1#fi#if [ $? != 0 ]; then# echo " failed"# exit 1#fi#if test -e nxclient/profile.d/nx.csh; then# cp -f nxclient/profile.d/nx.csh /etc/profile.d/nx.csh#else# echo " 'nxclient/profile.d/nx.csh' not found"# exit 1#fi#if [ $? != 0 ]; then# echo " failed"# exit 1#fi#echo " done"echo -n "Creating control file 'debpkg/DEBIAN/control':"touch debpkg/DEBIAN/controlif [ $? != 0 ]; then echo " failed" exit 1fiecho "Package: 2xterminalserverclient" > debpkg/DEBIAN/controlecho "Section: base" >> debpkg/DEBIAN/controlecho "Priority: optional" >> debpkg/DEBIAN/controlecho "Architecture: i386" >> debpkg/DEBIAN/controlecho "Version: $DEB_VERSION_MAJOR-$DEB_VERSION_MINOR" >> debpkg/DEBIAN/controlecho "Depends: " >> debpkg/DEBIAN/controlecho "Maintainer: <info@2x.com>" >> debpkg/DEBIAN/controlcat $DESC_FILE_TMP >> debpkg/DEBIAN/controlif [ $? != 0 ]; then echo " failed" exit 1fiecho " done"echo -n "Copying 'preinst' and 'postrm' files:"cp $POSTRM_FILE debpkg/DEBIAN/postrmif [ $? != 0 ]; then echo " failed" exit 1ficp $PREINST_FILE debpkg/DEBIAN/preinstif [ $? != 0 ]; then echo " failed" exit 1fiecho " done"echo "Building DEB:"dpkg-deb --build debpkg "2xterminalserverclient-$DEB_VERSION_MAJOR-$DEB_VERSION_MINOR.i386.deb"if [ $? != 0 ]; then echo "FAILED" exit 1fiecho "DONE"echo ""echo CLEANING...echo -n "Removing files:"rm -rf debpkgecho " done"#rm -rf /etc/profile.d/nx.sh#rm -rf /etc/profile.d/nx.csh#if 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.sh#fi#if 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.csh#fiecho ""echo CONGRATULATIONS!!!echo ""
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -