aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build/client.sh2
-rwxr-xr-xscripts/clean/server/test.sh1
-rwxr-xr-xscripts/i18n/pull-hook.sh1
-rwxr-xr-xscripts/openapi-peertube-version.sh4
-rwxr-xr-xscripts/prune-storage.ts7
-rwxr-xr-xscripts/release.sh6
-rwxr-xr-xscripts/upgrade.sh10
7 files changed, 26 insertions, 5 deletions
diff --git a/scripts/build/client.sh b/scripts/build/client.sh
index 62daf98cf..be3eef802 100755
--- a/scripts/build/client.sh
+++ b/scripts/build/client.sh
@@ -41,7 +41,7 @@ if [ -z ${1+x} ] || [ "$1" != "--light" ]; then
41 languages=("fr_FR") 41 languages=("fr_FR")
42 else 42 else
43 # Supported languages 43 # Supported languages
44 languages=("fr_FR" "pt_BR" "sv_SE" "eu_ES" "ca_ES" "cs_CZ" "eo" "zh_Hant_TW" "de_DE" "es_ES" "oc" "zh_Hans_CN") 44 languages=("pl_PL" "it_IT" "ru_RU" "fr_FR" "pt_BR" "sv_SE" "eu_ES" "ca_ES" "cs_CZ" "eo" "zh_Hant_TW" "de_DE" "es_ES" "oc" "zh_Hans_CN")
45 fi 45 fi
46 46
47 for lang in "${languages[@]}"; do 47 for lang in "${languages[@]}"; do
diff --git a/scripts/clean/server/test.sh b/scripts/clean/server/test.sh
index 235ff52cc..b897c30ba 100755
--- a/scripts/clean/server/test.sh
+++ b/scripts/clean/server/test.sh
@@ -18,6 +18,7 @@ removeFiles () {
18 18
19dropRedis () { 19dropRedis () {
20 redis-cli KEYS "bull-localhost:900$1*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL 20 redis-cli KEYS "bull-localhost:900$1*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL
21 redis-cli KEYS "redis-localhost:900$1*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL
21} 22}
22 23
23for i in $(seq 1 6); do 24for i in $(seq 1 6); do
diff --git a/scripts/i18n/pull-hook.sh b/scripts/i18n/pull-hook.sh
index 3a8394110..b0668436d 100755
--- a/scripts/i18n/pull-hook.sh
+++ b/scripts/i18n/pull-hook.sh
@@ -7,6 +7,7 @@ set -eu
7 7
8for i in 1 2 3; do 8for i in 1 2 3; do
9 perl -pi -e 's|&lt;x id=(.+?)/&gt;([^"])|<x id=\1/>\2|g' client/src/locale/target/*.xml 9 perl -pi -e 's|&lt;x id=(.+?)/&gt;([^"])|<x id=\1/>\2|g' client/src/locale/target/*.xml
10 perl -0pi -e 's|<source>(.+?)</source>\s*<context-group |<source>\1</source><target>\1</target><context-group |g' client/src/locale/target/angular_*.xml
10done 11done
11 12
12npm run i18n:xliff2json 13npm run i18n:xliff2json
diff --git a/scripts/openapi-peertube-version.sh b/scripts/openapi-peertube-version.sh
index c638291f6..4eb481e64 100755
--- a/scripts/openapi-peertube-version.sh
+++ b/scripts/openapi-peertube-version.sh
@@ -1,4 +1,6 @@
1#!/usr/bin/env bash
2
1# Version key/value should be on his own line 3# Version key/value should be on his own line
2PACKAGE_VERSION=$(node -p "require('./package.json').version") 4PACKAGE_VERSION=$(node -p "require('./package.json').version")
3 5
4sed -i "s/\(^\s*\)version: .*/\1version: $PACKAGE_VERSION/" support/doc/api/openapi.yaml 6sed -i "s/\(^\s*\)version: .*/\1version: $PACKAGE_VERSION/" ./support/doc/api/openapi.yaml
diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts
index 4ab0b4863..c9e4dbd4b 100755
--- a/scripts/prune-storage.ts
+++ b/scripts/prune-storage.ts
@@ -19,7 +19,8 @@ async function run () {
19 19
20 const storageOnlyOwnedToPrune = [ 20 const storageOnlyOwnedToPrune = [
21 CONFIG.STORAGE.VIDEOS_DIR, 21 CONFIG.STORAGE.VIDEOS_DIR,
22 CONFIG.STORAGE.TORRENTS_DIR 22 CONFIG.STORAGE.TORRENTS_DIR,
23 CONFIG.STORAGE.REDUNDANCY_DIR
23 ] 24 ]
24 25
25 const storageForAllToPrune = [ 26 const storageForAllToPrune = [
@@ -36,6 +37,9 @@ async function run () {
36 toDelete = toDelete.concat(await pruneDirectory(directory, false)) 37 toDelete = toDelete.concat(await pruneDirectory(directory, false))
37 } 38 }
38 39
40 const tmpFiles = await readdir(CONFIG.STORAGE.TMP_DIR)
41 toDelete = toDelete.concat(tmpFiles.map(t => join(CONFIG.STORAGE.TMP_DIR, t)))
42
39 if (toDelete.length === 0) { 43 if (toDelete.length === 0) {
40 console.log('No files to delete.') 44 console.log('No files to delete.')
41 return 45 return
@@ -91,6 +95,7 @@ async function askConfirmation () {
91 confirm: { 95 confirm: {
92 type: 'string', 96 type: 'string',
93 description: 'These following unused files can be deleted, but please check your backups first (bugs happen).' + 97 description: 'These following unused files can be deleted, but please check your backups first (bugs happen).' +
98 ' Notice PeerTube must have been stopped when your ran this script.' +
94 ' Can we delete these files?', 99 ' Can we delete these files?',
95 default: 'n', 100 default: 'n',
96 required: true 101 required: true
diff --git a/scripts/release.sh b/scripts/release.sh
index ccb93bc44..08061fe6f 100755
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -43,7 +43,7 @@ directory_name="peertube-$version"
43zip_name="peertube-$version.zip" 43zip_name="peertube-$version.zip"
44tar_name="peertube-$version.tar.xz" 44tar_name="peertube-$version.tar.xz"
45 45
46changelog=$(awk -v version="$version" '/## v/ { printit = $2 == version }; printit;' CHANGELOG.md | grep -v "$version" | sed '1{/^$/d}') 46changelog=$(awk -v version="$version" '/## v/ { printit = $2 == version }; printit;' CHANGELOG.md | grep -v "## $version" | sed '1{/^$/d}')
47 47
48printf "Changelog will be:\\n\\n%s\\n\\n" "$changelog" 48printf "Changelog will be:\\n\\n%s\\n\\n" "$changelog"
49 49
@@ -60,7 +60,9 @@ fi
60 60
61npm version -f --no-git-tag-version --no-commit-hooks "$1" 61npm version -f --no-git-tag-version --no-commit-hooks "$1"
62 62
63git commit package.json client/package.json -m "Bumped to version $version" 63./scripts/openapi-peertube-version.sh
64
65git commit package.json client/package.json ./support/doc/api/openapi.yaml -m "Bumped to version $version"
64git tag -s -a "$version" -m "$version" 66git tag -s -a "$version" -m "$version"
65 67
66npm run build 68npm run build
diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh
index c70b3b42a..4f7c58edd 100755
--- a/scripts/upgrade.sh
+++ b/scripts/upgrade.sh
@@ -20,6 +20,16 @@ if [ ! -e "$PEERTUBE_PATH/versions" -o ! -e "$PEERTUBE_PATH/config/production.ya
20 exit 1 20 exit 1
21fi 21fi
22 22
23if [ -x "$(command -v awk)" ] && [ -x "$(command -v sed)" ] ; then
24 REMAINING=$(df -k $PEERTUBE_PATH | awk '{ print $4}' | sed -n 2p)
25 ONE_GB=$((1024 * 1024))
26 if [ "$REMAINING" -lt "$ONE_GB" ]; then
27 echo "Error - not enough free space for upgrading"
28 echo ""
29 echo "Make sure you have at least 1 GB of free space in $PEERTUBE_PATH"
30 exit 1
31 fi
32fi
23 33
24# Backup database 34# Backup database
25SQL_BACKUP_PATH="$PEERTUBE_PATH/backup/sql-peertube_prod-$(date +"%Y%m%d-%H%M").bak" 35SQL_BACKUP_PATH="$PEERTUBE_PATH/backup/sql-peertube_prod-$(date +"%Y%m%d-%H%M").bak"