diff --git a/makerpm b/makerpm index 1e874662f..8ed19bf24 100755 --- a/makerpm +++ b/makerpm @@ -13,7 +13,6 @@ function xcat_probe_copy { # xCAT-probe uses some functions shipped with xCAT, copying for the following reasons: # 1. make xCAT-probe code be self-contained # 2. do not maintain two files for each script - # 3. symbolic link can't work during packaging RPMNAME=${1} if [ $RPMNAME = "xCAT-probe" ]; then mkdir -p ${RPMNAME}/lib/perl/xCAT/ diff --git a/xCAT-probe/subcmds/switch_macmap b/xCAT-probe/subcmds/switch_macmap index 2b4757177..ef4db81bc 100755 --- a/xCAT-probe/subcmds/switch_macmap +++ b/xCAT-probe/subcmds/switch_macmap @@ -53,13 +53,6 @@ if ($help) { exit 0; } -if (!-d "$currdir/bin") { - mkpath("$currdir/bin/"); -} -if (!-e "$currdir/bin/switchprobe") { - link("$::XCATROOT/bin/xcatclient", "$currdir/bin/switchprobe"); -} - if ($test) { `$currdir/bin/switchprobe -h`; if ($?) { diff --git a/xCAT-probe/xCAT-probe.spec b/xCAT-probe/xCAT-probe.spec index c46700694..d2cd0243f 100644 --- a/xCAT-probe/xCAT-probe.spec +++ b/xCAT-probe/xCAT-probe.spec @@ -61,5 +61,18 @@ rm -rf $RPM_BUILD_ROOT - "Create xCAT probe package" %post +if [ -e %{prefix}/probe/subcmds/bin/switchprobe ]; then + rm -rf %{prefix}/probe/subcmds/bin/switchprobe +else + mkdir -p %{prefix}/probe/subcmds/bin/ +fi +cd %{prefix}/probe/subcmds/bin/ +if [ -e %{prefix}/bin/xcatclient ]; then + ln -s %{prefix}/bin/xcatclient switchprobe +fi %preun +#remove the bin directory if not on upgrade +if [ "$1" != "1" ]; then + rm -rf %{prefix}/probe/subcmds/bin/ +fi