Skip to content

Commit

Permalink
Allow other client interpreters.
Browse files Browse the repository at this point in the history
Before this commit yast2 call only y2base that can call only yast clients.
This commit adds ability to detect also other formats and call their client provider.
For now added only support for rb files with its r2d2base interpret.
  • Loading branch information
jreidinger committed Mar 4, 2013
1 parent e3260d9 commit 80160b6
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripts/yast2
Expand Up @@ -421,7 +421,17 @@ else
snapshot_pre $module
# break out on errors, #343258
while [ $exit_code = 0 ]; do
$ybindir/y2base $module "$@" "$SELECTED_GUI" $Y2_GEOMETRY $Y2UI_ARGS
client=$(find_client "$module")
case $client in
*.ycp)
$ybindir/y2base $client "$@" "$SELECTED_GUI" $Y2_GEOMETRY $Y2UI_ARGS
;;
*.rb)
echo $ybindir/r2d2base $client "$@" "$SELECTED_GUI" $Y2_GEOMETRY $Y2UI_ARGS
;;
*)
echo "client '$client' not found" && exit 1
esac
exit_code=$?
if [ -z "$REDO_FILE" -o ! -f "$REDO_FILE" ]; then
break
Expand Down
34 changes: 34 additions & 0 deletions scripts/yast2-funcs
Expand Up @@ -148,6 +148,40 @@ function clr_inst_gtk_env()
:
}

function find_client()
{
local CLIENT_NAME="$1"
#now recognized client suffix, order is preference
local SUFFIX_ARRAY=('.ycp' '.rb')
#client can be in these location. order set preferences
local LOCATION_ARRAY=('/y2update')
IFS=':' read -a y2dir <<< "$Y2DIR"
for dir in "${y2dir[@]}"
do
LOCATION_ARRAY+=("$dir")
done
if [ -n "$HOME" ]
then
LOCATION_ARRAY+=("$HOME/.yast2")
fi
# NOTE cannot use compile option YAST2DIR so expand it to production version
LOCATION_ARRAY+=("/usr/share/YaST2/")

for location in "${LOCATION_ARRAY[@]}"
do
for suffix in "${SUFFIX_ARRAY[@]}"
do
local result="${location}/clients/${CLIENT_NAME}${suffix}"
echo $result 1>&2
if [ -e $result ]
then
echo $result
return
fi
done
done
}


### Local Variables: ***
### mode: shell-script ***
Expand Down

0 comments on commit 80160b6

Please sign in to comment.