Ubuntu 18.04 64位安装校园网客户端(完美解决)

一、准备

下载客户端:中山大学网络与技术服务中心

二、安装

  1. 解压下载的压缩包,右键点击Extract Here。
  2. 修改install.sh
    自带的install.sh复制少了几个动态链接库(libpangox*、libpng*等),而且将/usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2链接为libjpeg.so.62,正确的做法是链接/usr/lib/x86_64-linux-gnu/libjpeg.so.8.1.2,install.sh的代码太长,放在文末
  3. 安装
    如果还是提示缺少某些库请自行百度安装方法.
    sudo -s
    cp iNodeClient_Linux64/iNodeClient /usr/local/ -r
    cd /usr/local/iNodeClient
    ./install.sh
    ./iNodeClient.sh #如果出现iNode窗口说明成功了
    

Ubuntu 18.04 64位安装校园网客户端(完美解决)_第1张图片

三、设置开机启动
install.h中把开机启动的代码写到了/etc/rc.local文件里面,但是Ubuntu 18.04开机已经不再执行这个文件了,甚至在默认情况下/etc目录都没有这个文件!需要更改**/etc/rc.local/lib/systemd/system/rc.local.service**文件,内容如下:
(1)/etc/rc.local:
在第一行加上 #! /bin/bash,没加之前rc.local文件是没法被执行的!!!

#! /bin/bash

/etc/init.d/iNodeAuthService start
exit 0

(2)/lib/systemd/system/rc.local.service:

#  SPDX-License-Identifier: LGPL-2.1+  
#  
#  This file is part of systemd.  
#  
#  systemd is free software; you can redistribute it and/or modify it  
#  under the terms of the GNU Lesser General Public License as published by  
#  the Free Software Foundation; either version 2.1 of the License, or  
#  (at your option) any later version.  

# This unit gets pulled automatically into multi-user.target by  
# systemd-rc-local-generator if /etc/rc.local is executable. 
# 上一行解释了第一步为什么要加上 #! /bin/bash 
[Unit]
Description=/etc/rc.local Compatibility  
Documentation=man:systemd-rc-local-generator(8)  
ConditionFileIsExecutable=/etc/rc.local  
After=network.target  

[Service]
Type=forking  
ExecStart=/etc/rc.local start  
TimeoutSec=0  
RemainAfterExit=yes  
GuessMainPID=no  

[Install]
WantedBy=multi-user.target  
Alias=rc-local.service

(3)添加开机启动服务

cd /lib/systemd/system
systemctl enable rc.local.service

install.sh内容:

#!/bin/sh

CURRENT=`pwd`

#check install path
CHECKRESULT=`echo $CURRENT|grep '[^a-zA-Z0-9/(){}_. -]'`
if [ "$CHECKRESULT" != "" ];then
    echo "Invalid iNode client installation directory name. "
    echo "The directory name can contain only upper-case/lower-case English letters, digits, spaces, and the following characters:(){}/._-."
    exit 0
fi

INODE_CFG="/etc/iNode/inodesys.conf"

#[ -r "$INODE_CFG" ] && . "${INODE_CFG}"
if [ -r "$INODE_CFG" ];then
    LINE=`cat $INODE_CFG`
    INSTALL_DIR=${LINE##*INSTALL_DIR=}
fi

if [ "$INSTALL_DIR" != "" ];then
    echo "iNode has been installed on the path $INSTALL_DIR."
    if [ "$INSTALL_DIR" != "$CURRENT" ]  
    then
        echo -n "This operation will remove iNode. Are you sure to continue?[input Y/y to continue]:"
	    read ISCONTINUE    
	    if [ "$ISCONTINUE" != "Y" -a "$ISCONTINUE" != "y" ]; then                   
	        exit 0        
	    fi
	    cd "$INSTALL_DIR"        
	    ./uninstall.sh
	    cd "$CURRENT"
	    INSTALL_DIR=""
    else  
        exit 0
    fi        
fi

IfExistMon=`ps awx -o command|awk -F/ '{print $NF}'|grep -x iNodeMon`
if [ "$IfExistMon" != "" ]
then
    if [ -n "$INSTALL_DIR" ]
    then
        "$INSTALL_DIR/iNodeMon" -k
    fi
        
    Sec=0
    while [ 1 ]
    do
        IfExistMon=`ps awx -o command|awk -F/ '{print $NF}'|grep -x iNodeMon`
	if [ "$IfExistMon" != "" ]
        then
	    sleep 1
	    Sec=`expr $Sec + 1`

	    if [ "$Sec" -gt 10 ]
	    then
	        killall -9 iNodeMon
	    fi
	else
	    break
	fi
    done
fi

IfExistAuth=`ps awx -o command|awk -F/ '{print $NF}'|grep -x AuthenMngService`
if [ "$IfExistAuth" != "" ]
then
    if [ -n "$INSTALL_DIR" ]
    then
        "$INSTALL_DIR/AuthenMngService" -k
    fi
    
    Sec=0
    while [ 1 ]
    do
        IfExistAuth=`ps awx -o command|awk -F/ '{print $NF}'|grep -x AuthenMngService`
	if [ "$IfExistAuth" != "" ]
        then
	    sleep 1
	    Sec=`expr $Sec + 1`

	    if [ "$Sec" -gt 10 ]
	    then
	        killall -9 AuthenMngService
	    fi
	else
	    break
	fi
    done
fi

IfExistUI=`ps awx -o command|awk -F/ '{print $NF}'|grep -x iNodeClient`
if [ "$IfExistUI" != "" ]
then
    sleep 3
    killall -9 iNodeClient
fi

if [ ! -r "/etc/iNode" ]
then
mkdir /etc/iNode
fi

if [ ! -r "./clientfiles" ]
then
mkdir ./clientfiles
fi

if [ ! -r "./conf" ]
then
mkdir ./conf
fi

if [ ! -r "./log" ]
then
mkdir ./log
fi

INODE_CFG="/etc/iNode/inodesys.conf"

#-r "$INODE_CFG" ] && . "${INODE_CFG}"
if [ -r "$INODE_CFG" ];then
    LINE=`cat $INODE_CFG`
    INSTALL_DIR=${LINE##*INSTALL_DIR=}
fi

if [ -z "$INSTALL_DIR" ]; then
    echo INSTALL_DIR=$CURRENT >> /etc/iNode/inodesys.conf
fi


OS_LINX=`cat /etc/issue | grep 'Linx'`

# 修改一:添加一个函数,作用是把当前目录中的所有动态链接库复制到/usr/lib
copy_all() {
    for i in *
    do 
	if [ -f ${i} ]
    then
	    if [ ! -r "/usr/lib/"${i} ]
	    then 
		cp -fr ${i} /usr/lib
	    fi
    fi
    done
}

if [ "$OS_LINX" != "" ]
then
    cp -fr ./libs/wxWidgets/* /usr/lib64/
    cp -fr ./libs/ace/* /usr/lib64/
    cp -fr ./libs/opswat/* /usr/lib64/
    cp -fr ./libs/libInode* /usr/lib64/
    if [ ! -r "/usr/lib64/libtiff.so.3" ]
    then
        cp -fr ./libs/std/libtiff.so.3 /usr/lib64/libtiff.so.3
    fi
    if [ ! -r "/usr/lib64/libtiff.so.3.9.4" ]
    then
        cp -fr ./libs/std/libtiff.so.3.9.4 /usr/lib64/libtiff.so.3.9.4
    fi
    if [ ! -r "/usr/lib64/libstdc++.so.6" ]
    then
        cp -fr ./libs/std/libstdc++.so.6 /usr/lib64/libstdc++.so.6
    fi
    if [ ! -r "/usr/lib64/libstdc++.so.6.0.13" ]
    then
        cp -fr ./libs/std/libstdc++.so.6.0.13 /usr/lib64/libstdc++.so.6.0.13
    fi
    if [ ! -d "/var/lock/subsys" ]
    then
        mkdir -p /var/lock/subsys
    fi
else
# 修改二: 将libs文件夹下的所有动态链接库复制到/usr/lib而不是/usr/lib64
    cd libs
    copy_all
    for dir in *
    do 
	if [ -d ${dir} ]
	then
	    cd ${dir}
		copy_all
	    cd ..
	fi
    done
    cd ..
fi

sed -i "s:@INSTALL_PATH:$CURRENT:g" ./iNodeClient.desktop
sed -i "s:@INSTALL_PATH:$CURRENT:g" ./iNodeClient.sh

chmod 755 ./AuthenMngService
chmod 755 ./iNodeMon
chmod 755 ./renew.ps
chmod 755 ./enablecards.ps
chmod 755 ./iNodeClient.desktop
chmod 755 ./iNodeClient.sh
chmod 755 ./iNodeClient.sh
chmod 755 ./addRun.sh
chmod 755 ./delRun.sh
chmod 777 ./clientfiles
chmod 777 ./clientfiles/8021
chmod 777 ./clientfiles/5020
chmod -R 777 ./conf

OS_UBUNTU=`cat /etc/issue | grep 'Ubuntu'`
OS_FEDORA=`cat /etc/issue | grep 'Fedora'`
OS_ROCKY=`cat /etc/issue | grep 'Rocky'`

if [ "$OS_FEDORA" != "" ]
then
    export PATH=$PATH:/sbin
fi

if [ "$OS_UBUNTU" != "" ]
then
    iNODE_SERVICE=`cat /etc/rc.local | grep 'iNodeAuthService'`
    if [ "$iNODE_SERVICE" = "" ]
    then
        mv -f ./iNodeAuthService_ubuntu /etc/init.d/iNodeAuthService
        chmod 755 /etc/init.d/iNodeAuthService
        rm -f ./iNodeAuthService
        cp -fr /etc/rc.local /etc/rc.local.bak
        sed -e '/^exit 0$/d' /etc/rc.local > /etc/rc.temp
        echo "/etc/init.d/iNodeAuthService start" >> /etc/rc.temp
        echo "exit 0" >> /etc/rc.temp
        mv -f /etc/rc.temp /etc/rc.local
        chmod 755 /etc/rc.local
    fi
    if [ ! -r "/usr/lib/libtiff.so.3" ] && [ ! -r "/usr/lib/x86_64-linux-gnu/libtiff.so.3" ]
    then
        cp -fr ./libs/std/libtiff.so.3 /usr/lib/libtiff.so.3
        cp -fr ./libs/std/libtiff.so.3 /usr/lib/x86_64-linux-gnu/libtiff.so.3  
    fi
    if [ ! -r "/usr/lib/x86_64-linux-gnu/libjpeg.so.62" ] && [ ! -r "/usr/lib/libjpeg.so.62" ]
    then
    # 修改三: 链接libjpeg.so.8.1.2而不是libjpeg.so.8.0.2
        ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so.8.1.2 /usr/lib/x86_64-linux-gnu/libjpeg.so.62
    fi
    > ./enablecards.ps
    update-rc.d iNodeAuthService defaults 80 01  > /dev/null 2>&1
else
    mv -f ./iNodeAuthService /etc/init.d
    chmod 755 /etc/init.d/iNodeAuthService
    rm -f ./iNodeAuthService_ubuntu
    if [ "$OS_ROCKY" = "" ]
    then
        chkconfig --add iNodeAuthService
        chkconfig --level 2345 iNodeAuthService on
        chkconfig --level 016 iNodeAuthService off
        chkconfig iNodeAuthService on
    else
        ln -s /etc/init.d/iNodeAuthService /etc/rc.d/rc3.d/S080iNodeAuthService > /dev/null 2>&1
        ln -s /etc/init.d/iNodeAuthService /etc/rc.d/rc5.d/S080iNodeAuthService > /dev/null 2>&1
        ln -s /etc/init.d/iNodeAuthService /etc/rc.d/rc0.d/K01iNodeAuthService > /dev/null 2>&1
        ln -s /etc/init.d/iNodeAuthService /etc/rc.d/rc1.d/K01iNodeAuthService > /dev/null 2>&1
        ln -s /etc/init.d/iNodeAuthService /etc/rc.d/rc2.d/K01iNodeAuthService > /dev/null 2>&1
        ln -s /etc/init.d/iNodeAuthService /etc/rc.d/rc4.d/K01iNodeAuthService > /dev/null 2>&1
        ln -s /etc/init.d/iNodeAuthService /etc/rc.d/rc6.d/K01iNodeAuthService > /dev/null 2>&1                
    fi
fi

if [ "$OS_ROCKY" != "" ]
then    
    rm -f /usr/lib/libjpeg.so.62
    cp -fr ./libs/rocky/libjpeg.so.62 /usr/lib/ > /dev/null 2>&1
    cp -fr ./libs/rocky/gdk-pixbuf.loaders /etc/gtk-2.0/    
fi

SELINUX_FLAG=`getenforce 2>/dev/null | grep -x -i enforcing`
if [ "$SELINUX_FLAG" != "" ]
then
chcon -t textrel_shlib_t /usr/lib/libCoreUtils.so
chcon -t textrel_shlib_t /usr/lib/libImplAv.so
chcon -t textrel_shlib_t /usr/lib/libOesisCore.so
fi

if [ "$OS_UBUNTU" != "" ];then
    if [ -d "/var/lib/locales/supported.d/" ];then
	    if [  ! -f "/var/lib/locales/supported.d/zh-inode" ];then
	        echo "zh_CN.GB2312 GB2312" > /var/lib/locales/supported.d/zh-inode
	        locale-gen > /dev/null 2>&1
	    fi
	fi
fi


if [ "$OS_ROCKY" != "" ]
then
pango-querymodules > '/etc/pango/pango.modules'
fi

rm -f ./install.sh
/etc/init.d/iNodeAuthService start

你可能感兴趣的:(Ubuntu)