Update main.yml

This commit is contained in:
𝓙𝓾𝓵𝓲𝓸
2024-09-01 04:58:40 +02:00
committed by GitHub
parent 648b594996
commit 0016be8b72
+4 -18
View File
@@ -16,11 +16,6 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set up Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt-get update sudo apt-get update
@@ -43,14 +38,12 @@ jobs:
run: | run: |
cd /root/The-World-Is-Yours/ cd /root/The-World-Is-Yours/
sudo bash -c 'function create_deb() { sudo bash -c 'function create_deb() {
# Define package information
PKG_NAME="twiy" PKG_NAME="twiy"
VERSION=$(nginx -v 2>&1 | awk -F"/" "{print \$2}") VERSION=$(nginx -v 2>&1 | awk -F"/" "{print \$2}")
ARCH="amd64" ARCH="amd64"
PKG_DIR="/opt/${PKG_NAME}_${VERSION}_${ARCH}" PKG_DIR="/opt/${PKG_NAME}_${VERSION}_${ARCH}"
DEB_DIR="${PKG_DIR}/DEBIAN" DEB_DIR="${PKG_DIR}/DEBIAN"
# Create directory structure
mkdir -p ${PKG_DIR}/usr/sbin mkdir -p ${PKG_DIR}/usr/sbin
mkdir -p ${PKG_DIR}/usr/local/nginx mkdir -p ${PKG_DIR}/usr/local/nginx
mkdir -p ${PKG_DIR}/nginx mkdir -p ${PKG_DIR}/nginx
@@ -64,19 +57,16 @@ jobs:
mkdir -p ${PKG_DIR}/hostdata/default/public_html mkdir -p ${PKG_DIR}/hostdata/default/public_html
mkdir -p ${PKG_DIR}/usr/nginx_lua mkdir -p ${PKG_DIR}/usr/nginx_lua
# Copy necessary files
cp /usr/sbin/nginx ${PKG_DIR}/usr/sbin/ cp /usr/sbin/nginx ${PKG_DIR}/usr/sbin/
cp -R /nginx/* ${PKG_DIR}/nginx/ cp -R /nginx/* ${PKG_DIR}/nginx/
cp /etc/systemd/system/nginx.service ${PKG_DIR}/etc/systemd/system/ cp /etc/systemd/system/nginx.service ${PKG_DIR}/etc/systemd/system/
cp -R /hostdata/default ${PKG_DIR}/hostdata/ cp -R /hostdata/default ${PKG_DIR}/hostdata/
cp -R /usr/nginx_lua ${PKG_DIR}/usr/ cp -R /usr/nginx_lua ${PKG_DIR}/usr/
# Copy required libraries using ldd to detect dependencies
for lib in $(ldd /usr/sbin/nginx | grep "=> /" | awk "{print \$3}"); do for lib in $(ldd /usr/sbin/nginx | grep "=> /" | awk "{print \$3}"); do
cp "$lib" "${PKG_DIR}/usr/lib/" cp "$lib" "${PKG_DIR}/usr/lib/"
done done
# Repeat for each additional library or binary you need to include
for module in /opt/mod/*; do for module in /opt/mod/*; do
if [ -f "$module" ]; then if [ -f "$module" ]; then
for lib in $(ldd "$module" | grep "=> /" | awk "{print \$3}"); do for lib in $(ldd "$module" | grep "=> /" | awk "{print \$3}"); do
@@ -85,7 +75,6 @@ jobs:
fi fi
done done
# Create user nginx during package installation
mkdir -p ${DEB_DIR} mkdir -p ${DEB_DIR}
cat <<EOL > ${DEB_DIR}/control cat <<EOL > ${DEB_DIR}/control
Package: ${PKG_NAME} Package: ${PKG_NAME}
@@ -93,21 +82,18 @@ Version: ${VERSION}
Section: base Section: base
Priority: optional Priority: optional
Architecture: ${ARCH} Architecture: ${ARCH}
Maintainer: You <you@example.com> Maintainer: theraw <me@julio.al>
Description: Custom NGINX build with modules and dependencies Description: Custom NGINX build
EOL EOL
cat <<EOL > ${DEB_DIR}/postinst cat <<'POSTINST_EOF' > ${DEB_DIR}/postinst
#!/bin/bash #!/bin/bash
# Post-installation script
useradd -r -d /usr/local/nginx -s /bin/false nginx || true useradd -r -d /usr/local/nginx -s /bin/false nginx || true
EOL POSTINST_EOF
chmod 755 ${DEB_DIR}/postinst chmod 755 ${DEB_DIR}/postinst
# Build the .deb package
dpkg-deb --build ${PKG_DIR} dpkg-deb --build ${PKG_DIR}
# Move the .deb package to the /opt directory
mv ${PKG_DIR}.deb /opt/${PKG_NAME}_${VERSION}_${ARCH}.deb mv ${PKG_DIR}.deb /opt/${PKG_NAME}_${VERSION}_${ARCH}.deb
echo "Debian package created at /opt/${PKG_NAME}_${VERSION}_${ARCH}.deb" echo "Debian package created at /opt/${PKG_NAME}_${VERSION}_${ARCH}.deb"