Files
server/opt/psa/admin/sbin/modules/nodejs/unpack-node.sh
cutemeli 0bfc6c8425 Initial
2025-12-22 10:32:59 +00:00

11 lines
527 B
Bash
Executable File

#!/bin/bash -e
### Copyright 1999-2024. WebPros International GmbH. All rights reserved.
[ -d "$2" ] && mv "$2" "$2.back"
mkdir -m 755 "$2"
tar -xf "$1" -C "$2" --unlink-first --strip-components 1 --no-same-owner
find "$2" -type f -print0 | xargs -0 sed -i \
-e "1s,#!/usr/bin/env node,#!${2}/bin/node,g" \
-e '1s,^#!\s*/usr/bin/python\($\|\s\),#!/usr/bin/python2\1,' \
-e '1s,^#!\s*/usr/bin/env\s\+python\($\|\s\),#!/usr/bin/env python2\1,'
[ -d "$2.back" ] && rm -rf "$2.back"