-
Notifications
You must be signed in to change notification settings - Fork 5
/
pkg-redirect-ubuntu-server-dev-project
executable file
·46 lines (40 loc) · 1.21 KB
/
pkg-redirect-ubuntu-server-dev-project
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
#!/bin/bash
#
# Remove all code from lp:~ubuntu-server-dev project and add README to
# redirect to lp:~ubuntu-openstack-dev.
#
# Example: pkg-redirect-ubuntu-server-dev-project cinder
#
set -ex
if [ $# -ne 1 ]; then
echo "Usage: $0 package"
echo " $0 cinder"
exit
fi
package=$1
basepath=$(pwd)
branches="master stable/liberty stable/mitaka stable/newton stable/ocata stable/pike stable/queens stable/rocky stable/stein stable/train stable/ussuri"
cat > /tmp/README.md << EOF
MOVED. This repository has moved to https://code.launchpad.net/~ubuntu-openstack-dev/ubuntu/+source/${package}/+git/${package}.
EOF
cat > /tmp/commit-message.txt << EOF
Cleanup moved repository
This repository has moved to https://code.launchpad.net/~ubuntu-openstack-dev/ubuntu/+source/${package}/+git/${package}.
EOF
git clone lp:~ubuntu-server-dev/ubuntu/+source/$package
cd $package
for branch in $branches; do
set +e
git checkout $branch
if [[ "$?" == "0" ]]; then
set -e
find . -maxdepth 1 ! -name '.git' ! -name '.' ! -name '..' -exec rm -rf {} +
cp /tmp/README.md .
git add README.md
git commit -a -F /tmp/commit-message.txt
fi
set -e
done
git checkout master
git push --all
cd $basepath