-
Notifications
You must be signed in to change notification settings - Fork 75
/
.newversion
executable file
·31 lines (27 loc) · 1 KB
/
.newversion
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
#!/bin/bash
version=$1
schema=$2
if [ -z "$version" ] || [ -z "$schema" ];then
echo "Need a version and a schema version"
exit 1
fi
if ! echo $version | grep -q -E "^[0-9]+\.[0-9]+\.[0-9]+$";then
echo "NOT A VERSION ! ... abort"
exit 1
fi
if ! echo $schema | grep -q -E "^[0-9]+\.[0-9]$";then
echo "NOT A SCHEMA VERSION ! ... abort"
exit 1
fi
# code version update
cat modules/KIWIGlobals.pm | sed \
-e s"@\$data{Version} = \".*\"@\$data\{Version\} = \"$version\"@" \
> modules/KIWIGlobals.pm.new && mv modules/KIWIGlobals.pm.new modules/KIWIGlobals.pm && chmod 644 modules/KIWIGlobals.pm
# spec file version update
cat rpm/kiwi.spec | sed \
-e "0,/Version: .*/{s/Version: .*/Version: $version/}" \
-e s"/kiwi-schema = .*/kiwi-schema = $schema/" \
-e s"@kiwi (Version .*@kiwi (Version $version)@" \
> rpm/kiwi.spec.new && mv rpm/kiwi.spec.new rpm/kiwi.spec
echo "update to version: ${version}... done"
echo "update to schema: ${schema}... done"