Skip to content

Commit 1ccb2b6

Browse files
committed
fix basic errors, add pkglint check, introduce cleanup() function
1 parent 7517863 commit 1ccb2b6

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

platform/solaris/ips/create.sh

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,21 @@ then
146146
exit 1
147147
fi
148148

149+
cleanup()
150+
{
151+
rm -rf "$PKG_REPO_NAME"
152+
if [[ -n $manifest ]]; then
153+
rm -f "$manifest"
154+
fi
155+
}
156+
149157
PKG()
150158
{
151159
"$@"
152160
if [ $? != 0 ]
153161
then
154162
echo Command failed: "$@"
155-
rm -rf "$PKG_REPO_NAME"
163+
cleanup
156164
exit 1
157165
fi
158166
}
@@ -169,7 +177,7 @@ eval `pkgsend open ${PKG_NAME}@${version}`
169177
if [ $? != 0 ]
170178
then
171179
echo "Fatal: could not open ${PKG_NAME}@${version}"
172-
rm -rf "$PKR_REPO_NAME"
180+
cleanup
173181
exit 1
174182
fi
175183

@@ -244,12 +252,22 @@ PKG pkgsend add depend fmri=pkg:/web/java-servlet/tomcat-8 type=require
244252

245253
PKG pkgsend add file dist/source.war mode=0444 owner=webservd group=webservd path=/usr/opengrok/lib/source.war
246254

247-
PKG pkgsend add set name=description value="OpenGrok - wicked fast source browser"
255+
PKG pkgsend add set name=pkg.description value="OpenGrok - complete install"
256+
PKG pkgsend add set name=pkg.summary value="OpenGrok - wicked fast source browser"
248257
PKG pkgsend add set name=pkg.human-version value="${human_readable_version}"
249258
PKG pkgsend close
250259

251260
PKG pkgrepo -s "$PKG_REPO_NAME" verify
252261

262+
manifest=$( mktemp /tmp/manifest.XXXXXX )
263+
if [[ -z $manifest ]]; then
264+
echo "cannot create temporary file for package manifest"
265+
cleanup
266+
exit 1
267+
fi
268+
PKG pkgrepo -s "$PKG_REPO_NAME" contents ${PKG_NAME} > $manifest
269+
PKG pkglint $manifest
270+
253271
# checks whether the same file exists and updates it
254272
if [ -f "${PKG_NAME}-${human_readable_version}.p5p" ]
255273
then
@@ -263,7 +281,7 @@ PKG pkgrecv -s "$PKG_REPO_NAME" -a -d "${outfile}" ${PKG_NAME}
263281
# cleanup
264282
if [ -d "$PKG_REPO_NAME" ]
265283
then
266-
rm -rf "$PKG_REPO_NAME"
284+
cleanup
267285
fi
268286

269287
unset PKG_REPO

0 commit comments

Comments
 (0)