mirror of
https://github.com/teddysun/across.git
synced 2025-01-19 14:29:37 +08:00
Compare commits
1 Commits
1a096ea467
...
14867e7a78
Author | SHA1 | Date | |
---|---|---|---|
|
14867e7a78 |
@ -1,99 +0,0 @@
|
|||||||
ARCH=$(shell uname -m)
|
|
||||||
VERSION?=1.8.11
|
|
||||||
GO_VERSION:=1.22.2
|
|
||||||
SHELL:=/bin/bash
|
|
||||||
GO_BASE_IMAGE=golang
|
|
||||||
GO_IMAGE?=$(GO_BASE_IMAGE):$(GO_VERSION)-bookworm
|
|
||||||
EPOCH?=
|
|
||||||
REPO?=https://github.com/teddysun/xray-plugin.git
|
|
||||||
REF?=v1.8.11
|
|
||||||
CHOWN:=docker run --rm -v $(CURDIR):/v -w /v alpine chown
|
|
||||||
|
|
||||||
ifdef BUILD_IMAGE
|
|
||||||
BUILD_IMAGE_FLAG=--build-arg $(BUILD_IMAGE)
|
|
||||||
endif
|
|
||||||
|
|
||||||
COMMON_FILES=common
|
|
||||||
BUILD?=DOCKER_BUILDKIT=1 \
|
|
||||||
docker build \
|
|
||||||
$(BUILD_IMAGE_FLAG) \
|
|
||||||
--build-arg GO_IMAGE=$(GO_IMAGE) \
|
|
||||||
--build-arg COMMON_FILES=$(COMMON_FILES) \
|
|
||||||
-t debbuild-$@/$(ARCH) \
|
|
||||||
-f $@/Dockerfile \
|
|
||||||
.
|
|
||||||
|
|
||||||
# Additional flags may be necessary at some point
|
|
||||||
RUN_FLAGS=
|
|
||||||
RUN?=docker run --rm -h buildbot \
|
|
||||||
-e PLATFORM \
|
|
||||||
-e EPOCH='$(EPOCH)' \
|
|
||||||
-e DEB_VERSION=$(VERSION) \
|
|
||||||
-e VERSION=$(VERSION) \
|
|
||||||
-v $(CURDIR)/debbuild/$@:/build \
|
|
||||||
$(RUN_FLAGS) \
|
|
||||||
debbuild-$@/$(ARCH)
|
|
||||||
|
|
||||||
DEBIAN_VERSIONS ?= debian-buster debian-bullseye debian-bookworm
|
|
||||||
UBUNTU_VERSIONS ?= ubuntu-focal ubuntu-jammy ubuntu-noble
|
|
||||||
DISTROS := $(DEBIAN_VERSIONS) $(UBUNTU_VERSIONS)
|
|
||||||
|
|
||||||
# Taken from: https://www.cmcrossroads.com/article/printing-value-makefile-variable
|
|
||||||
print-% : ; @echo $($*)
|
|
||||||
|
|
||||||
.PHONY: help
|
|
||||||
help: ## show make targets
|
|
||||||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
|
||||||
|
|
||||||
.PHONY: checkout-src
|
|
||||||
checkout-src: src/github.com/teddysun/xray-plugin
|
|
||||||
./checkout.sh src/github.com/teddysun/xray-plugin "$(REF)"
|
|
||||||
|
|
||||||
src/github.com/teddysun/xray-plugin:
|
|
||||||
git init $@
|
|
||||||
git -C $@ remote add origin "$(REPO)"
|
|
||||||
|
|
||||||
.PHONY: checkout
|
|
||||||
checkout: checkout-src ## checkout source at the given reference(s)
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean: ## remove build artifacts
|
|
||||||
[ ! -d debbuild ] || $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild
|
|
||||||
$(RM) -r debbuild
|
|
||||||
[ ! -d sources ] || $(CHOWN) -R $(shell id -u):$(shell id -g) sources
|
|
||||||
$(RM) -r sources
|
|
||||||
-docker builder prune -f --filter until=24h
|
|
||||||
|
|
||||||
.PHONY: deb
|
|
||||||
deb: ubuntu debian ## build all deb packages
|
|
||||||
|
|
||||||
.PHONY: ubuntu
|
|
||||||
ubuntu: $(UBUNTU_VERSIONS) ## build all ubuntu deb packages
|
|
||||||
|
|
||||||
.PHONY: debian
|
|
||||||
debian: $(DEBIAN_VERSIONS) ## build all debian deb packages
|
|
||||||
|
|
||||||
.PHONY: $(DISTROS)
|
|
||||||
$(DISTROS): sources
|
|
||||||
@echo "== Building packages for $@ =="
|
|
||||||
mkdir -p "debbuild/$@"
|
|
||||||
$(BUILD)
|
|
||||||
$(RUN)
|
|
||||||
$(CHOWN) -R $(shell id -u):$(shell id -g) "debbuild/$@"
|
|
||||||
|
|
||||||
.PHONY: sources
|
|
||||||
sources: sources/xray-plugin.tgz
|
|
||||||
|
|
||||||
sources/xray-plugin.tgz:
|
|
||||||
mkdir -p $(@D)
|
|
||||||
docker run --rm -w /v \
|
|
||||||
-v $(realpath $(CURDIR)/src/github.com/teddysun/xray-plugin):/xray-plugin \
|
|
||||||
-v $(CURDIR)/$(@D):/v \
|
|
||||||
alpine \
|
|
||||||
tar -C / -c -z -f /v/xray-plugin.tgz --exclude .git xray-plugin
|
|
||||||
|
|
||||||
# See ARCHES in common.mk. Could not figure out how to match both distro and arch.
|
|
||||||
BUNDLES:=$(addsuffix .tar.gz,$(addprefix debbuild/bundles-%-,$(ARCHES)))
|
|
||||||
|
|
||||||
$(BUNDLES): %
|
|
||||||
tar czf $@ --transform="s|^debbuild/\(.*\)|bundles/$(VERSION)/build-deb/\1|" debbuild/$*
|
|
@ -1,74 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -x
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# untar sources
|
|
||||||
mkdir -p /root/build-deb/xray-plugin
|
|
||||||
tar -C /root/build-deb -xzf /sources/xray-plugin.tgz
|
|
||||||
|
|
||||||
# link them to their canonical path
|
|
||||||
mkdir -p /go/src/github.com/teddysun
|
|
||||||
ln -snf /root/build-deb/xray-plugin /go/src/github.com/teddysun/xray-plugin
|
|
||||||
|
|
||||||
EPOCH="${EPOCH:-}"
|
|
||||||
EPOCH_SEP=""
|
|
||||||
if [[ -n "$EPOCH" ]]; then
|
|
||||||
EPOCH_SEP=":"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "${DEB_VERSION}" ]]; then
|
|
||||||
echo "DEB_VERSION is required to build deb packages"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo VERSION AAA ${VERSION}
|
|
||||||
|
|
||||||
VERSION=${VERSION:-$(cat VERSION)}
|
|
||||||
|
|
||||||
debSource="$(awk -F ': ' '$1 == "Source" { print $2; exit }' debian/control)"
|
|
||||||
debMaintainer="$(awk -F ': ' '$1 == "Maintainer" { print $2; exit }' debian/control)"
|
|
||||||
debDate="$(date --rfc-2822)"
|
|
||||||
|
|
||||||
# Include an extra `1` in the version, in case we ever would have to re-build an
|
|
||||||
# already published release with a packaging-only change.
|
|
||||||
pkgRevision=1
|
|
||||||
|
|
||||||
# Generate changelog. The version/name of the generated packages are based on this.
|
|
||||||
#
|
|
||||||
# Resulting packages are formatted as;
|
|
||||||
#
|
|
||||||
# - name of the package (e.g., "docker-ce")
|
|
||||||
# - version (e.g., "23.0.0~beta.0")
|
|
||||||
# - pkgRevision (usually "-0", see above), which allows updating packages with
|
|
||||||
# packaging-only changes (without a corresponding release of the software
|
|
||||||
# that's packaged).
|
|
||||||
# - distro (e.g., "ubuntu")
|
|
||||||
# - VERSION_ID (e.g. "22.04" or "11") this must be "sortable" to make sure that
|
|
||||||
# packages are upgraded when upgrading to a newer distro version ("codename"
|
|
||||||
# cannot be used for this, as they're not sorted)
|
|
||||||
# - SUITE ("codename"), e.g. "jammy" or "bullseye". This is mostly for convenience,
|
|
||||||
# because some places refer to distro versions by codename, others by version.
|
|
||||||
# we prefix the codename with a tilde (~), which effectively excludes it from
|
|
||||||
# version comparison.
|
|
||||||
#
|
|
||||||
# Note that while the `${EPOCH}${EPOCH_SEP}` is part of the version, it is not
|
|
||||||
# included in the package's *filename*. (And if you're wondering: we needed the
|
|
||||||
# EPOCH because of our use of CalVer, which made version comparing not work in
|
|
||||||
# some cases).
|
|
||||||
#
|
|
||||||
# Examples:
|
|
||||||
#
|
|
||||||
# docker-ce_23.0.0~beta.0-1~debian.11~bullseye_amd64.deb
|
|
||||||
# docker-ce_23.0.0~beta.0-1~ubuntu.22.04~jammy_amd64.deb
|
|
||||||
cat > "debian/changelog" <<-EOF
|
|
||||||
$debSource (${EPOCH}${EPOCH_SEP}${DEB_VERSION}-${pkgRevision}~${DISTRO}.${VERSION_ID}~${SUITE}) $SUITE; urgency=low
|
|
||||||
* Version: ${VERSION}
|
|
||||||
-- $debMaintainer $debDate
|
|
||||||
EOF
|
|
||||||
# The space above at the start of the line for the debMaintainer is very important
|
|
||||||
|
|
||||||
echo VERSION BBB ${VERSION}
|
|
||||||
dpkg-buildpackage -uc -us -I.git
|
|
||||||
destination="/build"
|
|
||||||
mkdir -p "$destination"
|
|
||||||
mv -v /root/xray-plugin* "$destination"
|
|
@ -1,39 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
# Copyright 2018-2020 Docker Inc.
|
|
||||||
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
checkout() (
|
|
||||||
set -ex
|
|
||||||
SRC="$1"
|
|
||||||
REF="$2"
|
|
||||||
REF_FETCH="$REF"
|
|
||||||
# if ref is branch or tag, retrieve its canonical form
|
|
||||||
REF=$(git -C "$SRC" ls-remote --refs --heads --tags origin "$REF" | awk '{print $2}')
|
|
||||||
if [ -n "$REF" ]; then
|
|
||||||
# if branch or tag then create it locally too
|
|
||||||
REF_FETCH="$REF:$REF"
|
|
||||||
else
|
|
||||||
REF="FETCH_HEAD"
|
|
||||||
fi
|
|
||||||
git -C "$SRC" fetch --update-head-ok --depth 1 origin "$REF_FETCH"
|
|
||||||
git -C "$SRC" checkout -q "$REF"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# Only execute checkout function above if this file is executed, not sourced from another script
|
|
||||||
prog=checkout.sh # needs to be in sync with this file's name
|
|
||||||
if [ "$(basename -- $0)" = "$prog" ]; then
|
|
||||||
checkout $*
|
|
||||||
fi
|
|
@ -1,29 +0,0 @@
|
|||||||
Source: xray-plugin
|
|
||||||
Section: devel
|
|
||||||
Priority: optional
|
|
||||||
Maintainer: Teddysun <i@teddysun.com>
|
|
||||||
Build-Depends: bash,
|
|
||||||
cmake,
|
|
||||||
dh-apparmor,
|
|
||||||
debhelper-compat (= 12),
|
|
||||||
gcc,
|
|
||||||
git,
|
|
||||||
libc-dev,
|
|
||||||
libltdl-dev,
|
|
||||||
libseccomp-dev,
|
|
||||||
libseccomp2,
|
|
||||||
libsystemd-dev,
|
|
||||||
libtool,
|
|
||||||
make,
|
|
||||||
pkg-config
|
|
||||||
Standards-Version: 3.9.6
|
|
||||||
Homepage: https://github.com/teddysun/xray-plugin
|
|
||||||
Vcs-Browser: https://github.com/teddysun/xray-plugin
|
|
||||||
Vcs-Git: git://github.com/teddysun/xray-plugin.git
|
|
||||||
|
|
||||||
Package: xray-plugin
|
|
||||||
Architecture: linux-any
|
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
|
||||||
Description: Xray plugin for shadowsocks
|
|
||||||
Yet another SIP003 plugin for shadowsocks, based on xray-core.
|
|
||||||
It should be used with shadowsocks.
|
|
@ -1 +0,0 @@
|
|||||||
xray-plugin/README.md
|
|
@ -1,28 +0,0 @@
|
|||||||
#!/usr/bin/make -f
|
|
||||||
|
|
||||||
VERSION?=$(shell cat VERSION)
|
|
||||||
|
|
||||||
# force packages to be built with xz compression, as Ubuntu 21.10 and up use
|
|
||||||
# zstd compression, which is non-standard, and breaks 'dpkg-sig --verify'
|
|
||||||
override_dh_builddeb:
|
|
||||||
dh_builddeb -- -Zxz
|
|
||||||
|
|
||||||
override_dh_auto_build:
|
|
||||||
cd xray-plugin \
|
|
||||||
&& GO111MODULE=on \
|
|
||||||
env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.VERSION=v$(VERSION) -s -w -buildid=" -o "xray-plugin"
|
|
||||||
|
|
||||||
# http://manpages.debian.org/dh_dwz
|
|
||||||
override_dh_dwz:
|
|
||||||
# dh_dwz in debhelper versions less than 13 has issues with files that are missing debug symbols (once we update to debhelper-compat 13+ this can be removed)
|
|
||||||
@# https://packages.debian.org/debhelper
|
|
||||||
@# https://packages.ubuntu.com/debhelper
|
|
||||||
|
|
||||||
override_dh_auto_install:
|
|
||||||
install -D -m 0755 xray-plugin/xray-plugin debian/xray-plugin/usr/bin/xray-plugin
|
|
||||||
|
|
||||||
override_dh_shlibdeps:
|
|
||||||
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
|
|
||||||
|
|
||||||
%:
|
|
||||||
dh $@
|
|
@ -1 +0,0 @@
|
|||||||
1.0
|
|
@ -1,40 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
ARG GO_IMAGE
|
|
||||||
ARG DISTRO=debian
|
|
||||||
ARG SUITE=bookworm
|
|
||||||
ARG VERSION_ID=12
|
|
||||||
ARG BUILD_IMAGE=${DISTRO}:${SUITE}
|
|
||||||
|
|
||||||
FROM ${GO_IMAGE} AS golang
|
|
||||||
|
|
||||||
FROM ${BUILD_IMAGE}
|
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
RUN apt-get update && apt-get install -y curl devscripts equivs git
|
|
||||||
|
|
||||||
ENV GOPROXY=https://proxy.golang.org|direct
|
|
||||||
ENV GO111MODULE=off
|
|
||||||
ENV GOPATH /go
|
|
||||||
ENV GOTOOLCHAIN=local
|
|
||||||
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
|
|
||||||
|
|
||||||
ARG COMMON_FILES
|
|
||||||
COPY --link ${COMMON_FILES} /root/build-deb/debian
|
|
||||||
RUN apt-get update \
|
|
||||||
&& mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control
|
|
||||||
|
|
||||||
COPY --link sources/ /sources
|
|
||||||
ARG DISTRO
|
|
||||||
ARG SUITE
|
|
||||||
ARG VERSION_ID
|
|
||||||
ENV DISTRO=${DISTRO}
|
|
||||||
ENV SUITE=${SUITE}
|
|
||||||
ENV VERSION_ID=${VERSION_ID}
|
|
||||||
|
|
||||||
COPY --link --from=golang /usr/local/go /usr/local/go
|
|
||||||
|
|
||||||
WORKDIR /root/build-deb
|
|
||||||
COPY build-deb /root/build-deb/build-deb
|
|
||||||
|
|
||||||
ENTRYPOINT ["/root/build-deb/build-deb"]
|
|
@ -1,40 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
ARG GO_IMAGE
|
|
||||||
ARG DISTRO=debian
|
|
||||||
ARG SUITE=bullseye
|
|
||||||
ARG VERSION_ID=11
|
|
||||||
ARG BUILD_IMAGE=${DISTRO}:${SUITE}
|
|
||||||
|
|
||||||
FROM ${GO_IMAGE} AS golang
|
|
||||||
|
|
||||||
FROM ${BUILD_IMAGE}
|
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
RUN apt-get update && apt-get install -y curl devscripts equivs git
|
|
||||||
|
|
||||||
ENV GOPROXY=https://proxy.golang.org|direct
|
|
||||||
ENV GO111MODULE=off
|
|
||||||
ENV GOPATH /go
|
|
||||||
ENV GOTOOLCHAIN=local
|
|
||||||
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
|
|
||||||
|
|
||||||
ARG COMMON_FILES
|
|
||||||
COPY --link ${COMMON_FILES} /root/build-deb/debian
|
|
||||||
RUN apt-get update \
|
|
||||||
&& mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control
|
|
||||||
|
|
||||||
COPY --link sources/ /sources
|
|
||||||
ARG DISTRO
|
|
||||||
ARG SUITE
|
|
||||||
ARG VERSION_ID
|
|
||||||
ENV DISTRO=${DISTRO}
|
|
||||||
ENV SUITE=${SUITE}
|
|
||||||
ENV VERSION_ID=${VERSION_ID}
|
|
||||||
|
|
||||||
COPY --link --from=golang /usr/local/go /usr/local/go
|
|
||||||
|
|
||||||
WORKDIR /root/build-deb
|
|
||||||
COPY build-deb /root/build-deb/build-deb
|
|
||||||
|
|
||||||
ENTRYPOINT ["/root/build-deb/build-deb"]
|
|
@ -1,40 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
ARG GO_IMAGE
|
|
||||||
ARG DISTRO=debian
|
|
||||||
ARG SUITE=buster
|
|
||||||
ARG VERSION_ID=10
|
|
||||||
ARG BUILD_IMAGE=${DISTRO}:${SUITE}
|
|
||||||
|
|
||||||
FROM ${GO_IMAGE} AS golang
|
|
||||||
|
|
||||||
FROM ${BUILD_IMAGE}
|
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
RUN apt-get update && apt-get install -y curl devscripts equivs git
|
|
||||||
|
|
||||||
ENV GOPROXY=https://proxy.golang.org|direct
|
|
||||||
ENV GO111MODULE=off
|
|
||||||
ENV GOPATH /go
|
|
||||||
ENV GOTOOLCHAIN=local
|
|
||||||
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
|
|
||||||
|
|
||||||
ARG COMMON_FILES
|
|
||||||
COPY --link ${COMMON_FILES} /root/build-deb/debian
|
|
||||||
RUN apt-get update \
|
|
||||||
&& mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control
|
|
||||||
|
|
||||||
COPY --link sources/ /sources
|
|
||||||
ARG DISTRO
|
|
||||||
ARG SUITE
|
|
||||||
ARG VERSION_ID
|
|
||||||
ENV DISTRO=${DISTRO}
|
|
||||||
ENV SUITE=${SUITE}
|
|
||||||
ENV VERSION_ID=${VERSION_ID}
|
|
||||||
|
|
||||||
COPY --link --from=golang /usr/local/go /usr/local/go
|
|
||||||
|
|
||||||
WORKDIR /root/build-deb
|
|
||||||
COPY build-deb /root/build-deb/build-deb
|
|
||||||
|
|
||||||
ENTRYPOINT ["/root/build-deb/build-deb"]
|
|
@ -1,46 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
ARG GO_IMAGE
|
|
||||||
ARG DISTRO=ubuntu
|
|
||||||
ARG SUITE=focal
|
|
||||||
ARG VERSION_ID=20.04
|
|
||||||
ARG BUILD_IMAGE=${DISTRO}:${SUITE}
|
|
||||||
|
|
||||||
FROM ${GO_IMAGE} AS golang
|
|
||||||
|
|
||||||
FROM ${BUILD_IMAGE}
|
|
||||||
|
|
||||||
# Remove diverted man binary to prevent man-pages being replaced with "minimized" message. See docker/for-linux#639
|
|
||||||
RUN if [ "$(dpkg-divert --truename /usr/bin/man)" = "/usr/bin/man.REAL" ]; then \
|
|
||||||
rm -f /usr/bin/man; \
|
|
||||||
dpkg-divert --quiet --remove --rename /usr/bin/man; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
RUN apt-get update && apt-get install -y curl devscripts equivs git
|
|
||||||
|
|
||||||
ENV GOPROXY=https://proxy.golang.org|direct
|
|
||||||
ENV GO111MODULE=off
|
|
||||||
ENV GOPATH /go
|
|
||||||
ENV GOTOOLCHAIN=local
|
|
||||||
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
|
|
||||||
|
|
||||||
ARG COMMON_FILES
|
|
||||||
COPY --link ${COMMON_FILES} /root/build-deb/debian
|
|
||||||
RUN apt-get update \
|
|
||||||
&& mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control
|
|
||||||
|
|
||||||
COPY --link sources/ /sources
|
|
||||||
ARG DISTRO
|
|
||||||
ARG SUITE
|
|
||||||
ARG VERSION_ID
|
|
||||||
ENV DISTRO=${DISTRO}
|
|
||||||
ENV SUITE=${SUITE}
|
|
||||||
ENV VERSION_ID=${VERSION_ID}
|
|
||||||
|
|
||||||
COPY --link --from=golang /usr/local/go /usr/local/go
|
|
||||||
|
|
||||||
WORKDIR /root/build-deb
|
|
||||||
COPY build-deb /root/build-deb/build-deb
|
|
||||||
|
|
||||||
ENTRYPOINT ["/root/build-deb/build-deb"]
|
|
@ -1,46 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
ARG GO_IMAGE
|
|
||||||
ARG DISTRO=ubuntu
|
|
||||||
ARG SUITE=jammy
|
|
||||||
ARG VERSION_ID=22.04
|
|
||||||
ARG BUILD_IMAGE=${DISTRO}:${SUITE}
|
|
||||||
|
|
||||||
FROM ${GO_IMAGE} AS golang
|
|
||||||
|
|
||||||
FROM ${BUILD_IMAGE}
|
|
||||||
|
|
||||||
# Remove diverted man binary to prevent man-pages being replaced with "minimized" message. See docker/for-linux#639
|
|
||||||
RUN if [ "$(dpkg-divert --truename /usr/bin/man)" = "/usr/bin/man.REAL" ]; then \
|
|
||||||
rm -f /usr/bin/man; \
|
|
||||||
dpkg-divert --quiet --remove --rename /usr/bin/man; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
RUN apt-get update && apt-get install -y curl devscripts equivs git
|
|
||||||
|
|
||||||
ENV GOPROXY=https://proxy.golang.org|direct
|
|
||||||
ENV GO111MODULE=off
|
|
||||||
ENV GOPATH /go
|
|
||||||
ENV GOTOOLCHAIN=local
|
|
||||||
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
|
|
||||||
|
|
||||||
ARG COMMON_FILES
|
|
||||||
COPY --link ${COMMON_FILES} /root/build-deb/debian
|
|
||||||
RUN apt-get update \
|
|
||||||
&& mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control
|
|
||||||
|
|
||||||
COPY --link sources/ /sources
|
|
||||||
ARG DISTRO
|
|
||||||
ARG SUITE
|
|
||||||
ARG VERSION_ID
|
|
||||||
ENV DISTRO=${DISTRO}
|
|
||||||
ENV SUITE=${SUITE}
|
|
||||||
ENV VERSION_ID=${VERSION_ID}
|
|
||||||
|
|
||||||
COPY --link --from=golang /usr/local/go /usr/local/go
|
|
||||||
|
|
||||||
WORKDIR /root/build-deb
|
|
||||||
COPY build-deb /root/build-deb/build-deb
|
|
||||||
|
|
||||||
ENTRYPOINT ["/root/build-deb/build-deb"]
|
|
@ -1,46 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
ARG GO_IMAGE
|
|
||||||
ARG DISTRO=ubuntu
|
|
||||||
ARG SUITE=noble
|
|
||||||
ARG VERSION_ID=24.04
|
|
||||||
ARG BUILD_IMAGE=${DISTRO}:${SUITE}
|
|
||||||
|
|
||||||
FROM ${GO_IMAGE} AS golang
|
|
||||||
|
|
||||||
FROM ${BUILD_IMAGE}
|
|
||||||
|
|
||||||
# Remove diverted man binary to prevent man-pages being replaced with "minimized" message. See docker/for-linux#639
|
|
||||||
RUN if [ "$(dpkg-divert --truename /usr/bin/man)" = "/usr/bin/man.REAL" ]; then \
|
|
||||||
rm -f /usr/bin/man; \
|
|
||||||
dpkg-divert --quiet --remove --rename /usr/bin/man; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
RUN apt-get update && apt-get install -y curl devscripts equivs git
|
|
||||||
|
|
||||||
ENV GOPROXY=https://proxy.golang.org|direct
|
|
||||||
ENV GO111MODULE=off
|
|
||||||
ENV GOPATH /go
|
|
||||||
ENV GOTOOLCHAIN=local
|
|
||||||
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
|
|
||||||
|
|
||||||
ARG COMMON_FILES
|
|
||||||
COPY --link ${COMMON_FILES} /root/build-deb/debian
|
|
||||||
RUN apt-get update \
|
|
||||||
&& mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control
|
|
||||||
|
|
||||||
COPY --link sources/ /sources
|
|
||||||
ARG DISTRO
|
|
||||||
ARG SUITE
|
|
||||||
ARG VERSION_ID
|
|
||||||
ENV DISTRO=${DISTRO}
|
|
||||||
ENV SUITE=${SUITE}
|
|
||||||
ENV VERSION_ID=${VERSION_ID}
|
|
||||||
|
|
||||||
COPY --link --from=golang /usr/local/go /usr/local/go
|
|
||||||
|
|
||||||
WORKDIR /root/build-deb
|
|
||||||
COPY build-deb /root/build-deb/build-deb
|
|
||||||
|
|
||||||
ENTRYPOINT ["/root/build-deb/build-deb"]
|
|
@ -1,101 +0,0 @@
|
|||||||
ARCH=$(shell uname -m)
|
|
||||||
VERSION?=1.8.11
|
|
||||||
GO_VERSION:=1.22.2
|
|
||||||
SHELL:=/bin/bash
|
|
||||||
GO_BASE_IMAGE=golang
|
|
||||||
GO_IMAGE?=$(GO_BASE_IMAGE):$(GO_VERSION)-bookworm
|
|
||||||
EPOCH?=
|
|
||||||
REPO?=https://github.com/xtls/xray-core.git
|
|
||||||
REF?=v1.8.11
|
|
||||||
CHOWN:=docker run --rm -v $(CURDIR):/v -w /v alpine chown
|
|
||||||
|
|
||||||
ifdef BUILD_IMAGE
|
|
||||||
BUILD_IMAGE_FLAG=--build-arg $(BUILD_IMAGE)
|
|
||||||
endif
|
|
||||||
|
|
||||||
COMMON_FILES=common
|
|
||||||
BUILD?=DOCKER_BUILDKIT=1 \
|
|
||||||
docker build \
|
|
||||||
$(BUILD_IMAGE_FLAG) \
|
|
||||||
--build-arg GO_IMAGE=$(GO_IMAGE) \
|
|
||||||
--build-arg COMMON_FILES=$(COMMON_FILES) \
|
|
||||||
-t debbuild-$@/$(ARCH) \
|
|
||||||
-f $@/Dockerfile \
|
|
||||||
.
|
|
||||||
|
|
||||||
# Additional flags may be necessary at some point
|
|
||||||
RUN_FLAGS=
|
|
||||||
RUN?=docker run --rm -h buildbot \
|
|
||||||
-e PLATFORM \
|
|
||||||
-e EPOCH='$(EPOCH)' \
|
|
||||||
-e DEB_VERSION=$(VERSION) \
|
|
||||||
-e VERSION=$(VERSION) \
|
|
||||||
-v $(CURDIR)/debbuild/$@:/build \
|
|
||||||
$(RUN_FLAGS) \
|
|
||||||
debbuild-$@/$(ARCH)
|
|
||||||
|
|
||||||
DEBIAN_VERSIONS ?= debian-buster debian-bullseye debian-bookworm
|
|
||||||
UBUNTU_VERSIONS ?= ubuntu-focal ubuntu-jammy ubuntu-noble
|
|
||||||
DISTROS := $(DEBIAN_VERSIONS) $(UBUNTU_VERSIONS)
|
|
||||||
|
|
||||||
# Taken from: https://www.cmcrossroads.com/article/printing-value-makefile-variable
|
|
||||||
print-% : ; @echo $($*)
|
|
||||||
|
|
||||||
.PHONY: help
|
|
||||||
help: ## show make targets
|
|
||||||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
|
||||||
|
|
||||||
.PHONY: checkout-src
|
|
||||||
checkout-src: src/github.com/xtls/xray
|
|
||||||
./checkout.sh src/github.com/xtls/xray "$(REF)"
|
|
||||||
@curl -sSLo src/github.com/xtls/xray/geoip.dat https://github.com/v2fly/geoip/releases/latest/download/geoip.dat
|
|
||||||
@curl -sSLo src/github.com/xtls/xray/geosite.dat https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat
|
|
||||||
|
|
||||||
src/github.com/xtls/xray:
|
|
||||||
git init $@
|
|
||||||
git -C $@ remote add origin "$(REPO)"
|
|
||||||
|
|
||||||
.PHONY: checkout
|
|
||||||
checkout: checkout-src ## checkout source at the given reference(s)
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean: ## remove build artifacts
|
|
||||||
[ ! -d debbuild ] || $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild
|
|
||||||
$(RM) -r debbuild
|
|
||||||
[ ! -d sources ] || $(CHOWN) -R $(shell id -u):$(shell id -g) sources
|
|
||||||
$(RM) -r sources
|
|
||||||
-docker builder prune -f --filter until=24h
|
|
||||||
|
|
||||||
.PHONY: deb
|
|
||||||
deb: ubuntu debian ## build all deb packages
|
|
||||||
|
|
||||||
.PHONY: ubuntu
|
|
||||||
ubuntu: $(UBUNTU_VERSIONS) ## build all ubuntu deb packages
|
|
||||||
|
|
||||||
.PHONY: debian
|
|
||||||
debian: $(DEBIAN_VERSIONS) ## build all debian deb packages
|
|
||||||
|
|
||||||
.PHONY: $(DISTROS)
|
|
||||||
$(DISTROS): sources
|
|
||||||
@echo "== Building packages for $@ =="
|
|
||||||
mkdir -p "debbuild/$@"
|
|
||||||
$(BUILD)
|
|
||||||
$(RUN)
|
|
||||||
$(CHOWN) -R $(shell id -u):$(shell id -g) "debbuild/$@"
|
|
||||||
|
|
||||||
.PHONY: sources
|
|
||||||
sources: sources/xray.tgz
|
|
||||||
|
|
||||||
sources/xray.tgz:
|
|
||||||
mkdir -p $(@D)
|
|
||||||
docker run --rm -w /v \
|
|
||||||
-v $(realpath $(CURDIR)/src/github.com/xtls/xray):/xray \
|
|
||||||
-v $(CURDIR)/$(@D):/v \
|
|
||||||
alpine \
|
|
||||||
tar -C / -c -z -f /v/xray.tgz --exclude .git xray
|
|
||||||
|
|
||||||
# See ARCHES in common.mk. Could not figure out how to match both distro and arch.
|
|
||||||
BUNDLES:=$(addsuffix .tar.gz,$(addprefix debbuild/bundles-%-,$(ARCHES)))
|
|
||||||
|
|
||||||
$(BUNDLES): %
|
|
||||||
tar czf $@ --transform="s|^debbuild/\(.*\)|bundles/$(VERSION)/build-deb/\1|" debbuild/$*
|
|
@ -1,74 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -x
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# untar sources
|
|
||||||
mkdir -p /root/build-deb/xray
|
|
||||||
tar -C /root/build-deb -xzf /sources/xray.tgz
|
|
||||||
|
|
||||||
# link them to their canonical path
|
|
||||||
mkdir -p /go/src/github.com/xtls
|
|
||||||
ln -snf /root/build-deb/xray /go/src/github.com/xtls/xray-core
|
|
||||||
|
|
||||||
EPOCH="${EPOCH:-}"
|
|
||||||
EPOCH_SEP=""
|
|
||||||
if [[ -n "$EPOCH" ]]; then
|
|
||||||
EPOCH_SEP=":"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "${DEB_VERSION}" ]]; then
|
|
||||||
echo "DEB_VERSION is required to build deb packages"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo VERSION AAA ${VERSION}
|
|
||||||
|
|
||||||
VERSION=${VERSION:-$(cat VERSION)}
|
|
||||||
|
|
||||||
debSource="$(awk -F ': ' '$1 == "Source" { print $2; exit }' debian/control)"
|
|
||||||
debMaintainer="$(awk -F ': ' '$1 == "Maintainer" { print $2; exit }' debian/control)"
|
|
||||||
debDate="$(date --rfc-2822)"
|
|
||||||
|
|
||||||
# Include an extra `1` in the version, in case we ever would have to re-build an
|
|
||||||
# already published release with a packaging-only change.
|
|
||||||
pkgRevision=1
|
|
||||||
|
|
||||||
# Generate changelog. The version/name of the generated packages are based on this.
|
|
||||||
#
|
|
||||||
# Resulting packages are formatted as;
|
|
||||||
#
|
|
||||||
# - name of the package (e.g., "docker-ce")
|
|
||||||
# - version (e.g., "23.0.0~beta.0")
|
|
||||||
# - pkgRevision (usually "-0", see above), which allows updating packages with
|
|
||||||
# packaging-only changes (without a corresponding release of the software
|
|
||||||
# that's packaged).
|
|
||||||
# - distro (e.g., "ubuntu")
|
|
||||||
# - VERSION_ID (e.g. "22.04" or "11") this must be "sortable" to make sure that
|
|
||||||
# packages are upgraded when upgrading to a newer distro version ("codename"
|
|
||||||
# cannot be used for this, as they're not sorted)
|
|
||||||
# - SUITE ("codename"), e.g. "jammy" or "bullseye". This is mostly for convenience,
|
|
||||||
# because some places refer to distro versions by codename, others by version.
|
|
||||||
# we prefix the codename with a tilde (~), which effectively excludes it from
|
|
||||||
# version comparison.
|
|
||||||
#
|
|
||||||
# Note that while the `${EPOCH}${EPOCH_SEP}` is part of the version, it is not
|
|
||||||
# included in the package's *filename*. (And if you're wondering: we needed the
|
|
||||||
# EPOCH because of our use of CalVer, which made version comparing not work in
|
|
||||||
# some cases).
|
|
||||||
#
|
|
||||||
# Examples:
|
|
||||||
#
|
|
||||||
# docker-ce_23.0.0~beta.0-1~debian.11~bullseye_amd64.deb
|
|
||||||
# docker-ce_23.0.0~beta.0-1~ubuntu.22.04~jammy_amd64.deb
|
|
||||||
cat > "debian/changelog" <<-EOF
|
|
||||||
$debSource (${EPOCH}${EPOCH_SEP}${DEB_VERSION}-${pkgRevision}~${DISTRO}.${VERSION_ID}~${SUITE}) $SUITE; urgency=low
|
|
||||||
* Version: ${VERSION}
|
|
||||||
-- $debMaintainer $debDate
|
|
||||||
EOF
|
|
||||||
# The space above at the start of the line for the debMaintainer is very important
|
|
||||||
|
|
||||||
echo VERSION BBB ${VERSION}
|
|
||||||
dpkg-buildpackage -uc -us -I.git
|
|
||||||
destination="/build"
|
|
||||||
mkdir -p "$destination"
|
|
||||||
mv -v /root/xray* "$destination"
|
|
@ -1,39 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
# Copyright 2018-2020 Docker Inc.
|
|
||||||
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
checkout() (
|
|
||||||
set -ex
|
|
||||||
SRC="$1"
|
|
||||||
REF="$2"
|
|
||||||
REF_FETCH="$REF"
|
|
||||||
# if ref is branch or tag, retrieve its canonical form
|
|
||||||
REF=$(git -C "$SRC" ls-remote --refs --heads --tags origin "$REF" | awk '{print $2}')
|
|
||||||
if [ -n "$REF" ]; then
|
|
||||||
# if branch or tag then create it locally too
|
|
||||||
REF_FETCH="$REF:$REF"
|
|
||||||
else
|
|
||||||
REF="FETCH_HEAD"
|
|
||||||
fi
|
|
||||||
git -C "$SRC" fetch --update-head-ok --depth 1 origin "$REF_FETCH"
|
|
||||||
git -C "$SRC" checkout -q "$REF"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# Only execute checkout function above if this file is executed, not sourced from another script
|
|
||||||
prog=checkout.sh # needs to be in sync with this file's name
|
|
||||||
if [ "$(basename -- $0)" = "$prog" ]; then
|
|
||||||
checkout $*
|
|
||||||
fi
|
|
@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"inbounds": [{
|
|
||||||
"port": 9000,
|
|
||||||
"protocol": "vmess",
|
|
||||||
"settings": {
|
|
||||||
"clients": [
|
|
||||||
{
|
|
||||||
"id": "1eb6e917-774b-4a84-aff6-b058577c60a5",
|
|
||||||
"level": 1,
|
|
||||||
"alterId": 64
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
"outbounds": [{
|
|
||||||
"protocol": "freedom",
|
|
||||||
"settings": {}
|
|
||||||
}]
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
Source: xray
|
|
||||||
Section: net
|
|
||||||
Priority: optional
|
|
||||||
Maintainer: Teddysun <i@teddysun.com>
|
|
||||||
Build-Depends: bash,
|
|
||||||
cmake,
|
|
||||||
dh-apparmor,
|
|
||||||
debhelper-compat (= 12),
|
|
||||||
gcc,
|
|
||||||
git,
|
|
||||||
libc-dev,
|
|
||||||
libltdl-dev,
|
|
||||||
libseccomp-dev,
|
|
||||||
libseccomp2,
|
|
||||||
libsystemd-dev,
|
|
||||||
libtool,
|
|
||||||
make,
|
|
||||||
pkg-config
|
|
||||||
Standards-Version: 3.9.6
|
|
||||||
Homepage: https://github.com/xtls/xray-core
|
|
||||||
Rules-Requires-Root: no
|
|
||||||
Vcs-Browser: https://github.com/xtls/xray-core
|
|
||||||
Vcs-Git: git://github.com/xtls/xray-core.git
|
|
||||||
|
|
||||||
Package: xray
|
|
||||||
Architecture: linux-any
|
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
|
||||||
Description: Xray, Penetrates Everything.
|
|
||||||
Also the best v2ray-core, with XTLS support. Fully compatible configuration.
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/usr/bin/make -f
|
|
||||||
|
|
||||||
# force packages to be built with xz compression, as Ubuntu 21.10 and up use
|
|
||||||
# zstd compression, which is non-standard, and breaks 'dpkg-sig --verify'
|
|
||||||
override_dh_builddeb:
|
|
||||||
dh_builddeb -- -Zxz
|
|
||||||
|
|
||||||
override_dh_auto_build:
|
|
||||||
cd xray \
|
|
||||||
&& GO111MODULE=on \
|
|
||||||
env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w -buildid=" -o "xray" ./main
|
|
||||||
|
|
||||||
# http://manpages.debian.org/dh_dwz
|
|
||||||
override_dh_dwz:
|
|
||||||
# dh_dwz in debhelper versions less than 13 has issues with files that are missing debug symbols (once we update to debhelper-compat 13+ this can be removed)
|
|
||||||
@# https://packages.debian.org/debhelper
|
|
||||||
@# https://packages.ubuntu.com/debhelper
|
|
||||||
|
|
||||||
override_dh_auto_install:
|
|
||||||
install -D -m 0644 debian/config.json debian/xray/etc/xray/config.json
|
|
||||||
install -D -m 0755 xray/xray debian/xray/usr/bin/xray
|
|
||||||
install -D -m 0644 xray/geoip.dat debian/xray/usr/share/xray/geoip.dat
|
|
||||||
install -D -m 0644 xray/geosite.dat debian/xray/usr/share/xray/geosite.dat
|
|
||||||
|
|
||||||
override_dh_installsystemd:
|
|
||||||
dh_installsystemd --no-enable --no-start
|
|
||||||
|
|
||||||
override_dh_shlibdeps:
|
|
||||||
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
|
|
||||||
|
|
||||||
%:
|
|
||||||
dh $@
|
|
@ -1 +0,0 @@
|
|||||||
1.0
|
|
@ -1 +0,0 @@
|
|||||||
xray/README.md
|
|
@ -1,2 +0,0 @@
|
|||||||
debian/xray.service lib/systemd/system/
|
|
||||||
debian/xray@.service lib/systemd/system/
|
|
@ -1,17 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Xray Service
|
|
||||||
Documentation=https://github.com/xtls
|
|
||||||
After=network.target nss-lookup.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
|
||||||
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
|
||||||
NoNewPrivileges=true
|
|
||||||
ExecStart=/usr/bin/xray run -config /etc/xray/config.json
|
|
||||||
Restart=on-failure
|
|
||||||
RestartPreventExitStatus=23
|
|
||||||
LimitNPROC=10000
|
|
||||||
LimitNOFILE=1000000
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
@ -1,17 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Xray Service
|
|
||||||
Documentation=https://github.com/xtls
|
|
||||||
After=network.target nss-lookup.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
|
||||||
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
|
||||||
NoNewPrivileges=true
|
|
||||||
ExecStart=/usr/bin/xray run -config /etc/xray/%i.json
|
|
||||||
Restart=on-failure
|
|
||||||
RestartPreventExitStatus=23
|
|
||||||
LimitNPROC=10000
|
|
||||||
LimitNOFILE=1000000
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
@ -1,40 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
ARG GO_IMAGE
|
|
||||||
ARG DISTRO=debian
|
|
||||||
ARG SUITE=bookworm
|
|
||||||
ARG VERSION_ID=12
|
|
||||||
ARG BUILD_IMAGE=${DISTRO}:${SUITE}
|
|
||||||
|
|
||||||
FROM ${GO_IMAGE} AS golang
|
|
||||||
|
|
||||||
FROM ${BUILD_IMAGE}
|
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
RUN apt-get update && apt-get install -y curl devscripts equivs git
|
|
||||||
|
|
||||||
ENV GOPROXY=https://proxy.golang.org|direct
|
|
||||||
ENV GO111MODULE=off
|
|
||||||
ENV GOPATH /go
|
|
||||||
ENV GOTOOLCHAIN=local
|
|
||||||
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
|
|
||||||
|
|
||||||
ARG COMMON_FILES
|
|
||||||
COPY --link ${COMMON_FILES} /root/build-deb/debian
|
|
||||||
RUN apt-get update \
|
|
||||||
&& mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control
|
|
||||||
|
|
||||||
COPY --link sources/ /sources
|
|
||||||
ARG DISTRO
|
|
||||||
ARG SUITE
|
|
||||||
ARG VERSION_ID
|
|
||||||
ENV DISTRO=${DISTRO}
|
|
||||||
ENV SUITE=${SUITE}
|
|
||||||
ENV VERSION_ID=${VERSION_ID}
|
|
||||||
|
|
||||||
COPY --link --from=golang /usr/local/go /usr/local/go
|
|
||||||
|
|
||||||
WORKDIR /root/build-deb
|
|
||||||
COPY build-deb /root/build-deb/build-deb
|
|
||||||
|
|
||||||
ENTRYPOINT ["/root/build-deb/build-deb"]
|
|
@ -1,40 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
ARG GO_IMAGE
|
|
||||||
ARG DISTRO=debian
|
|
||||||
ARG SUITE=bullseye
|
|
||||||
ARG VERSION_ID=11
|
|
||||||
ARG BUILD_IMAGE=${DISTRO}:${SUITE}
|
|
||||||
|
|
||||||
FROM ${GO_IMAGE} AS golang
|
|
||||||
|
|
||||||
FROM ${BUILD_IMAGE}
|
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
RUN apt-get update && apt-get install -y curl devscripts equivs git
|
|
||||||
|
|
||||||
ENV GOPROXY=https://proxy.golang.org|direct
|
|
||||||
ENV GO111MODULE=off
|
|
||||||
ENV GOPATH /go
|
|
||||||
ENV GOTOOLCHAIN=local
|
|
||||||
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
|
|
||||||
|
|
||||||
ARG COMMON_FILES
|
|
||||||
COPY --link ${COMMON_FILES} /root/build-deb/debian
|
|
||||||
RUN apt-get update \
|
|
||||||
&& mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control
|
|
||||||
|
|
||||||
COPY --link sources/ /sources
|
|
||||||
ARG DISTRO
|
|
||||||
ARG SUITE
|
|
||||||
ARG VERSION_ID
|
|
||||||
ENV DISTRO=${DISTRO}
|
|
||||||
ENV SUITE=${SUITE}
|
|
||||||
ENV VERSION_ID=${VERSION_ID}
|
|
||||||
|
|
||||||
COPY --link --from=golang /usr/local/go /usr/local/go
|
|
||||||
|
|
||||||
WORKDIR /root/build-deb
|
|
||||||
COPY build-deb /root/build-deb/build-deb
|
|
||||||
|
|
||||||
ENTRYPOINT ["/root/build-deb/build-deb"]
|
|
@ -1,40 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
ARG GO_IMAGE
|
|
||||||
ARG DISTRO=debian
|
|
||||||
ARG SUITE=buster
|
|
||||||
ARG VERSION_ID=10
|
|
||||||
ARG BUILD_IMAGE=${DISTRO}:${SUITE}
|
|
||||||
|
|
||||||
FROM ${GO_IMAGE} AS golang
|
|
||||||
|
|
||||||
FROM ${BUILD_IMAGE}
|
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
RUN apt-get update && apt-get install -y curl devscripts equivs git
|
|
||||||
|
|
||||||
ENV GOPROXY=https://proxy.golang.org|direct
|
|
||||||
ENV GO111MODULE=off
|
|
||||||
ENV GOPATH /go
|
|
||||||
ENV GOTOOLCHAIN=local
|
|
||||||
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
|
|
||||||
|
|
||||||
ARG COMMON_FILES
|
|
||||||
COPY --link ${COMMON_FILES} /root/build-deb/debian
|
|
||||||
RUN apt-get update \
|
|
||||||
&& mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control
|
|
||||||
|
|
||||||
COPY --link sources/ /sources
|
|
||||||
ARG DISTRO
|
|
||||||
ARG SUITE
|
|
||||||
ARG VERSION_ID
|
|
||||||
ENV DISTRO=${DISTRO}
|
|
||||||
ENV SUITE=${SUITE}
|
|
||||||
ENV VERSION_ID=${VERSION_ID}
|
|
||||||
|
|
||||||
COPY --link --from=golang /usr/local/go /usr/local/go
|
|
||||||
|
|
||||||
WORKDIR /root/build-deb
|
|
||||||
COPY build-deb /root/build-deb/build-deb
|
|
||||||
|
|
||||||
ENTRYPOINT ["/root/build-deb/build-deb"]
|
|
@ -1,46 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
ARG GO_IMAGE
|
|
||||||
ARG DISTRO=ubuntu
|
|
||||||
ARG SUITE=focal
|
|
||||||
ARG VERSION_ID=20.04
|
|
||||||
ARG BUILD_IMAGE=${DISTRO}:${SUITE}
|
|
||||||
|
|
||||||
FROM ${GO_IMAGE} AS golang
|
|
||||||
|
|
||||||
FROM ${BUILD_IMAGE}
|
|
||||||
|
|
||||||
# Remove diverted man binary to prevent man-pages being replaced with "minimized" message. See docker/for-linux#639
|
|
||||||
RUN if [ "$(dpkg-divert --truename /usr/bin/man)" = "/usr/bin/man.REAL" ]; then \
|
|
||||||
rm -f /usr/bin/man; \
|
|
||||||
dpkg-divert --quiet --remove --rename /usr/bin/man; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
RUN apt-get update && apt-get install -y curl devscripts equivs git
|
|
||||||
|
|
||||||
ENV GOPROXY=https://proxy.golang.org|direct
|
|
||||||
ENV GO111MODULE=off
|
|
||||||
ENV GOPATH /go
|
|
||||||
ENV GOTOOLCHAIN=local
|
|
||||||
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
|
|
||||||
|
|
||||||
ARG COMMON_FILES
|
|
||||||
COPY --link ${COMMON_FILES} /root/build-deb/debian
|
|
||||||
RUN apt-get update \
|
|
||||||
&& mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control
|
|
||||||
|
|
||||||
COPY --link sources/ /sources
|
|
||||||
ARG DISTRO
|
|
||||||
ARG SUITE
|
|
||||||
ARG VERSION_ID
|
|
||||||
ENV DISTRO=${DISTRO}
|
|
||||||
ENV SUITE=${SUITE}
|
|
||||||
ENV VERSION_ID=${VERSION_ID}
|
|
||||||
|
|
||||||
COPY --link --from=golang /usr/local/go /usr/local/go
|
|
||||||
|
|
||||||
WORKDIR /root/build-deb
|
|
||||||
COPY build-deb /root/build-deb/build-deb
|
|
||||||
|
|
||||||
ENTRYPOINT ["/root/build-deb/build-deb"]
|
|
@ -1,46 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
ARG GO_IMAGE
|
|
||||||
ARG DISTRO=ubuntu
|
|
||||||
ARG SUITE=jammy
|
|
||||||
ARG VERSION_ID=22.04
|
|
||||||
ARG BUILD_IMAGE=${DISTRO}:${SUITE}
|
|
||||||
|
|
||||||
FROM ${GO_IMAGE} AS golang
|
|
||||||
|
|
||||||
FROM ${BUILD_IMAGE}
|
|
||||||
|
|
||||||
# Remove diverted man binary to prevent man-pages being replaced with "minimized" message. See docker/for-linux#639
|
|
||||||
RUN if [ "$(dpkg-divert --truename /usr/bin/man)" = "/usr/bin/man.REAL" ]; then \
|
|
||||||
rm -f /usr/bin/man; \
|
|
||||||
dpkg-divert --quiet --remove --rename /usr/bin/man; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
RUN apt-get update && apt-get install -y curl devscripts equivs git
|
|
||||||
|
|
||||||
ENV GOPROXY=https://proxy.golang.org|direct
|
|
||||||
ENV GO111MODULE=off
|
|
||||||
ENV GOPATH /go
|
|
||||||
ENV GOTOOLCHAIN=local
|
|
||||||
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
|
|
||||||
|
|
||||||
ARG COMMON_FILES
|
|
||||||
COPY --link ${COMMON_FILES} /root/build-deb/debian
|
|
||||||
RUN apt-get update \
|
|
||||||
&& mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control
|
|
||||||
|
|
||||||
COPY --link sources/ /sources
|
|
||||||
ARG DISTRO
|
|
||||||
ARG SUITE
|
|
||||||
ARG VERSION_ID
|
|
||||||
ENV DISTRO=${DISTRO}
|
|
||||||
ENV SUITE=${SUITE}
|
|
||||||
ENV VERSION_ID=${VERSION_ID}
|
|
||||||
|
|
||||||
COPY --link --from=golang /usr/local/go /usr/local/go
|
|
||||||
|
|
||||||
WORKDIR /root/build-deb
|
|
||||||
COPY build-deb /root/build-deb/build-deb
|
|
||||||
|
|
||||||
ENTRYPOINT ["/root/build-deb/build-deb"]
|
|
@ -1,46 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
ARG GO_IMAGE
|
|
||||||
ARG DISTRO=ubuntu
|
|
||||||
ARG SUITE=noble
|
|
||||||
ARG VERSION_ID=24.04
|
|
||||||
ARG BUILD_IMAGE=${DISTRO}:${SUITE}
|
|
||||||
|
|
||||||
FROM ${GO_IMAGE} AS golang
|
|
||||||
|
|
||||||
FROM ${BUILD_IMAGE}
|
|
||||||
|
|
||||||
# Remove diverted man binary to prevent man-pages being replaced with "minimized" message. See docker/for-linux#639
|
|
||||||
RUN if [ "$(dpkg-divert --truename /usr/bin/man)" = "/usr/bin/man.REAL" ]; then \
|
|
||||||
rm -f /usr/bin/man; \
|
|
||||||
dpkg-divert --quiet --remove --rename /usr/bin/man; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
RUN apt-get update && apt-get install -y curl devscripts equivs git
|
|
||||||
|
|
||||||
ENV GOPROXY=https://proxy.golang.org|direct
|
|
||||||
ENV GO111MODULE=off
|
|
||||||
ENV GOPATH /go
|
|
||||||
ENV GOTOOLCHAIN=local
|
|
||||||
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
|
|
||||||
|
|
||||||
ARG COMMON_FILES
|
|
||||||
COPY --link ${COMMON_FILES} /root/build-deb/debian
|
|
||||||
RUN apt-get update \
|
|
||||||
&& mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control
|
|
||||||
|
|
||||||
COPY --link sources/ /sources
|
|
||||||
ARG DISTRO
|
|
||||||
ARG SUITE
|
|
||||||
ARG VERSION_ID
|
|
||||||
ENV DISTRO=${DISTRO}
|
|
||||||
ENV SUITE=${SUITE}
|
|
||||||
ENV VERSION_ID=${VERSION_ID}
|
|
||||||
|
|
||||||
COPY --link --from=golang /usr/local/go /usr/local/go
|
|
||||||
|
|
||||||
WORKDIR /root/build-deb
|
|
||||||
COPY build-deb /root/build-deb/build-deb
|
|
||||||
|
|
||||||
ENTRYPOINT ["/root/build-deb/build-deb"]
|
|
@ -54,7 +54,7 @@ A sample in JSON like below:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Or some examples of uses for Xray-core [https://github.com/XTLS/Xray-examples](https://github.com/XTLS/Xray-examples)
|
Or generate a configuration file online by [https://tools.sprov.xyz/v2ray/](https://tools.sprov.xyz/v2ray/)
|
||||||
|
|
||||||
There is an example to start a container that listen on port `9000`, run as a Xray server like below:
|
There is an example to start a container that listen on port `9000`, run as a Xray server like below:
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# Supported architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
|
# Supported architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
|
||||||
#
|
#
|
||||||
# Copyright (C) 2020 - 2024 Teddysun <i@teddysun.com>
|
# Copyright (C) 2020 Teddysun <i@teddysun.com>
|
||||||
#
|
#
|
||||||
# Reference URL:
|
# Reference URL:
|
||||||
# https://github.com/XTLS/Xray-core
|
# https://github.com/XTLS/Xray-core
|
||||||
@ -22,7 +22,7 @@ cd ${cur_dir}
|
|||||||
git clone https://github.com/XTLS/Xray-core.git
|
git clone https://github.com/XTLS/Xray-core.git
|
||||||
cd Xray-core || exit 2
|
cd Xray-core || exit 2
|
||||||
|
|
||||||
LDFLAGS="-s -w -buildid="
|
LDFLAGS="-s -w"
|
||||||
ARCHS=( 386 amd64 arm arm64 ppc64le s390x )
|
ARCHS=( 386 amd64 arm arm64 ppc64le s390x )
|
||||||
ARMS=( 6 7 )
|
ARMS=( 6 7 )
|
||||||
|
|
||||||
|
@ -1,115 +0,0 @@
|
|||||||
#
|
|
||||||
# spec file for package xray-plugin
|
|
||||||
#
|
|
||||||
Name: xray-plugin
|
|
||||||
Version: 1.8.11
|
|
||||||
Release: 1%{?dist}
|
|
||||||
Summary: A SIP003 plugin for shadowsocks
|
|
||||||
License: MIT
|
|
||||||
Group: Productivity/Networking/Security
|
|
||||||
URL: https://github.com/teddysun/xray-plugin
|
|
||||||
Source0: %{name}-%{version}.tar.gz
|
|
||||||
BuildRequires: bash
|
|
||||||
|
|
||||||
%global debug_package %{nil}
|
|
||||||
%global _missing_build_ids_terminate_build 0
|
|
||||||
|
|
||||||
%description
|
|
||||||
Yet another SIP003 plugin for shadowsocks, based on xray-core
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -q
|
|
||||||
|
|
||||||
%build
|
|
||||||
|
|
||||||
export CGO_ENABLED=0
|
|
||||||
go build -v -trimpath -ldflags "-X main.VERSION=v%{version} -s -w -buildid=" -o xray-plugin
|
|
||||||
|
|
||||||
%install
|
|
||||||
# install binary
|
|
||||||
install -D -p -m 0755 xray-plugin %{buildroot}%{_bindir}/xray-plugin
|
|
||||||
|
|
||||||
%files
|
|
||||||
%defattr(-,root,root)
|
|
||||||
%doc README.md
|
|
||||||
%{_bindir}/xray-plugin
|
|
||||||
%license LICENSE
|
|
||||||
|
|
||||||
%changelog
|
|
||||||
* Fri Apr 26 2024 Teddysun <i@teddysun.com> - 1.8.11-1
|
|
||||||
- Update to version 1.8.11
|
|
||||||
|
|
||||||
* Sat Mar 30 2024 Teddysun <i@teddysun.com> - 1.8.10-1
|
|
||||||
- Update to version 1.8.10
|
|
||||||
|
|
||||||
* Mon Mar 11 2024 Teddysun <i@teddysun.com> - 1.8.9-1
|
|
||||||
- Update to version 1.8.9
|
|
||||||
|
|
||||||
* Mon Feb 26 2024 Teddysun <i@teddysun.com> - 1.8.8-1
|
|
||||||
- Update to version 1.8.8
|
|
||||||
|
|
||||||
* Mon Jan 08 2024 Teddysun <i@teddysun.com> - 1.8.7-1
|
|
||||||
- Update to version 1.8.7
|
|
||||||
|
|
||||||
* Sat Nov 18 2023 Teddysun <i@teddysun.com> - 1.8.6-1
|
|
||||||
- Update to version 1.8.6
|
|
||||||
|
|
||||||
* Tue Nov 14 2023 Teddysun <i@teddysun.com> - 1.8.5-1
|
|
||||||
- Update to version 1.8.5
|
|
||||||
|
|
||||||
* Tue Aug 29 2023 Teddysun <i@teddysun.com> - 1.8.4-1
|
|
||||||
- Update version to 1.8.4
|
|
||||||
|
|
||||||
* Mon Jun 19 2023 Teddysun <i@teddysun.com> - 1.8.3-1
|
|
||||||
- Update version to 1.8.3
|
|
||||||
|
|
||||||
* Tue Apr 18 2023 Teddysun <i@teddysun.com> - 1.8.1-1
|
|
||||||
- Update version to 1.8.1
|
|
||||||
|
|
||||||
* Sat Mar 11 2023 Teddysun <i@teddysun.com> - 1.8.0-1
|
|
||||||
- Update version to 1.8.0
|
|
||||||
|
|
||||||
* Thu Feb 09 2023 Teddysun <i@teddysun.com> - 1.7.5-1
|
|
||||||
- Update version to 1.7.5
|
|
||||||
|
|
||||||
* Thu Feb 02 2023 Teddysun <i@teddysun.com> - 1.7.3-1
|
|
||||||
- Update version to 1.7.3
|
|
||||||
|
|
||||||
* Sun Jan 08 2023 Teddysun <i@teddysun.com> - 1.7.2-1
|
|
||||||
- Update version to 1.7.2
|
|
||||||
|
|
||||||
* Mon Dec 26 2022 Teddysun <i@teddysun.com> - 1.7.0-1
|
|
||||||
- Update version to 1.7.0
|
|
||||||
|
|
||||||
* Mon Dec 12 2022 Teddysun <i@teddysun.com> - 1.6.6-1
|
|
||||||
- Update version to 1.6.6
|
|
||||||
|
|
||||||
* Mon Nov 28 2022 Teddysun <i@teddysun.com> - 1.6.5-1
|
|
||||||
- Update version to 1.6.5
|
|
||||||
|
|
||||||
* Mon Nov 14 2022 Teddysun <i@teddysun.com> - 1.6.4-1
|
|
||||||
- Update version to 1.6.4
|
|
||||||
|
|
||||||
* Mon Nov 07 2022 Teddysun <i@teddysun.com> - 1.6.3-1
|
|
||||||
- Update version to 1.6.3
|
|
||||||
|
|
||||||
* Sat Oct 29 2022 Teddysun <i@teddysun.com> - 1.6.2-1
|
|
||||||
- Update version to 1.6.2
|
|
||||||
|
|
||||||
* Sat Oct 22 2022 Teddysun <i@teddysun.com> - 1.6.1-1
|
|
||||||
- Update version to 1.6.1
|
|
||||||
|
|
||||||
* Tue Sep 20 2022 Teddysun <i@teddysun.com> - 1.6.0-1
|
|
||||||
- Update version to 1.6.0
|
|
||||||
|
|
||||||
* Mon Aug 29 2022 Teddysun <i@teddysun.com> - 1.5.10-1
|
|
||||||
- Update version to 1.5.10
|
|
||||||
|
|
||||||
* Sat Jul 16 2022 Teddysun <i@teddysun.com> - 1.5.9-1
|
|
||||||
- Update version to 1.5.9
|
|
||||||
|
|
||||||
* Mon Jun 20 2022 Teddysun <i@teddysun.com> - 1.5.8-1
|
|
||||||
- Update version to 1.5.8
|
|
||||||
|
|
||||||
* Thu Jun 16 2022 Teddysun <i@teddysun.com> - 1.5.7-1
|
|
||||||
- Update version to 1.5.7
|
|
@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"inbounds": [{
|
|
||||||
"port": 9000,
|
|
||||||
"protocol": "vmess",
|
|
||||||
"settings": {
|
|
||||||
"clients": [
|
|
||||||
{
|
|
||||||
"id": "1eb6e917-774b-4a84-aff6-b058577c60a5",
|
|
||||||
"level": 1,
|
|
||||||
"alterId": 64
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
"outbounds": [{
|
|
||||||
"protocol": "freedom",
|
|
||||||
"settings": {}
|
|
||||||
}]
|
|
||||||
}
|
|
@ -1,132 +0,0 @@
|
|||||||
%global debug_package %{nil}
|
|
||||||
|
|
||||||
Name: xray
|
|
||||||
Version: 1.8.11
|
|
||||||
Release: 1%{?dist}
|
|
||||||
Summary: Xray, Penetrates Everything.
|
|
||||||
License: MPL-2.0
|
|
||||||
URL: https://github.com/XTLS/Xray-core
|
|
||||||
|
|
||||||
Source0: %{name}-%{version}.tar.gz
|
|
||||||
Source1: config.json
|
|
||||||
Source2: https://github.com/v2fly/geoip/releases/latest/download/geoip.dat
|
|
||||||
Source3: https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat
|
|
||||||
|
|
||||||
#BuildRequires: golang >= 1.20
|
|
||||||
%if 0%{?rhel} && 0%{?rhel} < 8
|
|
||||||
BuildRequires: systemd
|
|
||||||
%else
|
|
||||||
BuildRequires: systemd-rpm-macros
|
|
||||||
%endif
|
|
||||||
%{?systemd_requires}
|
|
||||||
Provides: Productivity/Networking/Web/Proxy
|
|
||||||
|
|
||||||
%description
|
|
||||||
Xray, Penetrates Everything.
|
|
||||||
Also the best v2ray-core, with XTLS support. Fully compatible configuration.
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%autosetup
|
|
||||||
|
|
||||||
%build
|
|
||||||
# https://pagure.io/go-rpm-macros/c/1cc7f5d9026175bb6cb1b8c889355d0c4fc0e40a
|
|
||||||
%undefine _auto_set_build_flags
|
|
||||||
|
|
||||||
LDFLAGS='-s -w -buildid='
|
|
||||||
env CGO_ENABLED=0 go build -v -trimpath -ldflags "$LDFLAGS" -o %{name} ./main
|
|
||||||
|
|
||||||
%install
|
|
||||||
%{__install} -d %{buildroot}%{_bindir}
|
|
||||||
%{__install} -p -m 755 %{name} %{buildroot}%{_bindir}
|
|
||||||
|
|
||||||
%{__install} -d %{buildroot}%{_sysconfdir}/%{name}
|
|
||||||
%{__install} -p -m 644 %{S:1} %{buildroot}%{_sysconfdir}/%{name}/config.json
|
|
||||||
|
|
||||||
%{__install} -d %{buildroot}%{_datadir}/%{name}
|
|
||||||
%{__install} -p -m 0644 %{S:2} %{buildroot}%{_datadir}/%{name}/geoip.dat
|
|
||||||
%{__install} -p -m 0644 %{S:3} %{buildroot}%{_datadir}/%{name}/geosite.dat
|
|
||||||
|
|
||||||
%{__install} -d %{buildroot}%{_unitdir}
|
|
||||||
cat > %{buildroot}%{_unitdir}/%{name}.service <<EOF
|
|
||||||
[Unit]
|
|
||||||
Description=Xray Service
|
|
||||||
Documentation=https://github.com/xtls
|
|
||||||
After=network.target nss-lookup.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
|
||||||
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
|
||||||
NoNewPrivileges=true
|
|
||||||
ExecStart=/usr/bin/xray run -config /etc/xray/config.json
|
|
||||||
Restart=on-failure
|
|
||||||
RestartPreventExitStatus=23
|
|
||||||
LimitNPROC=10000
|
|
||||||
LimitNOFILE=1000000
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOF
|
|
||||||
cat > %{buildroot}%{_unitdir}/%{name}@.service <<EOF
|
|
||||||
[Unit]
|
|
||||||
Description=Xray Service
|
|
||||||
Documentation=https://github.com/xtls
|
|
||||||
After=network.target nss-lookup.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
|
||||||
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
|
||||||
NoNewPrivileges=true
|
|
||||||
ExecStart=/usr/bin/xray run -config /etc/xray/%i.json
|
|
||||||
Restart=on-failure
|
|
||||||
RestartPreventExitStatus=23
|
|
||||||
LimitNPROC=10000
|
|
||||||
LimitNOFILE=1000000
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOF
|
|
||||||
|
|
||||||
|
|
||||||
%post
|
|
||||||
%systemd_post %{name}.service
|
|
||||||
|
|
||||||
%preun
|
|
||||||
%systemd_preun %{name}.service
|
|
||||||
|
|
||||||
%postun
|
|
||||||
%systemd_postun_with_restart %{name}.service
|
|
||||||
|
|
||||||
%files
|
|
||||||
%{_bindir}/%{name}
|
|
||||||
%{_unitdir}/%{name}.service
|
|
||||||
%{_unitdir}/%{name}@.service
|
|
||||||
%dir %{_sysconfdir}/%{name}
|
|
||||||
%config(noreplace) %{_sysconfdir}/%{name}/config.json
|
|
||||||
%{_datadir}/%{name}/*.dat
|
|
||||||
%license LICENSE
|
|
||||||
%doc README.md
|
|
||||||
|
|
||||||
%changelog
|
|
||||||
* Fri Apr 26 2024 Teddysun <i@teddysun.com> - 1.8.11-1
|
|
||||||
- Update to version 1.8.11
|
|
||||||
|
|
||||||
* Sat Mar 30 2024 Teddysun <i@teddysun.com> - 1.8.10-1
|
|
||||||
- Update to version 1.8.10
|
|
||||||
|
|
||||||
* Mon Mar 11 2024 Teddysun <i@teddysun.com> - 1.8.9-1
|
|
||||||
- Update to version 1.8.9
|
|
||||||
|
|
||||||
* Mon Feb 26 2024 Teddysun <i@teddysun.com> - 1.8.8-1
|
|
||||||
- Update to version 1.8.8
|
|
||||||
|
|
||||||
* Mon Jan 08 2024 Teddysun <i@teddysun.com> - 1.8.7-1
|
|
||||||
- Update to version 1.8.7
|
|
||||||
|
|
||||||
* Sat Nov 18 2023 Teddysun <i@teddysun.com> - 1.8.6-1
|
|
||||||
- Update to version 1.8.6
|
|
||||||
|
|
||||||
* Tue Nov 14 2023 Teddysun <i@teddysun.com> - 1.8.5-1
|
|
||||||
- Update to version 1.8.5
|
|
||||||
|
|
||||||
* Wed Oct 18 2023 Teddysun <i@teddysun.com> - 1.8.4-1
|
|
||||||
- Update to version 1.8.4
|
|
Loading…
x
Reference in New Issue
Block a user