2019-06-01 15:55:21 +00:00
#!/bin/bash
set -e
echo
2021-01-23 21:19:29 +01:00
# osx support
# port install gnutar findutils gsed coreutils
gtar = $( command -v gtar || command -v gnutar) || true
[ ! -z " $gtar " ] && command -v gfind >/dev/null && {
tar( ) { $gtar " $@ " ; }
2020-05-06 01:02:28 +02:00
sed( ) { gsed " $@ " ; }
find( ) { gfind " $@ " ; }
sort( ) { gsort " $@ " ; }
2021-01-23 21:19:29 +01:00
command -v grealpath >/dev/null &&
realpath( ) { grealpath " $@ " ; }
2020-05-06 01:02:28 +02:00
}
2019-06-01 15:55:21 +00:00
which md5sum 2>/dev/null >/dev/null &&
md5sum = md5sum ||
md5sum = "md5 -r"
ver = " $1 "
2020-12-20 02:33:37 +01:00
[ " x $ver " = x ] &&
2019-06-01 15:55:21 +00:00
{
echo "need argument 1: version"
echo
exit 1
}
2020-12-20 02:33:37 +01:00
[ -e copyparty/__main__.py ] || cd ..
[ -e copyparty/__main__.py ] ||
2019-06-01 15:55:21 +00:00
{
2020-04-26 23:31:55 +02:00
echo "run me from within the project root folder"
2019-06-01 15:55:21 +00:00
echo
exit 1
}
2020-04-26 23:31:55 +02:00
mkdir -p dist
2020-05-06 01:02:28 +02:00
zip_path = " $( pwd ) /dist/copyparty- $ver .zip "
tgz_path = " $( pwd ) /dist/copyparty- $ver .tar.gz "
2019-06-01 15:55:21 +00:00
2020-12-20 02:33:37 +01:00
[ -e " $zip_path " ] ||
[ -e " $tgz_path " ] &&
2019-06-01 15:55:21 +00:00
{
echo "found existing archives for this version"
echo " $zip_path "
echo " $tgz_path "
echo
echo "continue?"
read -u1
}
rm " $zip_path " 2>/dev/null || true
rm " $tgz_path " 2>/dev/null || true
2020-05-06 01:02:28 +02:00
#sed -ri "s/^(ADMIN_PWD *= *u).*/\1'hunter2'/" copyparty/config.py
2019-06-01 15:55:21 +00:00
tmp = " $( mktemp -d) "
rls_dir = " $tmp /copyparty- $ver "
mkdir " $rls_dir "
2020-04-26 23:31:55 +02:00
echo ">>> export from git"
2021-09-07 23:18:54 +02:00
git archive hovudstraum | tar -xC " $rls_dir "
2020-04-26 23:31:55 +02:00
echo ">>> export untracked deps"
2020-05-06 01:02:28 +02:00
tar -c copyparty/web/deps | tar -xC " $rls_dir "
2019-06-01 15:55:21 +00:00
cd " $rls_dir "
2020-05-06 01:02:28 +02:00
find -type d -exec chmod 755 '{}' \+
find -type f -exec chmod 644 '{}' \+
2019-06-01 15:55:21 +00:00
commaver = " $(
printf '%s\n' " $ver " |
2020-04-26 23:31:55 +02:00
sed -r 's/\./, /g'
2019-06-01 15:55:21 +00:00
) "
grep -qE " ^VERSION *= \( ${ commaver } \) $" copyparty/__version__.py ||
{
echo " $tmp "
echo "bad version"
echo
echo " arg: $commaver "
echo " code: $(
cat copyparty/__version__.py |
grep -E '^VERSION'
) "
echo
echo "continue?"
read -u1
}
rm -rf .vscode
rm \
.gitattributes \
.gitignore
mv LICENSE LICENSE.txt
2020-05-06 01:02:28 +02:00
# the regular cleanup memes
find -name '*.pyc' -delete
find -name __pycache__ -delete
find -type f \( -name .DS_Store -or -name ._.DS_Store \) -delete
find -type f -name ._\* | while IFS = read -r f; do cmp <( printf '\x00\x05\x16' ) <( head -c 3 -- " $f " ) && rm -f -- " $f " ; done
# also messy because osx support
find -type f -exec $md5sum '{}' \+ |
sed -r 's/(.{32})(.*)/\2\1/' | LC_COLLATE = c sort |
sed -r 's/(.*)(.{32})/\2\1/' |
sed -r 's/^(.{32}) \./\1 ./' > ../.sums.md5
2019-06-01 15:55:21 +00:00
mv ../.sums.md5 .
cd ..
2020-05-06 01:02:28 +02:00
pwd
echo ">>> tar" ; tar -czf " $tgz_path " --owner= 1000 --group= 1000 --numeric-owner " copyparty- $ver "
echo ">>> zip" ; zip -qr " $zip_path " " copyparty- $ver "
2019-06-01 15:55:21 +00:00
rm -rf " $tmp "
echo
echo "done:"
echo " $zip_path "
echo " $tgz_path "
echo
2021-09-07 23:18:54 +02:00
# function alr() { ls -alR copyparty-$1 | sed -r "s/copyparty-$1/copyparty/" | sed -r 's/[A-Z][a-z]{2} [0-9 ]{2} [0-9]{2}:[0-9]{2}//' > $1; }; for x in hovudstraum rls src ; do alr $x; done
2019-06-01 15:55:21 +00:00