2015-01-27 16:28:09 -05:00
|
|
|
#
|
|
|
|
|
# Licensed under the GNU General Public License Version 2
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
command_not_found_handle () {
|
|
|
|
|
local runcnf=1
|
|
|
|
|
local retval=127
|
|
|
|
|
|
|
|
|
|
[ -f /etc/sysconfig/atomic ] && . /etc/sysconfig/atomic
|
|
|
|
|
|
|
|
|
|
# only search for the command if we're interactive
|
|
|
|
|
[[ $- =~ i ]] || runcnf=0
|
|
|
|
|
|
|
|
|
|
# don't run if not on an atomic host or tools
|
|
|
|
|
([ -n "${TOOLSIMG}" ] && [ -f /run/ostree-booted ] && [ -x /usr/bin/atomic ]) || runcnf=0
|
|
|
|
|
|
|
|
|
|
# run the command, or just print a warning
|
|
|
|
|
if [ $runcnf -eq 1 ]; then
|
2015-07-16 12:32:35 -04:00
|
|
|
echo "Redirecting to container ${TOOLSIMG}..."
|
2015-07-16 12:00:01 -04:00
|
|
|
atomic run ${TOOLSIMG} "$@"
|
2015-01-27 16:28:09 -05:00
|
|
|
retval=$?
|
|
|
|
|
else
|
|
|
|
|
echo "bash: $1: command not found"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# return success or failure
|
|
|
|
|
return $retval
|
|
|
|
|
}
|
|
|
|
|
|