test/zip.spec
author J. Ali Harlow <ali@juiblex.co.uk>
Thu May 14 05:55:19 2009 +0100 (2009-05-14)
changeset 367 e45f50e940b6
parent 351 48b0adfe3059
child 369 f8c27fe9fe63
permissions -rw-r--r--
Order the installation and removal of packages correctly so scripts can run
     1 Name:      zip
     2 Summary:   Test package
     3 Group:     Test
     4 License:   GPL
     5 Version:   1
     6 Release:   1
     7 Source:    zip.tar
     8 BuildArch: noarch
     9 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
    10 Prefix:    /usr
    11 Requires:  zap
    12 
    13 %description
    14 Test package
    15 
    16 %prep
    17 
    18 %build
    19 
    20 %install
    21 mkdir -p $RPM_BUILD_ROOT/usr/bin
    22 touch $RPM_BUILD_ROOT/usr/bin/zip
    23 
    24 %clean
    25 
    26 %pre -p <lua>
    27 function mkdir_missing(dir)
    28     if posix.stat(dir)==nil then
    29 	posix.mkdir(dir)
    30     end
    31 end
    32 prefix=posix.getenv("RPM_INSTALL_PREFIX0")
    33 if prefix==nil then
    34     prefix="/usr"
    35 end
    36 if posix.stat(prefix.."/bin/zap")~=nil then
    37     mkdir_missing(prefix.."/var")
    38     mkdir_missing(prefix.."/var/lib")
    39     posix.mkdir(prefix.."/var/lib/zip")
    40     io.output(prefix.."/var/lib/zip/data.zap")
    41     io.write("Important data\n");
    42     io.close()
    43 end
    44 
    45 %postun -p <lua>
    46 print("zip: postun script\n");
    47 prefix=posix.getenv("RPM_INSTALL_PREFIX0")
    48 if prefix==nil then
    49     prefix="/usr"
    50 end
    51 if posix.stat(prefix.."/bin/zap")~=nil then
    52     os.remove(prefix.."/var/lib/zip/data.zap")
    53     os.remove(prefix.."/var/lib/zip")
    54 end
    55 
    56 %files
    57 /usr/bin/zip