File otc-tools.spec of Package otc-tools
Name: otc-tools
Version: 0.8.34
Release: 1
#URL: https://obs.otc.t-systems.com/otccli/otc_java_with_shellscript.zip
URL: https://github.com/OpenTelekomCloud/otc-tools/
Source0: %{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Autoreqprov: on
Requires: curl
Requires: jq
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
BuildRequires: jq
%if 0%{?suse_version} > 0
Recommends: libs3-4
%endif
%if 0%{?rhel_version} == 600 || 0%{?centos_version} == 600 || 0%{?fedora_version} > 15
BuildRequires: libonig2
%endif
Summary: Simple shell tool to access the OTC APIs
Group: Networking/Utilities
BuildArch: noarch
License: CC-BY-SA-4.0
#License: Apache-2.0
%description
This is a shell script that uses curl and jq to talk to the
Open Telekom Cloud APIs (OpenStack and OTC specific APIs).
It's a nice demonstrator to see how the API works and allows
for testing and simple automation. It's not recommended for
productive use.
For more advanced usage, we recommend the native OpenStack
CLI tools and the -otcextensions.
Authors: Zsolt Nagy, Kurt Garloff, Christian Kortwich
%prep
%setup
%build
mv .otc_env.sh otc_env.sh
#echo "Nothing to do ..."
%install
install -d $RPM_BUILD_ROOT/usr/bin
install -m 0755 otc.sh $RPM_BUILD_ROOT/usr/bin/otc.sh
install -m 0755 ssh_otc.sh $RPM_BUILD_ROOT/usr/bin/
install -m 0755 scp_otc.sh $RPM_BUILD_ROOT/usr/bin/
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -s -f /usr/bin/otc.sh %{buildroot}%{_sysconfdir}/alternatives/otc
ln -s -f %{_sysconfdir}/alternatives/otc %{buildroot}%{_bindir}/otc
%clean
rm -rf $RPM_BUILD_ROOT
%post
%if 0%{?suse_version} > 1140
%{_sbindir}/update-alternatives --force --install /usr/bin/otc \
otc /usr/bin/otc.sh 15
%else
%{_sbindir}/update-alternatives --install /usr/bin/otc \
otc /usr/bin/otc.sh 15
%endif
%preun
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove otc /usr/bin/otc.sh
fi
%files
%defattr(-,root,root,-)
%doc otc_env.sh README imagesflavorsloop_tscom.sh
/usr/bin/otc.sh
/usr/bin/ssh_otc.sh
/usr/bin/scp_otc.sh
%ghost /usr/bin/otc
%ghost %{_sysconfdir}/alternatives/otc
%changelog
* Sun Mar 13 2016 - Kurt Garloff <kurt@garloff.de>
- Package creation.