diff options
-rw-r--r-- | .SRCINFO | 16 | ||||
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | PKGBUILD | 26 | ||||
-rw-r--r-- | easyconnect-sdu.install | 189 |
4 files changed, 238 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..21d69df19548 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,16 @@ +pkgbase = easyconnect-sdu + pkgdesc = Accessing SDU's network resources over vpn connection. + pkgver = 7.6.3.0.86415 + pkgrel = 1 + url = https://vpn.sdu.edu.cn/com/installClient.html + install = easyconnect-sdu.install + arch = x86_64 + license = custom + conflicts = easyconnect + source = http://download.sangfor.com.cn/download/product/sslvpn/pkg/linux_01/EasyConnect_x64.deb + source = http://ftp.acc.umu.se/pub/GNOME/sources/pango/1.42/pango-1.42.4.tar.xz + md5sums = 6ed6273f7754454f19835a456ee263e3 + md5sums = deb171a31a3ad76342d5195a1b5bbc7c + +pkgname = easyconnect-sdu + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..96f24c4a32a3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +/*.deb +/*.tar.xz +/*.tar.gz +/*.tar.zst +/pkg +/src +/yay diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..a3b8af9e8355 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,26 @@ +# Maintainer: Chen Cui <chentsuei@gmail.com> + +pkgname=easyconnect-sdu +pkgver=7.6.3.0.86415 +pkgrel=1 +pkgdesc="Accessing SDU's network resources over vpn connection." +arch=('x86_64') +url="https://vpn.sdu.edu.cn/com/installClient.html" +license=('custom') +conflicts=('easyconnect') +install=${pkgname}.install +source=("http://download.sangfor.com.cn/download/product/sslvpn/pkg/linux_01/EasyConnect_x64.deb" + "http://ftp.acc.umu.se/pub/GNOME/sources/pango/1.42/pango-1.42.4.tar.xz") +md5sums=('6ed6273f7754454f19835a456ee263e3' + 'deb171a31a3ad76342d5195a1b5bbc7c') +package(){ + tar xzf data.tar.gz -C "${pkgdir}" + tar xf ${srcdir}/pango-1.42.4.tar.xz + cd pango-1.42.4 + ./configure --prefix=/usr + make -j4 && make DESTDIR=${pkgdir}"/usr/share/sangfor/EasyConnect/oldlib/pango" install + cd ${pkgdir} + sed -i 's/Exec=/Exec=env LD_LIBRARY_PATH=\/usr\/share\/sangfor\/EasyConnect\/oldlib\/pango\/usr\/lib /g' "${pkgdir}/usr/share/applications/EasyConnect.desktop" + install -D -m644 "${pkgdir}/usr/share/sangfor/EasyConnect/LICENSES.chromium.html" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" +} + diff --git a/easyconnect-sdu.install b/easyconnect-sdu.install new file mode 100644 index 000000000000..8542ef59c671 --- /dev/null +++ b/easyconnect-sdu.install @@ -0,0 +1,189 @@ +pre_install() { + #打包的时候替换 + PAK_ARCH="amd64" + #错误输出位置 + ERR_OUT=/tmp/EasyConnectSDU.install.error + + #清空之前可能存在的错误日志信息 + if [ -f $ERR_OUT ] + then + echo > $ERR_OUT + fi + uname -a | grep x86_64 > /dev/null + if [ $? -eq 0 ] + then + if [ $PAK_ARCH = "i386" ] + then + echo "deb pkg is 32bit, os is 64bit, can't install..." + echo "deb pkg is 32bit, os is 64bit, can't install..." >>$ERR_OUT + exit -1 + fi + else + if [ $PAK_ARCH = "amd64" ] + then + echo "deb pkg is 64bit, os is 32bit, can't install..." + echo "deb pkg is 64bit, os is 32bit, can't install..." >>$ERR_OUT + exit -1 + fi + fi + +} + +post_install() { + + ####################################################################### + #宏定义 + EasyConnectDir=/usr/share/sangfor/EasyConnect + ResourcesDir=${EasyConnectDir}/resources + + ECAGENT_IMPORT_CA=${ResourcesDir}"/usr/bin/ECAgent --install-import-cert" + ####################################################################### + + ################### + #添加系统服务 + ################### + system_add_service() + { + systemctl enable EasyMonitor + systemctl start EasyMonitor + } + add_service() + { + #导入证书 + ${ECAGENT_IMPORT_CA} > /dev/null 2>&1 + + system_add_service + } + #更改文件权限 + change_authority(){ + + #文件权限处理 + chmod +x ${EasyConnectDir}/EasyConnect + #保证logs文件夹存在 + mkdir -p ${ResourcesDir}/logs + chmod 755 ${ResourcesDir}/logs + ###CSClient创建的域套接字的句柄在这个地方,要加写权限,可以考录换个目录 + chmod 755 ${ResourcesDir}/conf -R + chmod +x ${ResourcesDir}/shell/* + + #更改所有者 + chown root:root ${ResourcesDir}/bin/ECAgent + chown root:root ${ResourcesDir}/bin/svpnservice + chown root:root ${ResourcesDir}/bin/CSClient + #添加s权限 + chmod +s ${ResourcesDir}/bin/ECAgent + chmod +s ${ResourcesDir}/bin/svpnservice + chmod +s ${ResourcesDir}/bin/CSClient + } + #手动启动EasyMonitor,这里处理可能有不妥之处,需要修改 + #${ResourcesDir}/bin/EasyMonitor + + change_authority + add_service + exit 0 +} + +pre_upgrade() { + pre_install +} + +post_upgrade() { + post_install +} + +pre_remove() { + + #EasyMonitor位置 + EASYMONITOR="/usr/share/sangfor/EasyConnect/resources/bin/EasyMonitor" + + + ################### + #删除系统服务 + ################### + system_del_service() + { + systemctl stop EasyMonitor + systemctl disable EasyMonitor + } + + del_service() + { + system_del_service + } + + #杀死可能存在的EC进程 + kill_programe() + { + + #停止所有相关进程 + pidof EasyMonitor + if [ $? -eq 0 ];then + killall EasyMonitor + fi + pidof EasyMonitor + if [ $? -eq 0 ];then + killall -9 EasyMonitor + fi + + pidof ECAgent + if [ $? -eq 0 ];then + killall ECAgent + fi + pidof ECAgent + if [ $? -eq 0 ];then + killall -9 ECAgent + fi + + pidof EasyConnect + if [ $? -eq 0 ];then + killall EasyConnect + fi + pidof EasyConnect + if [ $? -eq 0 ];then + killall -9 EasyConnect + fi + + pidof CSClient + if [ $? -eq 0 ];then + killall CSClient + fi + pidof CSClient + if [ $? -eq 0 ];then + killall -9 CSClient + fi + + pidof svpnservice + if [ $? -eq 0 ];then + killall svpnservice + fi + pidof svpnservice + if [ $? -eq 0 ];then + killall -9 svpnservice + fi + + + } + + #恢复之前修改的所有相关的配置信息 + recover_ec() + { + #调用EasyMonitor + ${EASYMONITOR} -a -r > /dev/null 2>&1 + } + + + #停止服务 + del_service + #杀死相关进程 + kill_programe + #恢复配置 + recover_ec + + echo "rm pkg before..." + exit 0 +} + +post_remove() { + rm -rf /usr/share/sangfor/EasyConnect + exit 0 +} |