forked from Eugeny/ajenti-v
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpm.sh
executable file
·79 lines (57 loc) · 1.46 KB
/
rpm.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
#!/bin/bash
PLUGIN=$1
. $PLUGIN/package.desc
BUILDDIR=build
DISTDIR=dist
PLUGINDIR=/var/lib/ajenti/plugins
SPEC=./$PACKAGE.spec
echo Building package $PACKAGE
rm -rf $BUILDDIR > /dev/null
mkdir $DISTDIR $BUILDDIR 2> /dev/null
ACTUAL_RPM_BUILD_ROOT=$BUILDDIR/BUILDROOT/$PACKAGE-$VERSION-1.x86_64
cat > $SPEC <<END
%define name $PACKAGE
%define version $VERSION
%define unmangled_version $VERSION
%define release 1
Summary: $DESCRIPTION
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{name}-%{version}.tar.gz
License: AGPLv3
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Vendor: Eugene Pankov <[email protected]>
Url: http://ajenti.org/
requires: $RPM_DEPENDS
provides: $PROVIDES
%description
$DESCRIPTION
%prep
%setup -n %{name}-%{unmangled_version} -n %{name}-%{unmangled_version}
%build
%install
mkdir ../../../$ACTUAL_RPM_BUILD_ROOT
cp -r var ../../../$ACTUAL_RPM_BUILD_ROOT
%clean
rm -rf ../../../$ACTUAL_RPM_BUILD_ROOT
%files
/var
%post
$POSTINST
END
mkdir -p $BUILDDIR/SOURCES
mkdir -p $BUILDDIR/BUILD
mkdir -p $BUILDDIR/$PACKAGE-$VERSION/$PLUGINDIR
cp -rv $PLUGIN $BUILDDIR/$PACKAGE-$VERSION/$PLUGINDIR
TGZ=$PACKAGE-$VERSION.tar.gz
RPMTOPDIR=`realpath $BUILDDIR`
cd $BUILDDIR && tar czf ../$TGZ $PACKAGE-$VERSION && cd ..
rm -r $BUILDDIR/$PACKAGE-$VERSION
mv $TGZ $BUILDDIR/SOURCES
rpmbuild --define "_topdir $RPMTOPDIR" -ba $SPEC
mv $BUILDDIR/RPMS/*/*.rpm dist/
rm $SPEC