Your IP : 3.145.32.186


Current Path : /usr/local/mgr5/lib/pkgsh/hooks/
Upload File :
Current File : //usr/local/mgr5/lib/pkgsh/hooks/ispmanager-pkg-python.sh

PREINST_HOOKS="${PREINST_HOOKS} install_nodejs_python"

#TODO(vburov) update already installed after changing LTS version
#TODO(vburov) use systemd instead of this mechanism
install_nodejs_python() {
        echo -n "*** "
        date
        # Install archive from official server
        if [ ! -d /usr/lib/ispnodejs ]; then
                echo "*** Download Node.js"
                local tmp_dir=$(mktemp -d /tmp/.XXXXXX.nodejs)
                local lts_ver=$(/usr/local/mgr5/sbin/nodejsctl --command last_lts)
                # Example path in archive - node-v16.17.0-linux-x64/bin/node
                local arch_prefix="node-v${lts_ver}-linux-x64"
                local arch_name="${arch_prefix}.tar.gz"
                local arch_url="https://nodejs.org/dist/v${lts_ver}/${arch_name}"
                local dest_dir=/usr/lib/ispnodejs

                wget --quiet -O "${tmp_dir}/${arch_name}" "${arch_url}"
                tar xzf "${tmp_dir}/${arch_name}" -C "${tmp_dir}/"
                mv "${tmp_dir}/${arch_prefix}" "${dest_dir}"
                chown -R root:root "${dest_dir}"
                chmod 0755 "${dest_dir}"
                rm -rf ${tmp_dir}
        fi
}