Skip to content
Snippets Groups Projects
Select Git revision
  • 680835542d82e5ef5f9376973ac5358fc8774a26
  • master default protected
2 results

make.sh

Blame
  • Pavel Vondska's avatar
    Pavel Vondruška authored
    68083554
    History
    make.sh 2.75 KiB
    #!/bin/bash -x
    
    apt update -qqq
    apt install gcc python-dev virtualenv libkrb5-dev curl patch --no-install-recommends -qqq
    virtualenv /opt/swiftclient
    source /opt/swiftclient/bin/activate
    pip install python-swiftclient requests-kerberos
    
    curl https://github.com/openstack/python-swiftclient/commit/3e248bc679fa5ec6825d534c1afc9b2966e238f5.patch | patch -f -p1 -d /opt/swiftclient/lib/python2.7/site-packages/
    
    VER=`pip list --format=legacy | grep -Po "python-swiftclient \(\K[\d\.]+"`
    SIZE=`du -ks /opt/swiftclient | cut -f1`
    WORKDIR=python-swiftclient-kerberos
    
    mkdir -p $WORKDIR/DEBIAN
    mkdir -p $WORKDIR/usr/bin
    mv /opt $WORKDIR
    
    cat > $WORKDIR/DEBIAN/control <<EOF
    Package: python-swiftclient-kerberos
    Version: ${VER}-1+deb9+dex1
    Architecture: all
    Maintainer: Pavel Vondruska <vondruska@cesnet.cz>
    Installed-Size: $SIZE
    Depends: python | python2.7 | python3
    Replaces: swift (<< 1.6.0)
    Conflicts: python-swiftclient, python3-swiftclient
    Section: python
    Priority: extra
    Homepage: https://github.com/openstack/python-swiftclient
    Description: Client library for Openstack Swift API
     OpenStack Object Storage (code-named Swift) creates redundant, scalable object
     storage using clusters of standardized servers to store petabytes of
     accessible data. It is not a file system or real-time data storage system, but
     rather a long-term storage system for a more permanent type of static data
     that can be retrieved, leveraged, and then updated if necessary. Primary
     examples of data that best fit this type of storage model are virtual machine
     images, photo storage, email storage and backup archiving. Having no central
     "brain" or master point of control provides greater scalability, redundancy
     and permanence.
     .
     Objects are written to multiple hardware devices in the data center, with
     the OpenStack software responsible for ensuring data replication and
     integrity across the cluster. Storage clusters can scale horizontally by
     adding new nodes. Should a node fail, OpenStack works to replicate its
     content from other active nodes. Because OpenStack uses software logic to
     ensure data replication and distribution across different devices,
     inexpensive commodity hard drives and servers can be used in lieu of more
     expensive equipment.
     .
     This package provides a client for the OpenStack Swift API. There's a Python
     API  (the "swiftclient" module), and a command-line script ("swift").
     .
     This package contains patch for Kerberos authentication.
    EOF
    
    
    cat > $WORKDIR/usr/bin/swift <<EOSWIFT
    #!/bin/bash
    
    if [ "\$ST_KRB" == 1 ]; then
        export ST_USER=user
        export ST_KEY=key
        SWIFTARGS=--kerberos
    fi
    
    source /opt/swiftclient/bin/activate
    swift \$SWIFTARGS \$*
    EOSWIFT
    
    chmod +x $WORKDIR/usr/bin/swift
    
    dpkg-deb -b $WORKDIR python-swiftclient-kerberos_${VER}-1+dex1.deb
    
    mkdir build
    mv *.deb build/