diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube index 56da2791..0e7a360b 100755 --- a/src/freedombone-app-peertube +++ b/src/freedombone-app-peertube @@ -434,8 +434,38 @@ function upgrade_peertube { function_check set_repo_commit set_repo_commit $PEERTUBE_DIR "peertube commit" "$PEERTUBE_COMMIT" $PEERTUBE_REPO - cd "$PEERTUBE_DIR/scripts" || exit 7824552627 - sudo -u peertube ./upgrade.sh $PEERTUBE_DIR + if ! npm install -g yarn@1.5.1; then + echo $'Failed to install yarn' + exit 79353234 + fi + yarn add -D webpack --network-concurrency 1 + if ! yarn install; then + echo $'Failed to run yarn install' + exit 63754235 + fi + if ! npm install -g npm@4; then + # https://github.com/KraigM/homebridge-harmonyhub/issues/119 + echo $'Failed to downgrade npm' + npm install -g "npm@${NPM_VERSION}" + cp /root/.npm-global/bin/npm /usr/local/bin/npm + exit 3476835 + fi + cp /root/.npm-global/bin/npm /usr/local/bin/npm + if ! npm install; then + echo $'Failed to install peertube' + npm install -g "npm@${NPM_VERSION}" + cp /root/.npm-global/bin/npm /usr/local/bin/npm + exit 7835243 + fi + if ! npm install -g "npm@${NPM_VERSION}"; then + echo $'Failed to restore npm after downgrade' + exit 5737583 + fi + cp /root/.npm-global/bin/npm /usr/local/bin/npm + npm run build + + # This doesn't appear to work + #sudo -u peertube ./upgrade.sh $PEERTUBE_DIR chown -R peertube:peertube $PEERTUBE_DIR systemctl start peertube @@ -1044,10 +1074,7 @@ function install_peertube { exit 5737583 fi cp /root/.npm-global/bin/npm /usr/local/bin/npm - if ! npm run build; then - echo $'Failed to build peertube' - exit 5293593 - fi + npm run build PEERTUBE_ONION_HOSTNAME=$(add_onion_service peertube 80 ${PEERTUBE_ONION_PORT})