mirror of
https://github.com/SunBK201/UA3F.git
synced 2025-12-16 16:57:08 +00:00
feat: opkg support
This commit is contained in:
parent
4ef9eb40cf
commit
7c80ef26c7
14
README.md
14
README.md
@ -13,7 +13,7 @@ UA3F 是新一代 HTTP User-Agent 修改方法,对外作为一个 SOCK5 服务
|
||||
opkg update
|
||||
opkg install curl libcurl luci-compat
|
||||
export url='https://blog.sunbk201.site/cdn' && sh -c "$(curl -kfsSl $url/install.sh)"
|
||||
service ua3f.service reload
|
||||
service ua3f reload
|
||||
```
|
||||
|
||||
## 使用
|
||||
@ -35,15 +35,15 @@ UA3F 已支持 LuCI Web 页面,可以打开 Services -> UA3F 进行相关配
|
||||
# 启动 UA3F
|
||||
uci set ua3f.enabled.enabled=1
|
||||
uci commit ua3f
|
||||
service ua3f.service start
|
||||
service ua3f start
|
||||
```
|
||||
|
||||
关闭或重启 UA3F 命令:
|
||||
```sh
|
||||
# 关闭 UA3F
|
||||
service ua3f.service stop
|
||||
service ua3f stop
|
||||
# 重启 UA3F
|
||||
service ua3f.service restart
|
||||
service ua3f restart
|
||||
```
|
||||
|
||||
配置 UA3:
|
||||
@ -64,14 +64,14 @@ reload_config
|
||||
|
||||
### 手动启动
|
||||
```sh
|
||||
sudo -u nobody /root/ua3f
|
||||
sudo -u nobody /usr/bin/ua3f
|
||||
```
|
||||
|
||||
shellclash/shellcrash 用户建议使用以下命令启动:
|
||||
```sh
|
||||
sudo -u shellclash /root/ua3f
|
||||
sudo -u shellclash /usr/bin/ua3f
|
||||
# 如果上面命令报错执行下面该命令
|
||||
sudo -u shellcrash /root/ua3f
|
||||
sudo -u shellcrash /usr/bin/ua3f
|
||||
```
|
||||
|
||||
### Clash 的配置建议
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
ec6674f7b826657c6e76ee4d438d605f ./ua3f-0.3.1-386.tar.gz
|
||||
17d7d471b509b649faffa30212de67e0 ./ua3f-0.3.1-amd64.tar.gz
|
||||
e4bc4bb914ef6a4f48aac85be6e761ca ./ua3f-0.3.1-arm.tar.gz
|
||||
056e2b39ca2f1c3378b75bfa2243e3ba ./ua3f-0.3.1-arm64.tar.gz
|
||||
f23ec84c3f8dfd1e1861ae75508e8a46 ./ua3f-0.3.1-armv7.tar.gz
|
||||
056e2b39ca2f1c3378b75bfa2243e3ba ./ua3f-0.3.1-armv8.tar.gz
|
||||
784ce20b7c1e6127d51598a134106abd ./ua3f-0.3.1-mips64.tar.gz
|
||||
de61b985103b162ee390fb2db1604c6e ./ua3f-0.3.1-mipsle-hardfloat.tar.gz
|
||||
de1fec881e9e489c07817f9c39030f26 ./ua3f-0.3.1-mipsle-softfloat.tar.gz
|
||||
ab1571905d37340c674cf5543c77d625 ./ua3f-0.3.1-mipsle.tar.gz
|
||||
338b1c46b464da264529ebb8917fd6ba ./ua3f-0.3.1-riscv64.tar.gz
|
||||
50f53a8171e9156687a497f57ad09403 ./ua3f-0.4.0-386.tar.gz
|
||||
c951b0c15dfb37c13bb0deda5c0cded8 ./ua3f-0.4.0-amd64.tar.gz
|
||||
347864a42fea23c5d7a3d668f2690d84 ./ua3f-0.4.0-arm.tar.gz
|
||||
6d01dee2902d063a1c8acb671bf5252e ./ua3f-0.4.0-arm64.tar.gz
|
||||
f70a52acbb2afe35543e7a68c2c1cf87 ./ua3f-0.4.0-armv7.tar.gz
|
||||
6d01dee2902d063a1c8acb671bf5252e ./ua3f-0.4.0-armv8.tar.gz
|
||||
ca1e2e4942c33b53ad32c84dbc78646c ./ua3f-0.4.0-mips64.tar.gz
|
||||
d7e3fc1947655431b81ab5c66a1a13aa ./ua3f-0.4.0-mipsle-hardfloat.tar.gz
|
||||
95e10592a6e8b260850a824ac307a860 ./ua3f-0.4.0-mipsle-softfloat.tar.gz
|
||||
17862ff6644b1b5cd2176911e3c4624a ./ua3f-0.4.0-mipsle.tar.gz
|
||||
a99dd267a84fa4dcb85b34433ef6987e ./ua3f-0.4.0-riscv64.tar.gz
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/ua3f-0.4.0-386.tar.gz
Normal file
BIN
bin/ua3f-0.4.0-386.tar.gz
Normal file
Binary file not shown.
BIN
bin/ua3f-0.4.0-amd64.tar.gz
Normal file
BIN
bin/ua3f-0.4.0-amd64.tar.gz
Normal file
Binary file not shown.
BIN
bin/ua3f-0.4.0-arm.tar.gz
Normal file
BIN
bin/ua3f-0.4.0-arm.tar.gz
Normal file
Binary file not shown.
BIN
bin/ua3f-0.4.0-arm64.tar.gz
Normal file
BIN
bin/ua3f-0.4.0-arm64.tar.gz
Normal file
Binary file not shown.
BIN
bin/ua3f-0.4.0-armv7.tar.gz
Normal file
BIN
bin/ua3f-0.4.0-armv7.tar.gz
Normal file
Binary file not shown.
BIN
bin/ua3f-0.4.0-armv8.tar.gz
Normal file
BIN
bin/ua3f-0.4.0-armv8.tar.gz
Normal file
Binary file not shown.
BIN
bin/ua3f-0.4.0-mips64.tar.gz
Normal file
BIN
bin/ua3f-0.4.0-mips64.tar.gz
Normal file
Binary file not shown.
BIN
bin/ua3f-0.4.0-mipsle-hardfloat.tar.gz
Normal file
BIN
bin/ua3f-0.4.0-mipsle-hardfloat.tar.gz
Normal file
Binary file not shown.
BIN
bin/ua3f-0.4.0-mipsle-softfloat.tar.gz
Normal file
BIN
bin/ua3f-0.4.0-mipsle-softfloat.tar.gz
Normal file
Binary file not shown.
BIN
bin/ua3f-0.4.0-mipsle.tar.gz
Normal file
BIN
bin/ua3f-0.4.0-mipsle.tar.gz
Normal file
Binary file not shown.
BIN
bin/ua3f-0.4.0-riscv64.tar.gz
Normal file
BIN
bin/ua3f-0.4.0-riscv64.tar.gz
Normal file
Binary file not shown.
60
build.sh
60
build.sh
@ -1,39 +1,69 @@
|
||||
#!/bin/sh
|
||||
|
||||
project_name="ua3f"
|
||||
release_version="0.3.1"
|
||||
release_version="0.4.0"
|
||||
target=cmd/ua3f.go
|
||||
|
||||
dist=./dist
|
||||
release_dir=./bin
|
||||
|
||||
rm -rf $release_dir/*
|
||||
rm -rf $dist/*
|
||||
mkdir -p $release_dir
|
||||
mkdir -p $dist/bin
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
gofmt -w ./
|
||||
|
||||
for goarch in "amd64" "arm" "arm64" "mipsle" "mips64" "riscv64" "386"; do
|
||||
obj_name=$project_name
|
||||
obj_name=$project_name-$release_version-$goarch
|
||||
|
||||
GOOS=linux GOARCH=$goarch go build -trimpath -ldflags="-s -w" $target
|
||||
tar -zcf $release_dir/$project_name-$release_version-$goarch.tar.gz $obj_name
|
||||
rm -f $obj_name
|
||||
GOOS=linux GOARCH=$goarch go build -trimpath -ldflags="-s -w" -o $obj_name $target
|
||||
cp $obj_name $dist/bin
|
||||
mv $obj_name $project_name
|
||||
tar -zcf $release_dir/$project_name-$release_version-$goarch.tar.gz $project_name
|
||||
rm -f $project_name
|
||||
done
|
||||
|
||||
GOOS=linux GOARCH="mipsle" GOMIPS=softfloat go build -trimpath -ldflags="-s -w" $target
|
||||
tar -zcf $release_dir/$project_name-$release_version-mipsle-softfloat.tar.gz $obj_name
|
||||
rm -f $obj_name
|
||||
GOOS=linux GOARCH="mipsle" GOMIPS=hardfloat go build -trimpath -ldflags="-s -w" $target
|
||||
tar -zcf $release_dir/$project_name-$release_version-mipsle-hardfloat.tar.gz $obj_name
|
||||
rm -f $obj_name
|
||||
# mipsle-softfloat
|
||||
obj_name=$project_name-$release_version-mipsle-softfloat
|
||||
GOOS=linux GOARCH="mipsle" GOMIPS=softfloat go build -trimpath -ldflags="-s -w" -o $obj_name $target
|
||||
cp $obj_name $dist/bin
|
||||
mv $obj_name $project_name
|
||||
tar -zcf $release_dir/$project_name-$release_version-mipsle-softfloat.tar.gz $project_name
|
||||
rm -f $project_name
|
||||
|
||||
GOOS=linux GOARCH="arm" GOARM=7 go build -trimpath -ldflags="-s -w" $target
|
||||
tar -zcf $release_dir/$project_name-$release_version-armv7.tar.gz $obj_name
|
||||
rm -f $obj_name
|
||||
# mipsle-hardfloat
|
||||
obj_name=$project_name-$release_version-mipsle-hardfloat
|
||||
GOOS=linux GOARCH="mipsle" GOMIPS=hardfloat go build -trimpath -ldflags="-s -w" -o $obj_name $target
|
||||
cp $obj_name $dist/bin
|
||||
mv $obj_name $project_name
|
||||
tar -zcf $release_dir/$project_name-$release_version-mipsle-hardfloat.tar.gz $project_name
|
||||
rm -f $project_name
|
||||
|
||||
# armv7
|
||||
obj_name=$project_name-$release_version-armv7
|
||||
GOOS=linux GOARCH="arm" GOARM=7 go build -trimpath -ldflags="-s -w" -o $obj_name $target
|
||||
cp $obj_name $dist/bin
|
||||
mv $obj_name $project_name
|
||||
tar -zcf $release_dir/$project_name-$release_version-armv7.tar.gz $project_name
|
||||
rm -f $project_name
|
||||
|
||||
# armv8
|
||||
cp $release_dir/$project_name-$release_version-arm64.tar.gz $release_dir/$project_name-$release_version-armv8.tar.gz
|
||||
cp $dist/bin/$project_name-$release_version-arm64 $dist/bin/$project_name-$release_version-armv8
|
||||
|
||||
cd $release_dir
|
||||
for file in ./*; do
|
||||
md5 -r $file >>sha1sum.txt
|
||||
done
|
||||
|
||||
cd ..
|
||||
opkg_template=./opkg
|
||||
ipkg_build=ipkg-build.sh
|
||||
for goarch in "amd64" "arm" "arm64" "mipsle" "mips64" "riscv64" "386" "mipsle-softfloat" "mipsle-hardfloat" "armv7" "armv8"; do
|
||||
obj_name=$project_name-$release_version-$goarch
|
||||
mv $dist/bin/$obj_name $opkg_template/usr/bin/ua3f
|
||||
sh $ipkg_build $opkg_template
|
||||
mv $project_name"_"$release_version-1_all.ipk $dist/$project_name"_"$release_version-1_$goarch.ipk
|
||||
done
|
||||
|
||||
@ -17,7 +17,7 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var version = "0.3.1"
|
||||
var version = "0.4.0"
|
||||
var payloadByte []byte
|
||||
var cache *expirable.LRU[string, string]
|
||||
var HTTP_METHOD = []string{"GET", "POST", "HEAD", "PUT", "DELETE", "OPTIONS", "TRACE", "CONNECT"}
|
||||
|
||||
BIN
dist/ua3f_0.4.0-1_386.ipk
vendored
Normal file
BIN
dist/ua3f_0.4.0-1_386.ipk
vendored
Normal file
Binary file not shown.
BIN
dist/ua3f_0.4.0-1_amd64.ipk
vendored
Normal file
BIN
dist/ua3f_0.4.0-1_amd64.ipk
vendored
Normal file
Binary file not shown.
BIN
dist/ua3f_0.4.0-1_arm.ipk
vendored
Normal file
BIN
dist/ua3f_0.4.0-1_arm.ipk
vendored
Normal file
Binary file not shown.
BIN
dist/ua3f_0.4.0-1_arm64.ipk
vendored
Normal file
BIN
dist/ua3f_0.4.0-1_arm64.ipk
vendored
Normal file
Binary file not shown.
BIN
dist/ua3f_0.4.0-1_armv7.ipk
vendored
Normal file
BIN
dist/ua3f_0.4.0-1_armv7.ipk
vendored
Normal file
Binary file not shown.
BIN
dist/ua3f_0.4.0-1_armv8.ipk
vendored
Normal file
BIN
dist/ua3f_0.4.0-1_armv8.ipk
vendored
Normal file
Binary file not shown.
BIN
dist/ua3f_0.4.0-1_mips64.ipk
vendored
Normal file
BIN
dist/ua3f_0.4.0-1_mips64.ipk
vendored
Normal file
Binary file not shown.
BIN
dist/ua3f_0.4.0-1_mipsle-hardfloat.ipk
vendored
Normal file
BIN
dist/ua3f_0.4.0-1_mipsle-hardfloat.ipk
vendored
Normal file
Binary file not shown.
BIN
dist/ua3f_0.4.0-1_mipsle-softfloat.ipk
vendored
Normal file
BIN
dist/ua3f_0.4.0-1_mipsle-softfloat.ipk
vendored
Normal file
Binary file not shown.
BIN
dist/ua3f_0.4.0-1_mipsle.ipk
vendored
Normal file
BIN
dist/ua3f_0.4.0-1_mipsle.ipk
vendored
Normal file
Binary file not shown.
BIN
dist/ua3f_0.4.0-1_riscv64.ipk
vendored
Normal file
BIN
dist/ua3f_0.4.0-1_riscv64.ipk
vendored
Normal file
Binary file not shown.
12
install.sh
12
install.sh
@ -20,7 +20,7 @@ ckcmd() {
|
||||
cd /root
|
||||
getcpucore
|
||||
|
||||
version=0.3.1
|
||||
version=0.4.0
|
||||
ua3f_tar=ua3f-$version-$cpucore.tar.gz
|
||||
|
||||
if id -u shellclash >/dev/null 2>&1; then
|
||||
@ -55,17 +55,21 @@ if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
tar zxf $ua3f_tar && rm -f $ua3f_tar
|
||||
chmod +x ua3f
|
||||
mv ua3f /usr/bin/ua3f
|
||||
chmod +x /usr/bin/ua3f
|
||||
|
||||
if [ -f "/etc/init.d/ua3f.service" ]; then
|
||||
rm "/etc/init.d/ua3f.service"
|
||||
fi
|
||||
if [ -f "/etc/init.d/ua3f" ]; then
|
||||
rm "/etc/init.d/ua3f"
|
||||
fi
|
||||
wget https://blog.sunbk201.site/cdn/ua3f.service
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Download ua3f.service Failed, Please Retry."
|
||||
exit 1
|
||||
fi
|
||||
mv ua3f.service /etc/init.d/ && chmod +x /etc/init.d/ua3f.service
|
||||
mv ua3f.service /etc/init.d/ua3f && chmod +x /etc/init.d/ua3f
|
||||
/etc/init.d/ua3f.service enable
|
||||
|
||||
wget https://blog.sunbk201.site/cdn/ua3f.uci
|
||||
@ -99,4 +103,4 @@ fi
|
||||
|
||||
rm /tmp/luci-modulecache/* >/dev/null 2>&1
|
||||
rm /tmp/luci-indexcache* >/dev/null 2>&1
|
||||
service ua3f.service reload >/dev/null 2>&1
|
||||
service ua3f reload >/dev/null 2>&1
|
||||
|
||||
202
ipkg-build.sh
Executable file
202
ipkg-build.sh
Executable file
@ -0,0 +1,202 @@
|
||||
#!/bin/sh
|
||||
|
||||
# ipkg-build -- construct a .ipk from a directory
|
||||
# Carl Worth <cworth@east.isi.edu>
|
||||
# based on a script by Steve Redler IV, steve@sr-tech.com 5-21-2001
|
||||
# 2003-04-25 rea@sr.unh.edu
|
||||
# Updated to work on Familiar Pre0.7rc1, with busybox tar.
|
||||
# Note it Requires: binutils-ar (since the busybox ar can't create)
|
||||
# For UID debugging it needs a better "find".
|
||||
set -e
|
||||
|
||||
version=1.0
|
||||
FIND="$(command -v find)"
|
||||
FIND="${FIND:-$(command -v gfind)}"
|
||||
TAR="${TAR:-$(command -v gtar)}"
|
||||
|
||||
# try to use fixed source epoch
|
||||
if [ -n "$PKG_SOURCE_DATE_EPOCH" ]; then
|
||||
TIMESTAMP=$(date --date="@$PKG_SOURCE_DATE_EPOCH")
|
||||
elif [ -n "$SOURCE_DATE_EPOCH" ]; then
|
||||
TIMESTAMP=$(date --date="@$SOURCE_DATE_EPOCH")
|
||||
else
|
||||
TIMESTAMP=$(date)
|
||||
fi
|
||||
|
||||
ipkg_extract_value() {
|
||||
sed -e "s/^[^:]*:[[:space:]]*//"
|
||||
}
|
||||
|
||||
required_field() {
|
||||
field=$1
|
||||
|
||||
grep "^$field:" <"$CONTROL/control" | ipkg_extract_value
|
||||
}
|
||||
|
||||
pkg_appears_sane() {
|
||||
local pkg_dir="$1"
|
||||
|
||||
local owd="$PWD"
|
||||
cd "$pkg_dir"
|
||||
|
||||
PKG_ERROR=0
|
||||
pkg="$(required_field Package)"
|
||||
version="$(required_field Version | sed 's/Version://; s/^.://g;')"
|
||||
arch="$(required_field Architecture)"
|
||||
|
||||
if echo "$pkg" | grep '[^a-zA-Z0-9_.+-]'; then
|
||||
echo "*** Error: Package name $name contains illegal characters, (other than [a-z0-9.+-])" >&2
|
||||
PKG_ERROR=1
|
||||
fi
|
||||
|
||||
if [ -f "$CONTROL/conffiles" ]; then
|
||||
rm -f "$CONTROL/conffiles.resolved"
|
||||
|
||||
for cf in $($FIND $(sed -e "s!^/!$pkg_dir/!" "$CONTROL/conffiles") -type f); do
|
||||
echo "${cf#$pkg_dir}" >>"$CONTROL/conffiles.resolved"
|
||||
done
|
||||
|
||||
rm "$CONTROL"/conffiles
|
||||
if [ -f "$CONTROL"/conffiles.resolved ]; then
|
||||
LC_ALL=C sort -o "$CONTROL"/conffiles "$CONTROL"/conffiles.resolved
|
||||
rm "$CONTROL"/conffiles.resolved
|
||||
chmod 0644 "$CONTROL"/conffiles
|
||||
fi
|
||||
fi
|
||||
|
||||
cd "$owd"
|
||||
return $PKG_ERROR
|
||||
}
|
||||
|
||||
resolve_file_mode_id() {
|
||||
local var=$1 type=$2 name=$3 id
|
||||
|
||||
case "$name" in
|
||||
root)
|
||||
id=0
|
||||
;;
|
||||
*[!0-9]*)
|
||||
id=$(sed -ne "s#^$type $name \\([0-9]\\+\\)\\b.*\$#\\1#p" "$TOPDIR/tmp/.packageusergroup" 2>/dev/null)
|
||||
;;
|
||||
*)
|
||||
id=$name
|
||||
;;
|
||||
esac
|
||||
|
||||
export "$var=$id"
|
||||
|
||||
[ -n "$id" ]
|
||||
}
|
||||
|
||||
###
|
||||
# ipkg-build "main"
|
||||
###
|
||||
file_modes=""
|
||||
usage="Usage: $0 [-v] [-h] [-m] <pkg_directory> [<destination_directory>]"
|
||||
while getopts "hvm:" opt; do
|
||||
case $opt in
|
||||
v)
|
||||
echo "$version"
|
||||
exit 0
|
||||
;;
|
||||
h) echo "$usage" >&2 ;;
|
||||
m) file_modes=$OPTARG ;;
|
||||
\?) echo "$usage" >&2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
# continue on to process additional arguments
|
||||
|
||||
case $# in
|
||||
1)
|
||||
dest_dir=$PWD
|
||||
;;
|
||||
2)
|
||||
dest_dir=$2
|
||||
if [ "$dest_dir" = "." ] || [ "$dest_dir" = "./" ]; then
|
||||
dest_dir=$PWD
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "$usage" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
pkg_dir="$(realpath "$1")"
|
||||
|
||||
if [ ! -d "$pkg_dir" ]; then
|
||||
echo "*** Error: Directory $pkg_dir does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# CONTROL is second so that it takes precedence
|
||||
CONTROL=
|
||||
[ -d "$pkg_dir"/CONTROL ] && CONTROL=CONTROL
|
||||
if [ -z "$CONTROL" ]; then
|
||||
echo "*** Error: Directory $pkg_dir has no CONTROL subdirectory." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! pkg_appears_sane "$pkg_dir"; then
|
||||
echo >&2
|
||||
echo "ipkg-build: Please fix the above errors and try again." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tmp_dir=$dest_dir/IPKG_BUILD.$$
|
||||
mkdir "$tmp_dir"
|
||||
|
||||
echo $CONTROL >"$tmp_dir"/tarX
|
||||
cd "$pkg_dir"
|
||||
for file_mode in $file_modes; do
|
||||
case $file_mode in
|
||||
/*:*:*:*) ;;
|
||||
*)
|
||||
echo "ERROR: file modes must use absolute path and contain user:group:mode"
|
||||
echo "$file_mode"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
mode=${file_mode##*:}
|
||||
path=${file_mode%:*}
|
||||
group=${path##*:}
|
||||
path=${path%:*}
|
||||
user=${path##*:}
|
||||
path=${path%:*}
|
||||
|
||||
if ! resolve_file_mode_id uid user "$user"; then
|
||||
echo "ERROR: unable to resolve uid of $user" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! resolve_file_mode_id gid group "$group"; then
|
||||
echo "ERROR: unable to resolve gid of $group" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chown "$uid:$gid" "$pkg_dir/$path"
|
||||
chmod "$mode" "$pkg_dir/$path"
|
||||
done
|
||||
$TAR -X "$tmp_dir"/tarX --format=gnu --numeric-owner --sort=name -cpf - --mtime="$TIMESTAMP" . | gzip -n - >"$tmp_dir"/data.tar.gz
|
||||
|
||||
installed_size=$(zcat <"$tmp_dir"/data.tar.gz | wc -c)
|
||||
sed -i -e "s/^Installed-Size: .*/Installed-Size: $installed_size/" \
|
||||
"$pkg_dir"/$CONTROL/control
|
||||
|
||||
(cd "$pkg_dir"/$CONTROL && $TAR --format=gnu --numeric-owner --sort=name -cf - --mtime="$TIMESTAMP" . | gzip -n - >"$tmp_dir"/control.tar.gz)
|
||||
rm "$tmp_dir"/tarX
|
||||
|
||||
echo "2.0" >"$tmp_dir"/debian-binary
|
||||
|
||||
pkg_file=$dest_dir/${pkg}_${version}_${arch}.ipk
|
||||
rm -f "$pkg_file"
|
||||
(cd "$tmp_dir" && $TAR --format=gnu --numeric-owner --sort=name -cf - --mtime="$TIMESTAMP" ./debian-binary ./data.tar.gz ./control.tar.gz | gzip -n - >"$pkg_file")
|
||||
|
||||
rm "$tmp_dir"/debian-binary "$tmp_dir"/data.tar.gz "$tmp_dir"/control.tar.gz
|
||||
rmdir "$tmp_dir"
|
||||
|
||||
echo "Packaged contents of $pkg_dir into $pkg_file"
|
||||
@ -3,7 +3,7 @@ local uci = require("luci.model.uci").cursor()
|
||||
ua3f = Map("ua3f",
|
||||
"UA3F",
|
||||
[[
|
||||
<a href="https://github.com/SunBK201/UA3F" target="_blank">Version: 0.3.1</a>
|
||||
<a href="https://github.com/SunBK201/UA3F" target="_blank">Version: 0.4.0</a>
|
||||
<br>
|
||||
Across the Campus we can reach every corner in the world.
|
||||
]]
|
||||
@ -51,7 +51,7 @@ log.rows = 30
|
||||
|
||||
local apply = luci.http.formvalue("cbi.apply")
|
||||
if apply then
|
||||
io.popen("/etc/init.d/ua3f.service restart")
|
||||
io.popen("/etc/init.d/ua3f restart")
|
||||
end
|
||||
|
||||
return ua3f
|
||||
|
||||
11
opkg/CONTROL/control
Normal file
11
opkg/CONTROL/control
Normal file
@ -0,0 +1,11 @@
|
||||
Package: ua3f
|
||||
Version: 0.4.0-1
|
||||
Depends: libc, luci-compat
|
||||
Source: /feed/openwrt
|
||||
SourceName: UA3F
|
||||
License: GPL-3.0-only
|
||||
Section: net
|
||||
SourceDateEpoch: 1711267200
|
||||
Architecture: all
|
||||
Installed-Size: 2181120
|
||||
Description: Implementation of the new generation of HTTP User-Agent modification methodology.
|
||||
11
opkg/CONTROL/control-e
Normal file
11
opkg/CONTROL/control-e
Normal file
@ -0,0 +1,11 @@
|
||||
Package: ua3f
|
||||
Version: 0.4.0-1
|
||||
Depends: libc, luci-compat
|
||||
Source: /feed/openwrt
|
||||
SourceName: UA3F
|
||||
License: GPL-3.0-only
|
||||
Section: net
|
||||
SourceDateEpoch: 1711267200
|
||||
Architecture: all
|
||||
Installed-Size: 2181120
|
||||
Description: Implementation of the new generation of HTTP User-Agent modification methodology.
|
||||
5
opkg/CONTROL/postinst
Executable file
5
opkg/CONTROL/postinst
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
[ "${IPKG_NO_SCRIPT}" = "1" ] && exit 0
|
||||
[ -s ${IPKG_INSTROOT}/lib/functions.sh ] || exit 0
|
||||
. ${IPKG_INSTROOT}/lib/functions.sh
|
||||
default_postinst $0 $@
|
||||
4
opkg/CONTROL/prerm
Executable file
4
opkg/CONTROL/prerm
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
[ -s ${IPKG_INSTROOT}/lib/functions.sh ] || exit 0
|
||||
. ${IPKG_INSTROOT}/lib/functions.sh
|
||||
default_prerm $0 $@
|
||||
8
opkg/etc/config/ua3f
Normal file
8
opkg/etc/config/ua3f
Normal file
@ -0,0 +1,8 @@
|
||||
config 'ua3f' 'enabled'
|
||||
option enabled '0'
|
||||
|
||||
config 'ua3f' 'main'
|
||||
option port '1080'
|
||||
option bind '127.0.0.1'
|
||||
option ua 'FFF'
|
||||
option log_level 'info'
|
||||
59
opkg/etc/init.d/ua3f
Executable file
59
opkg/etc/init.d/ua3f
Executable file
@ -0,0 +1,59 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
START=99
|
||||
|
||||
NAME="ua3f"
|
||||
PROG="/usr/bin/$NAME"
|
||||
|
||||
start_service() {
|
||||
config_load "$NAME"
|
||||
|
||||
local enabled
|
||||
config_get_bool enabled "enabled" "enabled" "0"
|
||||
if [ "$enabled" -ne "1" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
local port
|
||||
local bind
|
||||
local ua
|
||||
local log_level
|
||||
config_get port "main" "port" "1080"
|
||||
config_get bind "main" "bind" "127.0.0.1"
|
||||
config_get ua "main" "ua" "FFF"
|
||||
config_get log_level "main" "log_level" "info"
|
||||
|
||||
chmod o+w /var/log
|
||||
|
||||
procd_open_instance "$NAME"
|
||||
procd_set_param command "$PROG"
|
||||
procd_append_param command -b "$bind"
|
||||
procd_append_param command -p $port
|
||||
procd_append_param command -f "$ua"
|
||||
procd_append_param command -l $log_level
|
||||
|
||||
procd_set_param respawn
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
|
||||
if id -u shellclash >/dev/null 2>&1; then
|
||||
procd_set_param user shellclash
|
||||
elif id -u shellcrash >/dev/null 2>&1; then
|
||||
procd_set_param user shellcrash
|
||||
elif id -u nobody >/dev/null 2>&1; then
|
||||
procd_set_param user nobody
|
||||
fi
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "$NAME"
|
||||
}
|
||||
BIN
opkg/usr/bin/ua3f
Executable file
BIN
opkg/usr/bin/ua3f
Executable file
Binary file not shown.
5
opkg/usr/lib/lua/luci/controller/ua3f.lua
Executable file
5
opkg/usr/lib/lua/luci/controller/ua3f.lua
Executable file
@ -0,0 +1,5 @@
|
||||
module("luci.controller.ua3f", package.seeall)
|
||||
|
||||
function index()
|
||||
entry({ "admin", "services", "ua3f" }, cbi("ua3f"), "UA3F", 1)
|
||||
end
|
||||
57
opkg/usr/lib/lua/luci/model/cbi/ua3f.lua
Executable file
57
opkg/usr/lib/lua/luci/model/cbi/ua3f.lua
Executable file
@ -0,0 +1,57 @@
|
||||
local uci = require("luci.model.uci").cursor()
|
||||
|
||||
ua3f = Map("ua3f",
|
||||
"UA3F",
|
||||
[[
|
||||
<a href="https://github.com/SunBK201/UA3F" target="_blank">Version: 0.4.0</a>
|
||||
<br>
|
||||
Across the Campus we can reach every corner in the world.
|
||||
]]
|
||||
)
|
||||
|
||||
enable = ua3f:section(NamedSection, "enabled", "ua3f", "Status")
|
||||
main = ua3f:section(NamedSection, "main", "ua3f", "Settings")
|
||||
|
||||
enable:option(Flag, "enabled", "Enabled")
|
||||
status = enable:option(DummyValue, "status", "Status")
|
||||
status.rawhtml = true
|
||||
status.cfgvalue = function(self, section)
|
||||
local pid = luci.sys.exec("pidof ua3f")
|
||||
if pid == "" then
|
||||
return "<span style='color:red'>" .. "Stopped" .. "</span>"
|
||||
else
|
||||
return "<span style='color:green'>" .. "Running" .. "</span>"
|
||||
end
|
||||
end
|
||||
|
||||
main:tab("general", "General Settings")
|
||||
main:tab("log", "Log")
|
||||
|
||||
port = main:taboption("general", Value, "port", "Port")
|
||||
port.placeholder = "1080"
|
||||
bind = main:taboption("general", Value, "bind", "Bind Address")
|
||||
bind:value("127.0.0.1")
|
||||
bind:value("0.0.0.0")
|
||||
ua = main:taboption("general", Value, "ua", "User-Agent")
|
||||
ua.placeholder = "FFF"
|
||||
log_level = main:taboption("general", ListValue, "log_level", "Log Level")
|
||||
log_level:value("debug")
|
||||
log_level:value("info")
|
||||
log_level:value("warn")
|
||||
log_level:value("error")
|
||||
log_level:value("fatal")
|
||||
log_level:value("panic")
|
||||
|
||||
log = main:taboption("log", TextValue, "")
|
||||
log.readonly = true
|
||||
log.cfgvalue = function(self, section)
|
||||
return luci.sys.exec("cat /var/log/ua3f.log")
|
||||
end
|
||||
log.rows = 30
|
||||
|
||||
local apply = luci.http.formvalue("cbi.apply")
|
||||
if apply then
|
||||
io.popen("/etc/init.d/ua3f restart")
|
||||
end
|
||||
|
||||
return ua3f
|
||||
@ -5,7 +5,7 @@ USE_PROCD=1
|
||||
START=99
|
||||
|
||||
NAME="ua3f"
|
||||
PROG="/root/$NAME"
|
||||
PROG="/usr/bin/$NAME"
|
||||
|
||||
start_service() {
|
||||
config_load "$NAME"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user