增加nodejs的打包

master
yutent 2023-09-14 15:01:31 +08:00
parent f811e3cd97
commit a738021b62
8 changed files with 194 additions and 3 deletions

View File

@ -11,9 +11,7 @@ if [ "$1" == "arm" ]; then
pkg_arch="aarch64"
deb_arch="arm64"
fi
echo $1
echo $pkg_arch, $deb_arch
# exit 0
deb_url="https://github.com/oven-sh/bun/releases/download/bun-${release}/bun-linux-${pkg_arch}.zip"

View File

@ -126,4 +126,5 @@ sudo chown -R root:root unpack
dpkg-deb -b ./unpack "./${app_name}_${version}.deb"
sudo rm -rf ./unpack
echo "打包完成 :)"

View File

@ -68,4 +68,5 @@ sudo chown -R root:root unpack
dpkg-deb -b ./unpack "./${app_name}_${version}.deb"
sudo rm -rf ./unpack
echo "打包完成 :)"

View File

@ -145,4 +145,5 @@ sudo chown -R root:root unpack
dpkg-deb -b ./unpack "./${app_name}_${version}.deb"
sudo rm -rf ./unpack
echo "打包完成 :)"

View File

@ -79,4 +79,5 @@ sudo chown -R root:root unpack
dpkg-deb -b ./unpack "./${app_name}_${version}.deb"
sudo rm -rf ./unpack
echo "打包完成 :)"

94
nodejs/package-current.sh Executable file
View File

@ -0,0 +1,94 @@
#!/bin/bash
app_name="nodejs-current"
tmp_dir="/tmp/${app_name}_tmp"
version="20.6.1"
release="v${version}"
pkg_arch="x64"
deb_arch="amd64"
if [ "$1" == "arm" ]; then
pkg_arch="arm64"
deb_arch="arm64"
fi
deb_url="http://mirrors.ustc.edu.cn/node/latest-v20.x/node-${release}-linux-${pkg_arch}.tar.xz"
# 创建临时目录, 用于下载官方包
if [ -d $tmp_dir ]; then
rm -rf $tmp_dir
fi
if [ -d "./unpack" ]; then
sudo rm -rf ./unpack
fi
if [ -f "./${app_name}_${version}.deb" ]; then
rm "./${app_name}_${version}.deb"
fi
mkdir $tmp_dir
# 创建临时待打包目录
echo "创建待打包目录..."
mkdir -p "./unpack/DEBIAN"
mkdir -p "./unpack/usr"
echo "下载官方原包..."
wget $deb_url -O "${tmp_dir}/${app_name}-${pkg_arch}.tar.xz"
echo "下载完成, 解包中..."
tar -xf "${tmp_dir}/${app_name}-${pkg_arch}.tar.xz" -C $tmp_dir
echo "解包完成, 复制到待打包目录..."
mv ${tmp_dir}/node-${release}-linux-${pkg_arch}/* "./unpack/usr/"
rm -rf $tmp_dir
echo "复制完成, 计算文件md5..."
cd ./unpack
find usr/ -type f | xargs md5sum > DEBIAN/md5sums
IFS=$'\t' read -ra size <<< "$(du -d 0)"
echo """
Package: ${app_name}
Version: ${version}
Section: devlop
Installed-Size: ${size[0]}
Architecture: ${deb_arch}
Maintainer: Yutent <yutent.io@gmail.com>
Priority: optional
Depends: libc6 (>= 2.28), libgcc1 (>= 1:3.4), libstdc++6 (>= 5.2), python3-minimal, ca-certificates
Breaks: nodejs, nodejs-lts, npm
Replaces: nodejs, nodejs-lts, npm
Provides: nodejs, npm
Homepage: https://nodejs.org
Description: Node.js event-based server-side javascript engine
Node.js is similar in design to and influenced by systems like
Ruby's Event Machine or Python's Twisted.
.
It takes the event model a bit further - it presents the event
loop as a language construct instead of as a library.
.
Node.js is bundled with several useful libraries to handle server tasks :
System, Events, Standard I/O, Modules, Timers, Child Processes, POSIX,
HTTP, Multipart Parsing, TCP, DNS, Assert, Path, URL, Query Strings.
""" > DEBIAN/control
echo '计算文件md5完成, 打包中...'
cd ..
sudo chown -R root:root unpack
dpkg-deb -b ./unpack "./${app_name}-${deb_arch}_${version}.deb"
sudo rm -rf ./unpack
echo "打包完成 :)"

94
nodejs/package-lts.sh Executable file
View File

@ -0,0 +1,94 @@
#!/bin/bash
app_name="nodejs-lts"
tmp_dir="/tmp/${app_name}_tmp"
version="18.17.1"
release="v${version}"
pkg_arch="x64"
deb_arch="amd64"
if [ "$1" == "arm" ]; then
pkg_arch="arm64"
deb_arch="arm64"
fi
deb_url="http://mirrors.ustc.edu.cn/node/latest-v18.x/node-${release}-linux-${pkg_arch}.tar.xz"
# 创建临时目录, 用于下载官方包
if [ -d $tmp_dir ]; then
rm -rf $tmp_dir
fi
if [ -d "./unpack" ]; then
sudo rm -rf ./unpack
fi
if [ -f "./${app_name}_${version}.deb" ]; then
rm "./${app_name}_${version}.deb"
fi
mkdir $tmp_dir
# 创建临时待打包目录
echo "创建待打包目录..."
mkdir -p "./unpack/DEBIAN"
mkdir -p "./unpack/usr"
echo "下载官方原包..."
wget $deb_url -O "${tmp_dir}/${app_name}-${pkg_arch}.tar.xz"
echo "下载完成, 解包中..."
tar -xf "${tmp_dir}/${app_name}-${pkg_arch}.tar.xz" -C $tmp_dir
echo "解包完成, 复制到待打包目录..."
mv ${tmp_dir}/node-${release}-linux-${pkg_arch}/* "./unpack/usr/"
rm -rf $tmp_dir
echo "复制完成, 计算文件md5..."
cd ./unpack
find usr/ -type f | xargs md5sum > DEBIAN/md5sums
IFS=$'\t' read -ra size <<< "$(du -d 0)"
echo """
Package: ${app_name}
Version: ${version}
Section: devlop
Installed-Size: ${size[0]}
Architecture: ${deb_arch}
Maintainer: Yutent <yutent.io@gmail.com>
Priority: optional
Depends: libc6 (>= 2.28), libgcc1 (>= 1:3.4), libstdc++6 (>= 5.2), python3-minimal, ca-certificates
Breaks: nodejs, nodejs-current, npm
Replaces: nodejs, nodejs-current, npm
Provides: nodejs, npm
Homepage: https://nodejs.org
Description: Node.js event-based server-side javascript engine
Node.js is similar in design to and influenced by systems like
Ruby's Event Machine or Python's Twisted.
.
It takes the event model a bit further - it presents the event
loop as a language construct instead of as a library.
.
Node.js is bundled with several useful libraries to handle server tasks :
System, Events, Standard I/O, Modules, Timers, Child Processes, POSIX,
HTTP, Multipart Parsing, TCP, DNS, Assert, Path, URL, Query Strings.
""" > DEBIAN/control
echo '计算文件md5完成, 打包中...'
cd ..
sudo chown -R root:root unpack
dpkg-deb -b ./unpack "./${app_name}-${deb_arch}_${version}.deb"
sudo rm -rf ./unpack
echo "打包完成 :)"

View File

@ -82,4 +82,5 @@ sudo chown -R root:root unpack
dpkg-deb -b ./unpack "./${app_name}_${version}.deb"
sudo rm -rf ./unpack
echo "打包完成 :)"