52 lines
1.1 KiB
Bash
52 lines
1.1 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
set -e
|
||
|
|
||
|
[[ "$#" == "2" ]] || {
|
||
|
echo "Please use the directory name and the nodejs version as the only arguments"
|
||
|
exit 1
|
||
|
}
|
||
|
|
||
|
directory_name="${1}"
|
||
|
nodejs_package="${2}"
|
||
|
|
||
|
zypper -n install \
|
||
|
cpio \
|
||
|
gawk \
|
||
|
make \
|
||
|
"${nodejs_package}" \
|
||
|
obs-service-obs_scm \
|
||
|
obs-service-set_version \
|
||
|
osc \
|
||
|
yarn
|
||
|
|
||
|
version="$( awk '/^Version:/ {print $2;exit;}' "${directory_name}.spec" )"
|
||
|
|
||
|
echo "##########"
|
||
|
echo "Package version is $version"
|
||
|
basename="${directory_name}-$version"
|
||
|
obscpio="$basename.obscpio"
|
||
|
wd="$(pwd)"
|
||
|
tmpdir="$(mktemp -d -p /tmp)"
|
||
|
cd "$tmpdir"
|
||
|
|
||
|
echo "##########"
|
||
|
echo "Extracting obscpio archive"
|
||
|
cpio -id < "$wd/$obscpio"
|
||
|
ls -lah
|
||
|
cd "$basename"
|
||
|
|
||
|
echo "##########"
|
||
|
echo "Creating .yarnrc"
|
||
|
echo 'yarn-offline-mirror ./npm-packages-offline-cache' >> .yarnrc
|
||
|
echo 'yarn-offline-mirror-pruning true' >> .yarnrc
|
||
|
cat .yarnrc
|
||
|
|
||
|
echo "##########"
|
||
|
yarn install --ignore-scripts --production=true --frozen-lockfile
|
||
|
tar czf "$wd/npm-packages-offline-cache.tar.zst" ./npm-packages-offline-cache
|
||
|
|
||
|
echo "##########"
|
||
|
echo "DONE creating yarn dependency offline cache file npm-packages-offline-cache.tar.zst"
|
||
|
rm -rf "$tmpdir"
|