Skip to content

Commit

Permalink
build/common: disable apt-get and yum outside of build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericlepied committed Feb 12, 2014
1 parent e321b8d commit 3b65639
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions build/common
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,14 @@ cleanup() {
# Let's remove any trace of a rhn configuration
unregister_rhn $DIST $dir

# Let's disable apt-get and yum for normal usage
for pkgmngr in apt-get yum; do
if [ -f ${dir}/usr/bin/${pkgmngr} ]; then
mv -f ${dir}/usr/bin/${pkgmngr} -f ${dir}/usr/bin/${pkgmngr}.moved
ln -s /bin/true ${dir}/usr/bin/${pkgmngr}
fi
done

if [ "$ret" = "0" ]; then
if [ -z "$STRIPPED_TARGET" ]; then
clear_packages_cache $dir
Expand Down Expand Up @@ -363,4 +371,11 @@ common_setup() {
echo 'exit 0' > "${dir}"/etc/default/grub.d/edeploy.cfg

add_rhn_repository $DIST $dir

# let apt-get and yum work in build scripts
for pkgmngr in apt-get yum; do
if [ -f ${dir}/usr/bin/${pkgmngr}.moved ]; then
mv -f ${dir}/usr/bin/${pkgmngr}.moved ${dir}/usr/bin/${pkgmngr}
fi
done
}

1 comment on commit 3b65639

@ghantoos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @fredericlepied. I'm thinking that if a user is in debug mode (when building a role), it could still be very useful to have these commands available. The user could do a "mv {moved,}". But may be should we add a flag that we can force some {packages, settings, other} when building a role in debug mode?

Not sure if this usage is considered "outside of build scripts" though.

Please sign in to comment.