支持一键打包spk
29
source/gofrpc/INFO.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
source /pkgscripts-ng/include/pkg_util.sh
|
||||
|
||||
package="gofrpc"
|
||||
version="1.0.1"
|
||||
displayname="gofrpc"
|
||||
dsmuidir="ui"
|
||||
dsmappname="SYNO.SDS.gofrpc"
|
||||
distributor="jie800@163.com"
|
||||
maintainer="秋三十爷"
|
||||
maintainer_url="http://blog.5941188.com"
|
||||
helpurl="https://github.com/fatedier/frp"
|
||||
arch="noarch"
|
||||
#arch="$(pkg_get_unified_platform)"
|
||||
firmware="6.0-5914"
|
||||
os_min_ver="6.0-5914"
|
||||
support_conf_folder="yes"
|
||||
description="内网穿透神器--frpc,个人整合为spk包,自适应arm,arm64,x86,x64四个平台,支持网页配置,及提供了一些配置模板,供大家食用。当前frpc版本:0.30.0"
|
||||
#silent_install="yes"
|
||||
silent_upgrade="yes"
|
||||
silent_uninstall="yes"
|
||||
thirdparty="yes"
|
||||
adminprotocol="http"
|
||||
adminurl="static/#"
|
||||
adminport="8760"
|
||||
[ "$(caller)" != "0 NULL" ] && return 0
|
||||
pkg_dump_info
|
BIN
source/gofrpc/PACKAGE_ICON.PNG
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
source/gofrpc/PACKAGE_ICON_256.PNG
Normal file
After Width: | Height: | Size: 96 KiB |
3
source/gofrpc/SynoBuildConf/build
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "skip owapp make"
|
60
source/gofrpc/SynoBuildConf/install
Normal file
@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
# Copyright (C) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
### Use PKG_DIR as working directory.
|
||||
pkgname="gofrpc"
|
||||
PKG_DIR="/tmp/_${pkgname}_spk"
|
||||
rm -rf $PKG_DIR
|
||||
mkdir -p $PKG_DIR
|
||||
|
||||
### get spk packing functions
|
||||
source /pkgscripts-ng/include/pkg_util.sh
|
||||
|
||||
create_inner_tarball() {
|
||||
local inner_tarball_dir=/tmp/_inner_tarball
|
||||
|
||||
### clear destination directory
|
||||
rm -rf $inner_tarball_dir && mkdir -p $inner_tarball_dir
|
||||
|
||||
### install needed file into PKG_DIR
|
||||
#make install DESTDIR="$inner_tarball_dir"
|
||||
echo "==> create_inner_tarball.curpath: $(pwd)"
|
||||
#cp -rf ${pkgname} ${inner_tarball_dir} || { echo "cp -rf ${pkgname} ${inner_tarball_dir} failed"; exit 1; }
|
||||
cp -rf ./bin ${inner_tarball_dir}/
|
||||
cp -rf ./ui ${inner_tarball_dir}/
|
||||
cp -rf ./start.sh ${inner_tarball_dir}/
|
||||
cp -rf ./stop.sh ${inner_tarball_dir}/
|
||||
cp -rf ./config ${inner_tarball_dir}/ui/
|
||||
|
||||
### create package.txz: $1=source_dir, $2=dest_dir
|
||||
pkg_make_inner_tarball $inner_tarball_dir "${PKG_DIR}" || echo "pkg_make_inner_tarball $inner_tarball_dir ${PKG_DIR}"
|
||||
}
|
||||
|
||||
create_spk(){
|
||||
local scripts_dir=$PKG_DIR/scripts
|
||||
local conf_dir=$PKG_DIR/conf
|
||||
|
||||
### Copy Package Center scripts to PKG_DIR
|
||||
mkdir -p $scripts_dir || echo "mkdir -p \$scripts_dir failed"
|
||||
mkdir -p $conf_dir || echo "mkdir -p \$conf_dir failed"
|
||||
cp -av scripts/* $scripts_dir || echo "cp -av scripts/* \$scripts_dir failed"
|
||||
cp -av conf/* $conf_dir || echo "cp -av conf/* \$conf_dir failed"
|
||||
|
||||
### Copy package icon
|
||||
echo "==> create_spk.curpath: $(pwd)"
|
||||
cp -av PACKAGE_ICON*.PNG $PKG_DIR || echo " cp -av PACKAGE_ICON*.PNG \$PKG_DIR failed"
|
||||
|
||||
### Generate INFO file
|
||||
./INFO.sh > INFO || echo "export info failed."
|
||||
cp INFO $PKG_DIR/INFO || echo "cp INFO \$PKG_DIR/INFO failed"
|
||||
|
||||
### Create the final spk.
|
||||
# pkg_make_spk <source path> <dest path> <spk file name>
|
||||
# Please put the result spk into /image/packages
|
||||
# spk name functions: pkg_get_spk_name pkg_get_spk_unified_name pkg_get_spk_family_name
|
||||
mkdir -p /image/packages || echo "mkdir -p /image/packages failed."
|
||||
pkg_make_spk ${PKG_DIR} "/image/packages" $(pkg_get_spk_family_name) || echo "pkg_make_spk \${PKG_DIR} failed"
|
||||
}
|
||||
|
||||
create_inner_tarball
|
||||
create_spk
|
BIN
source/gofrpc/bin/arch/frpc_arm
Executable file
BIN
source/gofrpc/bin/arch/frpc_arm64
Executable file
BIN
source/gofrpc/bin/arch/frpc_x64
Executable file
BIN
source/gofrpc/bin/arch/frpc_x86
Executable file
24
source/gofrpc/bin/frpc.ini
Normal file
@ -0,0 +1,24 @@
|
||||
[common]
|
||||
admin_addr = 0.0.0.0
|
||||
admin_port = 8760
|
||||
server_addr = 47.111.117.185
|
||||
server_port = 2680
|
||||
token = 64590757cf05
|
||||
|
||||
#[template_ssh]
|
||||
#type = tcp
|
||||
#local_ip = 127.0.0.1
|
||||
#local_port = 22
|
||||
#remote_port = 50341
|
||||
#
|
||||
#[template_web]
|
||||
#type = http
|
||||
#local_ip = 127.0.0.1
|
||||
#local_port = 5000
|
||||
#custom_domains = template.nas.config
|
||||
#
|
||||
#[template_frpc_web]
|
||||
#type = http
|
||||
#local_ip = 127.0.0.1
|
||||
#local_port = 8760
|
||||
#custom_domains = template.self.web.config
|
47
source/gofrpc/bin/frpc_monitor
Normal file
@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPTPATH="${0%/*}"
|
||||
cd "${SCRIPTPATH}/.."
|
||||
APPPATH="$(pwd)"
|
||||
APPNAME="frpc"
|
||||
ARCHBINPATH="${APPPATH}/bin/arch"
|
||||
BINPATH="${APPPATH}/bin/${APPNAME}"
|
||||
|
||||
_arch_select() {
|
||||
${BINPATH} -v && return 0
|
||||
ls -1 ${ARCHBINPATH}/ | while read archbin
|
||||
do
|
||||
${ARCHBINPATH}/${archbin} -v && {
|
||||
ln -sf ${ARCHBINPATH}/${archbin} ${BINPATH}
|
||||
break
|
||||
}
|
||||
done
|
||||
[ -f ${BINPATHA} ] || return 2
|
||||
}
|
||||
|
||||
_start() {
|
||||
CONFPATH="${APPPATH}/bin/frpc.ini"
|
||||
"${BINPATH}" -c "${CONFPATH}" >/dev/null &
|
||||
}
|
||||
|
||||
_stop() {
|
||||
kill -9 "$(pidof ${APPNAME})"
|
||||
kill -11 "$(pidof ${APPNAME})"
|
||||
}
|
||||
|
||||
_monitor() {
|
||||
pidof "${APPNAME}" 2>/dev/null
|
||||
if [ $? -ne 0 ] ; then
|
||||
_stop
|
||||
_start
|
||||
fi
|
||||
}
|
||||
|
||||
## main start
|
||||
inter=5
|
||||
_arch_select || exit 2
|
||||
while [ 1 -eq 1 ]
|
||||
do
|
||||
_monitor
|
||||
sleep "${inter}"
|
||||
done
|
0
source/gofrpc/conf/PKG_DEPS
Normal file
11
source/gofrpc/conf/privilege
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"defaults":{
|
||||
"run-as": "package"
|
||||
},
|
||||
"username": "ufrpc",
|
||||
"ctrl-script": [{
|
||||
"action": "stop",
|
||||
"run-as": "package"
|
||||
}]
|
||||
}
|
||||
|
2
source/gofrpc/conf/resource
Normal file
@ -0,0 +1,2 @@
|
||||
{}
|
||||
|
14
source/gofrpc/config
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
".url": {
|
||||
"SYNO.SDS.gofrpc": {
|
||||
"type": "url",
|
||||
"allUsers": true,
|
||||
"title": "frpc-群晖内网穿透",
|
||||
"desc": "内网穿透神器,开源frpc,个人整合为spk包,供大家使用。",
|
||||
"icon": "images/icon_{0}.png",
|
||||
"protocol": "http",
|
||||
"url": "/static/#",
|
||||
"port": "8760"
|
||||
}
|
||||
}
|
||||
}
|
7
source/gofrpc/scripts/postinst
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script is run after the package files are transferred to @appstore.
|
||||
# You can change the file permission and ownership in this script.
|
||||
|
||||
|
||||
exit 0
|
6
source/gofrpc/scripts/postuninst
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script is run after the package is removed from the system
|
||||
|
||||
|
||||
exit 0
|
7
source/gofrpc/scripts/postupgrade
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Package Center will call this script after installing the new version of your package.
|
||||
|
||||
|
||||
exit 0
|
||||
|
7
source/gofrpc/scripts/preinst
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script is run before the package files are transferred to @appstore.
|
||||
# You can check if the installation requirements meet the DSM or package version, or if some services are enabled in this script.
|
||||
|
||||
|
||||
exit 0
|
5
source/gofrpc/scripts/preuninst
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script is run before the package is removed.
|
||||
|
||||
exit 0
|
6
source/gofrpc/scripts/preupgrade
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Package Center will call this script before uninstalling the old version of your package
|
||||
|
||||
exit 0
|
||||
|
30
source/gofrpc/scripts/start-stop-status
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script is used to start and stop a package, detect running status, and generate the log file.
|
||||
# Parameters used by the script are listed in below: start, stop, status
|
||||
|
||||
PRIVATE_LOCATION="/var/packages/${SYNOPKG_PKGNAME}/target"
|
||||
START_FILE="./start.sh"
|
||||
STOP_FILE="./stop.sh"
|
||||
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
cd ${PRIVATE_LOCATION}
|
||||
/bin/sh ${START_FILE}
|
||||
;;
|
||||
stop)
|
||||
cd ${PRIVATE_LOCATION}
|
||||
(/bin/sh ${STOP_FILE} &)
|
||||
;;
|
||||
status)
|
||||
cd ${PRIVATE_LOCATION}
|
||||
ret=$(ps -ef | grep frpc | grep -v 'grep')
|
||||
if [ -n "${ret}" ]; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
18
source/gofrpc/start.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPTPATH="${0%/*}"
|
||||
cd ${SCRIPTPATH}
|
||||
APPPATH="$(pwd)"
|
||||
APPNAME="frpc_" # char:_ should be set
|
||||
MONINAME="frpc_monitor"
|
||||
|
||||
_start() {
|
||||
owpid="$(ps -ef | grep ${APPNAME} | grep -v 'grep' | awk '{print $2}')"
|
||||
if [ -z "${owpid}" ]; then
|
||||
MONIPATH="${APPPATH}/bin/${MONINAME}"
|
||||
/bin/sh ${MONIPATH} > /dev/null 2>&1 &
|
||||
fi
|
||||
}
|
||||
|
||||
_start
|
||||
exit 0
|
14
source/gofrpc/stop.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPTPATH="${0%/*}"
|
||||
cd ${SCRIPTPATH}
|
||||
APPPATH="$(pwd)"
|
||||
APPNAME="frpc"
|
||||
|
||||
_stop() {
|
||||
ps -ef | grep ${APPNAME}| grep -v 'stop' | grep -v 'grep' | awk '{print $2}' | xargs kill -9
|
||||
}
|
||||
|
||||
_stop
|
||||
_stop
|
||||
exit 0
|
BIN
source/gofrpc/ui/images/icon_128.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
source/gofrpc/ui/images/icon_16.png
Normal file
After Width: | Height: | Size: 834 B |
BIN
source/gofrpc/ui/images/icon_24.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
source/gofrpc/ui/images/icon_256.png
Normal file
After Width: | Height: | Size: 96 KiB |
BIN
source/gofrpc/ui/images/icon_32.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
source/gofrpc/ui/images/icon_48.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
source/gofrpc/ui/images/icon_64.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
source/gofrpc/ui/images/icon_72.png
Normal file
After Width: | Height: | Size: 8.9 KiB |