A new user interface for you! Read more...

File macros.crowbar of Package crowbar

%crowbar_base /opt/dell
%crowbar_bin %{crowbar_base}/bin
%crowbar_bc_install %{crowbar_bin}/barclamp_install.rb
%crowbar_bc_uninstall %{crowbar_bin}/barclamp_uninstall.rb
%crowbar_branding_install %{crowbar_bin}/branding_install.rb
%crowbar_branch_version 3.0

%crowbar_ruby21 0%{?suse_version} == 1110 || 0%{?suse_version} == 1310

%crowbar_component_prep_end()                                                  \
# Since we apply without fuzz, we don't care about .orig files; drop them      \
# because of how we package (cp -a)                                            \
find . -name "*.orig" -delete -print                                           \
# Move to use the right ruby version                                           \
%if %{crowbar_ruby21}                                                          \
  crowbar_ruby_bin=ruby.ruby2.1                                                \
%else                                                                          \
  crowbar_ruby_bin=ruby                                                        \
%endif                                                                         \
if [ -d bin ]; then                                                            \
  perl -p -i -e "s|#!/usr/bin/env\ ruby|#!/usr/bin/env\ ${crowbar_ruby_bin}|s" bin/*        \
  perl -p -i -e "s|#!/usr/bin/ruby|#!/usr/bin/env\ ${crowbar_ruby_bin}|s" bin/*             \
fi                                                                             \
%{nil}

%crowbar_component_build()                                                       \
if ls *.yml &> /dev/null; then                                                   \
  mkdir -p crowbar_framework/barclamps/                                          \
  mv *.yml crowbar_framework/barclamps/                                          \
fi                                                                               \
                                                                                 \
if [ -f Rakefile ] && grep -q Sprockets::Standalone::RakeTask Rakefile; then     \
  PACKAGING=yes rake assets:compile                                              \
                                                                                 \
  if [ -f crowbar_framework/public/assets/manifest.json ]; then                  \
    mkdir -p crowbar_framework/barclamps/manifests/                              \
    mv crowbar_framework/public/assets/manifest.json crowbar_framework/barclamps/manifests/%1.json \
  fi                                                                             \
fi                                                                               \
%{nil}

%crowbar_component_install()                                                    \
install -d -m 755 %{buildroot}%{crowbar_base}/barclamps/%1                      \
cp -a * %{buildroot}%{crowbar_base}/barclamps/%1                                \
for subdir in bin chef crowbar_framework; do                                    \
  test -d %{buildroot}%{crowbar_base}/barclamps/%1/$subdir || continue          \
  rsync -auP %{buildroot}%{crowbar_base}/barclamps/%1/$subdir %{buildroot}%{crowbar_base}               \
  rm -rf %{buildroot}%{crowbar_base}/barclamps/%1/$subdir                       \
done                                                                            \
                                                                                \
for file in Gemfile Rakefile Rakefile.rpmbuild; do                              \
  test -f %{buildroot}%{crowbar_base}/barclamps/%1/$file || continue            \
  rm -f %{buildroot}%{crowbar_base}/barclamps/%1/$file                          \
done                                                                            \
                                                                                \
for subdir in configs spec; do                                                  \
  test -d %{buildroot}%{crowbar_base}/barclamps/%1/$subdir || continue          \
  rm -rf %{buildroot}%{crowbar_base}/barclamps/%1/$subdir                       \
done                                                                            \
                                                                                \
%fdupes %{buildroot}%{crowbar_base}                                             \
                                                                                \
if [[ -d %{buildroot}%{crowbar_bin} ]]; then                                    \
  chmod a+x %{buildroot}%{crowbar_bin}/*                                        \
fi                                                                              \
                                                                                \
if [[ -d %{buildroot}%{crowbar_base}/crowbar_framework/bin ]]; then             \
  chmod a+x %{buildroot}%{crowbar_base}/crowbar_framework/bin/*                 \
fi                                                                              \
%{nil}

# pre/post/preun/postun macros all take one argument,
# the barclamp path e.g.:
#   %crowbar_barclamp_update_pre /opt/dell/barclamps/provisioner

%crowbar_component_update_pre()                                                 \
true                                                                            \
%{nil}

%crowbar_component_update_post()                                                \
if [ -x %{crowbar_bc_install} ]; then                                           \
        OUTPUT=$(%{crowbar_bc_install} --rpm %1 2>&1)                           \
        if [ $? -ne 0 ]; then                                                   \
                echo $OUTPUT                                                    \
                exit 1                                                          \
        fi                                                                      \
fi                                                                              \
if service crowbar status >/dev/null 2>&1; then                                 \
        service crowbar restart >/dev/null || :                                  \
fi                                                                              \
%{nil}

# We only attempt to call barclamp_uninstall if it's really an
# uninstall (not an upgrade)
%crowbar_component_update_preun()                                               \
if [ "$1" = "0" ]; then                                                         \
        if [ -x %{crowbar_bc_uninstall} ]; then                                 \
                OUTPUT=$(%{crowbar_bc_uninstall} --rpm %1 2>&1)                 \
                if [ $? -ne 0 ]; then                                           \
                        echo $OUTPUT                                            \
                        exit 1                                                  \
                fi                                                              \
        fi                                                                      \
fi                                                                              \
%{nil}

# We only restart crowbar on an uninstall (on upgrade it'll happen
# in %post)
%crowbar_component_update_postun()                                             \
if [ "$1" = "0" ]; then                                                        \
        if service crowbar status >/dev/null 2>&1; then                        \
                service crowbar restart >/dev/null || :                         \
        fi                                                                     \
fi                                                                             \
%{nil}

%crowbar_branding_post()                                                        \
if [ -x %{crowbar_branding_install} ]; then                                     \
        OUTPUT=$(%{crowbar_branding_install} 2>&1)                              \
        if [ $? -ne 0 ]; then                                                   \
                echo $OUTPUT                                                    \
        fi                                                                      \
fi                                                                              \
if service crowbar status >/dev/null 2>&1; then                                 \
        service crowbar restart >/dev/null || :                                  \
fi                                                                              \
%{nil}