-
-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathtxp-release.sh
More file actions
142 lines (124 loc) · 5.6 KB
/
Copy pathtxp-release.sh
File metadata and controls
142 lines (124 loc) · 5.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/sh
#/*
# * Textpattern Content Management System
# * https://textpattern.com/
# *
# * Copyright (C) 2026 The Textpattern Development Team
# *
# * Textpattern is free software; you can redistribute it and/or
# * modify it under the terms of the GNU General Public License
# * as published by the Free Software Foundation, version 2.
# *
# * Textpattern is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with Textpattern. If not, see <https://www.gnu.org/licenses/>.
# */
if [ $# -lt 1 ]; then
echo 1>&2 Usage: $0 '<version> [dest-dir] [repo-dir]'
echo 1>&2 ' dest-dir defaults to a temporary location, repo-dir to the current directory.';
exit 127
fi
VER=$1
DESTDIR=`mktemp -d "${TMPDIR:-/tmp}/txp.XXXXXXXXX"`
OLDDIR=`pwd`
REPODIR=$OLDDIR
if [ $# -eq 2 ]; then
DESTDIR=$2
fi
if [ $# -eq 3 ]; then
DESTDIR=$2
REPODIR=$3
fi
cd $REPODIR
# Export repo to destination -- trailing slash is important!
git checkout-index -a -f --prefix=$DESTDIR/textpattern-$VER/
cd $DESTDIR
# Tidy and remove development helper files.
rm textpattern-$VER.tar.gz
rm textpattern-$VER.tar.xz
rm textpattern-$VER.zip
rm textpattern-$VER.tar.gz.SHA256SUM
rm textpattern-$VER.tar.xz.SHA256SUM
rm textpattern-$VER.zip.SHA256SUM
rm textpattern-$VER/.gitattributes
rm textpattern-$VER/.phpstorm.meta.php
rm textpattern-$VER/CODE_OF_CONDUCT.md
rm textpattern-$VER/composer.json
rm textpattern-$VER/composer.lock
rm textpattern-$VER/CONTRIBUTING.md
rm textpattern-$VER/DEVTOOLS.md
rm textpattern-$VER/package.json
rm textpattern-$VER/phpcs.xml
rm textpattern-$VER/README.md
rm textpattern-$VER/SECURITY.md
rm -rf textpattern-$VER/.github
find . -name '.gitignore' -type f -delete
find . -name '.DS_Store' -type f -delete
# Tidy and remove vendor furniture.
rm textpattern-$VER/textpattern/vendors/phpmailer/phpmailer/.editorconfig
rm textpattern-$VER/textpattern/vendors/phpmailer/phpmailer/COMMITMENT
rm textpattern-$VER/textpattern/vendors/phpmailer/phpmailer/README.md
rm textpattern-$VER/textpattern/vendors/phpmailer/phpmailer/SECURITY.md
rm textpattern-$VER/textpattern/vendors/phpmailer/phpmailer/VERSION
rm textpattern-$VER/textpattern/vendors/phpmailer/phpmailer/composer.json
# Build .tar.gz.
echo -e "\n"
echo '== Building textpattern-'"$VER"'.tar.gz in '"$DESTDIR"'.'
tar cf - -C "$DESTDIR" textpattern-"$VER" | gzip -c9 -q > textpattern-"$VER".tar.gz \
&& echo ' - Built textpattern-'"$VER"'.tar.gz ('$(wc -c textpattern-"$VER".tar.gz | awk '{print $1}' | xargs -I {} echo "scale=4; {}/1024^2" | bc | xargs printf "%.2f")'MB).'
# Build .tar.xz.
echo -e "\n"
echo '== Building textpattern-'"$VER"'.tar.xz in '"$DESTDIR"'.'
tar cf - -C "$DESTDIR" textpattern-"$VER" | xz -9e -z -q > textpattern-"$VER".tar.xz \
&& echo ' - Built textpattern-'"$VER"'.tar.xz ('$(wc -c textpattern-"$VER".tar.xz | awk '{print $1}' | xargs -I {} echo "scale=4; {}/1024^2" | bc | xargs printf "%.2f")'MB).'
# Build .zip.
echo -e "\n"
echo '== Building textpattern-'"$VER"'.zip in '"$DESTDIR"'.'
zip --symlinks -r -q -9 textpattern-"$VER".zip textpattern-"$VER" --exclude textpattern-"$VER"/sites/\* \
&& echo ' - Built textpattern-'"$VER"'.zip ('$(wc -c textpattern-"$VER".zip | awk '{print $1}' | xargs -I {} echo "scale=4; {}/1024^2" | bc | xargs printf "%.2f")'MB).'
# Tests and checksums for .tar.gz.
echo -e "\n"
echo '== Testing textpattern-'"$VER"'.tar.gz integrity...'
if gzip -t textpattern-"$VER".tar.gz 2>&1 | sed 's/^/ /'; then
echo ' - textpattern-'"$VER"'.tar.gz passed `gzip -t` integrity test.' \
&& echo ' - Calculating textpattern-'"$VER"'.tar.gz SHA256 checksum...' \
&& shasum -a 256 textpattern-"$VER".tar.gz > textpattern-"$VER".tar.gz.SHA256SUM \
&& echo ' '$(cat textpattern-"$VER".tar.gz.SHA256SUM | cut -c1-64) \
&& echo ' - Checking textpattern-'"$VER"'.tar.gz checksum...' \
&& shasum -a 256 -c textpattern-"$VER".tar.gz.SHA256SUM 2>&1 | sed 's/^/ /'
else
echo ' - textpattern-$VER.tar.gz failed `gzip -t` integrity test.'
fi
# Tests and checksums for .tar.xz.
echo -e "\n"
echo '== Testing textpattern-'"$VER"'.tar.xz integrity...'
if xz -q -t textpattern-"$VER".tar.xz 2>&1 | sed 's/^/ /'; then
echo ' - textpattern-'"$VER"'.tar.xz passed `xz -t` integrity test.' \
&& echo ' - Calculating textpattern-'"$VER"'.tar.xz SHA256 checksum...' \
&& shasum -a 256 textpattern-"$VER".tar.xz > textpattern-"$VER".tar.xz.SHA256SUM \
&& echo ' '$(cat textpattern-"$VER".tar.xz.SHA256SUM | cut -c1-64) \
&& echo ' - Checking textpattern-'"$VER"'.tar.xz checksum...' \
&& shasum -a 256 -c textpattern-"$VER".tar.xz.SHA256SUM 2>&1 | sed 's/^/ /'
else
echo ' - textpattern-$VER.tar.xz failed `xz -t` integrity test.'
fi
# Tests and checksums for .zip.
echo -e "\n"
echo '== Testing textpattern-'"$VER"'.zip integrity...'
if unzip -q -t textpattern-"$VER".zip 2>&1 | sed 's/^/ /'; then
echo ' - textpattern-'"$VER"'.zip passed `unzip -t` integrity test.' \
&& echo ' - Calculating textpattern-'"$VER"'.zip SHA256 checksum...' \
&& shasum -a 256 textpattern-"$VER".zip > textpattern-"$VER".zip.SHA256SUM \
&& echo ' '$(cat textpattern-"$VER".zip.SHA256SUM | cut -c1-64) \
&& echo ' - Checking textpattern-'"$VER"'.zip checksum...' \
&& shasum -a 256 -c textpattern-"$VER".zip.SHA256SUM 2>&1 | sed 's/^/ /'
else
echo ' - textpattern-$VER.zip failed `unzip -t` integrity test.'
fi
cd $OLDDIR
echo -e "\n"
echo '== Textpattern '$VER' built in '$DESTDIR