-
Notifications
You must be signed in to change notification settings - Fork 0
/
config_manifest.sh
102 lines (88 loc) · 2.55 KB
/
config_manifest.sh
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
#!/bin/sh
PKG_DESC=
PKG_LONG_DESC=
PKG_AUTHOR=
PKG_EMAIL=
PKG_URL=
PKG_SCM=
PKG_SCM_URL=
# TODO
PKG_LICENSE=
PKG_LOGO_URL=
PKG_DEPENDENCIES=
PKG_CFLAGS=
PKG_LFLAGS=
# File storing the package information
MANIFEST="manifest.xml"
echo "------------------------------------------"
echo "We require some information to update the $MANIFEST"
echo "------------------------------------------"
echo "Brief package description (Press ENTER when finished):"
read PKG_DESC
echo "Long description: "
read PKG_LONG_DESC
# REMOVE http:// since it is a bit messy to pass it through shell expansion
PKG_LONG_DESC=`echo $PKG_LONG_DESC | sed 's/http:\/\///g'`
echo "Author: "
read PKG_AUTHOR
echo "Author email: "
read PKG_EMAIL
echo "Url (optional):"
read PKG_URL
# REMOVE http:// since it is a bit messy to pass it through shell expansion
PKG_URL=`echo $PKG_URL | sed 's/http:\/\///g'`
# Yes, we only support git as SCM
PKG_SCM="git"
echo "Enter your dependencies as a comma separated list. Press ENTER when finished:"
read PKG_DEPENDENCIES
# But if there is svn or mercurial support ever
# we can already prompt the user ;)
#echo "Version control system [git|svn|mercurial]: "
#echo 1: git
#echo 2: svn
#echo 3: mercury
#while [ 1 ]
# do
# echo "Select from list:"
# read PKG_SCM
# case $PKG_SCM in
# 1) PKG_SCM="git"
# break
# ;;
# 2) PKG_SCM="svn"
# break
# ;;
# 3) PKG_SCM="mercury"
# break
# ;;
# esac
#done
if test -e CMakeLists.txt; then
sed -i "s#\(PROJECT_DESCRIPTION\ \).*#\1\"$PKG_DESC\")#" CMakeLists.txt
fi
if test -e README.md; then
sed -i "s#dummy-brief-desc#$PKG_DESC#" README.md
sed -i "s#dummy-long-desc#$PKG_LONG_DESC#" README.md
fi
sed -i "s#dummy-brief-desc#$PKG_DESC#" $MANIFEST
sed -i "s#dummy-long-desc#$PKG_LONG_DESC#" $MANIFEST
sed -i "s#dummy-author#$PKG_AUTHOR#" $MANIFEST
sed -i "s#dummy-email#$PKG_EMAIL#" $MANIFEST
sed -i "s#dummy-url#http://$PKG_URL#" $MANIFEST
sed -i "s#dummy-version-control#$PKG_SCM#" $MANIFEST
sed -i "s#dummy-version-control-url#$PKG_SCM_URL#" $MANIFEST
sed -i "s#dummy-license#$PKG_LICENSE#" $MANIFEST
sed -i "s#dummy-logo-url#http://$PKG_LOGO_URL#" $MANIFEST
# Enter list of dependencies if there are any
if [ "$PKG_DEPENDENCIES" != "" ]
then
# Replace comma ','
PKG_DEPENDENCIES=`echo $PKG_DEPENDENCIES | sed "s/,/ /g"`
for dep in ${PKG_DEPENDENCIES}
do
# Use the </package> as a hook to place <depend package="pkg">
sed -i "s#</package># <depend package=\"${dep}\"\ />\n</package>#" $MANIFEST
done
fi
sed -i "s#dummy-cflags#$PKG_CFLAGS#" $MANIFEST
sed -i "s#dummy-lflags#$PKG_LFLAGS#" $MANIFEST