Commit 93e72c71 authored by Mark Olesen's avatar Mark Olesen

Renamed and adjusted as openfoam-selector, openfoam-selector-menu

- the registered OpenFOAM versions are to have functioning
  etc/bashrc, etc/cshrc files
parent d1d60089
......@@ -2,18 +2,18 @@
EXTRA_DIST = README LICENSE
nodist_bin_SCRIPTS = mpi-selector
dist_bin_SCRIPTS = mpi-selector-menu
nodist_bin_SCRIPTS = openfoam-selector
dist_bin_SCRIPTS = openfoam-selector-menu
shell_startupdir = @MPI_SELECTOR_SHELL_STARTUP_DIR@
shell_startup_SCRIPTS = mpi-selector.sh mpi-selector.csh
shell_startupdir = @OPENFOAM_SELECTOR_SHELL_STARTUP_DIR@
shell_startup_SCRIPTS = openfoam-selector.sh openfoam-selector.csh
man_MANS = mpi-selector.1 mpi-selector-menu.1
man_MANS = openfoam-selector.1 openfoam-selector-menu.1
CLEANFILES = $(bin_scripts) $(man_MANS)
mpi-selector.1: mpi-selector
pod2man --section=1 --center="User Commands" --release="$(VERSION)" --date="$(MAN_DATE)" --name=mpi-selector mpi-selector > mpi-selector.1
openfoam-selector.1: openfoam-selector
pod2man --section=1 --center="User Commands" --release="$(VERSION)" --date="$(MAN_DATE)" --name=openfoam-selector openfoam-selector > openfoam-selector.1
mpi-selector-menu.1: mpi-selector-menu
pod2man --section=1 --center="User Commands" --release="$(VERSION)" --date="$(MAN_DATE)" --name=mpi-selector-menu mpi-selector-menu > mpi-selector-menu.1
openfoam-selector-menu.1: openfoam-selector-menu
pod2man --section=1 --center="User Commands" --release="$(VERSION)" --date="$(MAN_DATE)" --name=openfoam-selector-menu openfoam-selector-menu > openfoam-selector-menu.1
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2,9 +2,9 @@
# Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
# Startup
AC_INIT([mpi-selector],
AC_INIT([openfoam-selector],
[m4_normalize(esyscmd([cat VERSION]))],
[], [mpi-selector])
[], [openfoam-selector])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
# Setup some directory names and filenames that are common across all
......@@ -19,35 +19,33 @@ AC_ARG_WITH([shell-startup-dir],
AC_HELP_STRING([--with-shell-startup-dir=<dir>],
[Directory where shell startup files are installed (default: $pkgdatadir)]))
if test "$with_shell_startup_dir" == ""; then
MPI_SELECTOR_SHELL_STARTUP_DIR='$(pkgdatadir)'
OPENFOAM_SELECTOR_SHELL_STARTUP_DIR='$(pkgdatadir)'
else
MPI_SELECTOR_SHELL_STARTUP_DIR=$with_shell_startup_dir
OPENFOAM_SELECTOR_SHELL_STARTUP_DIR=$with_shell_startup_dir
fi
AC_SUBST(MPI_SELECTOR_SHELL_STARTUP_DIR)
AC_MSG_RESULT([$MPI_SELECTOR_SHELL_STARTUP_DIR])
AC_SUBST(OPENFOAM_SELECTOR_SHELL_STARTUP_DIR)
AC_MSG_RESULT([$OPENFOAM_SELECTOR_SHELL_STARTUP_DIR])
AC_MSG_CHECKING([repository directory])
localstatedir_save="$localstatedir"
eval localstatedir="$localstatedir"
eval MPI_SELECTOR_DATADIR="$localstatedir/mpi-selector/data"
AC_SUBST(MPI_SELECTOR_DATADIR)
eval OPENFOAM_SELECTOR_DATADIR="$localstatedir/openfoam-selector/data"
AC_SUBST(OPENFOAM_SELECTOR_DATADIR)
localstatedir="$localstatedir_save"
AC_MSG_RESULT([$MPI_SELECTOR_DATADIR])
AC_MSG_RESULT([$OPENFOAM_SELECTOR_DATADIR])
AC_MSG_CHECKING([system configuration directory])
sysconfdir_save="$sysconfdir"
eval sysconfdir="$sysconfdir"
eval MPI_SELECTOR_SYSCONFDIR="$sysconfdir/sysconfig"
AC_SUBST(MPI_SELECTOR_SYSCONFDIR)
eval OPENFOAM_SELECTOR_SYSCONFDIR="$sysconfdir/sysconfig"
AC_SUBST(OPENFOAM_SELECTOR_SYSCONFDIR)
sysconfdir="$sysconfdir_save"
AC_MSG_RESULT([$MPI_SELECTOR_SYSCONFDIR])
AC_MSG_RESULT([$OPENFOAM_SELECTOR_SYSCONFDIR])
MPI_SELECTOR_SYSCONFIG_FILE="mpi-selector"
MPI_SELECTOR_HOME_FILE=".mpi-selector"
MPI_SELECTOR_MPIVARS_BASENAME="mpivars"
AC_SUBST(MPI_SELECTOR_SYSCONFIG_FILE)
AC_SUBST(MPI_SELECTOR_HOME_FILE)
AC_SUBST(MPI_SELECTOR_MPIVARS_BASENAME)
OPENFOAM_SELECTOR_SYSCONFIG_FILE="openfoam-selector"
OPENFOAM_SELECTOR_HOME_FILE=".openfoam-selector"
AC_SUBST(OPENFOAM_SELECTOR_SYSCONFIG_FILE)
AC_SUBST(OPENFOAM_SELECTOR_HOME_FILE)
prefix=$prefix_save
......@@ -59,12 +57,12 @@ AC_SUBST(MAN_DATE)
AC_CONFIG_FILES([
Makefile
mpi-selector
mpi-selector.sh
mpi-selector.csh
openfoam-selector
openfoam-selector.sh
openfoam-selector.csh
])
AC_CONFIG_COMMANDS([tasty], [
for file in mpi-selector mpi-selector.sh mpi-selector.csh;
for file in openfoam-selector openfoam-selector.sh;
do
if test -f "$file"; then
chmod -w $file
......
This diff is collapsed.
#!/bin/csh
# Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
#
# File installed for Bourne-shell startups to select which MPI
# installation to use. Not using "alternatives" because we want to be
# able to set per-user level defaults, not just system-wide defaults.
set mpi_selector_dir="@MPI_SELECTOR_DATADIR@"
set mpi_selector_homefile="$HOME/@MPI_SELECTOR_HOME_FILE@"
set mpi_selector_sysfile="@MPI_SELECTOR_SYSCONFDIR@/@MPI_SELECTOR_SYSCONFIG_FILE@"
set mpi_selection=
if (-f "$mpi_selector_homefile") then
set mpi_selection=`cat $mpi_selector_homefile`
else if (-f "$mpi_selector_sysfile") then
set mpi_selection=`cat $mpi_selector_sysfile`
endif
if ("$mpi_selection" != "" && -f "$mpi_selector_dir/$mpi_selection.csh") then
source "$mpi_selector_dir/$mpi_selection.csh"
endif
#!/bin/sh
# Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
#
# File installed for Bourne-shell startups to select which MPI
# installation to use. Not using "alternatives" because we want to be
# able to set per-user level defaults, not just system-wide defaults.
mpi_selector_dir="@MPI_SELECTOR_DATADIR@"
mpi_selector_homefile="$HOME/@MPI_SELECTOR_HOME_FILE@"
mpi_selector_sysfile="@MPI_SELECTOR_SYSCONFDIR@/@MPI_SELECTOR_SYSCONFIG_FILE@"
mpi_selection=
if test -f "$mpi_selector_homefile"; then
mpi_selection=`cat $mpi_selector_homefile`
elif test -f "$mpi_selector_sysfile"; then
mpi_selection=`cat $mpi_selector_sysfile`
fi
if test "$mpi_selection" != "" -a -f "$mpi_selector_dir/$mpi_selection.sh"; then
. "$mpi_selector_dir/$mpi_selection.sh"
fi
#!/usr/bin/env perl
#!/usr/bin/perl
#
# Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
#
......@@ -15,15 +15,16 @@ use File::Copy;
=head1 NAME
mpi-selector-menu - A menu-based wrapper around the mpi-selector command
openfoam-selector-menu - A menu-based wrapper around the openfoam-selector command
=head1 SYNOPSIS
mpi-selector-menu [--version] [--help]
openfoam-selector-menu [--version] [--help]
=head1 DESCRIPTION
Simple wrapper around the mpi-selector command-line
Simple wrapper around the openfoam-selector command-line
Adapted from mpi-selector-menu.
=head1 AUTHOR
......@@ -33,7 +34,7 @@ Written by Jeff Squyres.
Send bug reports to the OpenFabrics general mailing list (see
L<http://www.openfabrics.org/>). This is a high-volume mailing list,
so be sure to put "mpi-selector" in the subject to ensure that it is
so be sure to put "openfoam-selector" in the subject to ensure that it is
not missed.
=head1 COPYRIGHT
......@@ -44,9 +45,11 @@ This is free software; see the source for copying conditions. There
is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (C) 2018 OpenCFD Ltd.
=head1 SEE ALSO
mpi-selector(1)
openfoam-selector(1)
=cut
......@@ -69,6 +72,7 @@ sub show_help {
sub make_safe_filename {
my $name = shift;
$name =~ s/[ :\/\\\*\&\$\#\@\!\t\n\[\]\{\}\(\)]/_/g;
$name =~ s/^__internal//; # Disallow reserved names
return $name;
}
......@@ -123,7 +127,7 @@ sub get_yn {
} elsif ($ans =~ /n/i) {
return 0;
} elsif ("" eq $ans) {
return $default
return $default
if (defined($default));
}
print "\nPlease choose Y or N\n";
......@@ -167,21 +171,21 @@ Written by Jeff Squyres.\n";
#---------------------------------------------------------------------------
# Ensure that we can find the mpi-selector executable
# Ensure that we can find the openfoam-selector executable
#---------------------------------------------------------------------------
sub query {
my $arg = shift;
my $ret = `mpi-selector --query $arg | head -n 1 | cut -d: -f2`;
my $ret = `openfoam-selector --query $arg | head -n 1 | cut -d: -f2`;
chomp($ret);
$ret = "<none>" if ($ret eq "");
return $ret;
}
sub list {
my $list;
open(CMD, "mpi-selector --list|");
my $list = [];
open(CMD, "openfoam-selector --list|");
while (<CMD>) {
chomp;
push(@$list, $_);
......@@ -213,7 +217,7 @@ sub get_user_or_system {
my $registered = list();
my $first = 1;
my $made_changes = 0;
my $warning = "\nWARNING: Changes made to mpi-selector defaults will not be visible until
my $warning = "\nWARNING: Changes made to openfoam-selector defaults will not be visible until
you start a new shell!\n\n";
while (1) {
......@@ -258,18 +262,18 @@ Selection (1-${i}[us], U[us], Q): ";
if ($made_changes);
exit(0);
} elsif ($val =~ /^\s*u\s*s\s*$/i) {
system("mpi-selector --unset --system");
system("openfoam-selector --unset --system");
$made_changes = 1;
} elsif ($val =~ /^\s*u\s*u\s*$/i) {
system("mpi-selector --unset --user");
system("openfoam-selector --unset --user");
$made_changes = 1;
} elsif ($val =~ /^\s*u\s*$/i) {
$val = get_user_or_system();
my $str = "mpi-selector --unset " .
my $str = "openfoam-selector --unset " .
("s" eq $val ? "--system" : "--user");
system($str);
$made_changes = 1;
}
}
# Numeric options
elsif ($val =~ m/^\s*([0-9]+)\s*([us])*\s*$/) {
......@@ -287,7 +291,7 @@ Selection (1-${i}[us], U[us], Q): ";
}
my $i = $1 - 1;
my $str = "mpi-selector --set $$registered[$i] " .
my $str = "openfoam-selector --set $$registered[$i] " .
("s" eq $val ? "--system" : "--user");
system($str);
$made_changes = 1;
......
# -*- sh -*-
# Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
# Copyright (C) 2018 OpenCFD Ltd.
#
# File installed for C-shell startups to select which OPENFOAM
# installation to use. Not using "alternatives" because we want to be
# able to set per-user level defaults, not just system-wide defaults.
set openfoam_selector_dir="@OPENFOAM_SELECTOR_DATADIR@"
set openfoam_selector_homefile="$HOME/@OPENFOAM_SELECTOR_HOME_FILE@"
set openfoam_selector_sysfile="@OPENFOAM_SELECTOR_SYSCONFDIR@/@OPENFOAM_SELECTOR_SYSCONFIG_FILE@"
# The selection name
set openfoam_selection=
if ( -f "$openfoam_selector_homefile" ) then
set openfoam_selection=`cat $openfoam_selector_homefile`
else if ( -f "$openfoam_selector_sysfile" ) then
set openfoam_selection=`cat $openfoam_selector_sysfile`
endif
# 1st: get selection name -> directory name correspondence
if ("$openfoam_selection" != "" && -f "$openfoam_selector_dir/$openfoam_selection") then
openfoam_selection=`cat "$openfoam_selector_dir/$openfoam_selection"`
# 2nd: test for and source OpenFOAM etc/cshrc
if ("$openfoam_selection" != "" && -f "$openfoam_selection/etc/cshrc") then
source "$openfoam_selection/etc/cshrc"
fi
fi
# -----------------------------------------------------------------------------
# -*- sh -*-
# Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
# Copyright (C) 2018 OpenCFD Ltd.
#
# File installed for Bourne-shell startups to select which OPENFOAM
# installation to use. Not using "alternatives" because we want to be
# able to set per-user level defaults, not just system-wide defaults.
openfoam_selector_dir="@OPENFOAM_SELECTOR_DATADIR@"
openfoam_selector_homefile="$HOME/@OPENFOAM_SELECTOR_HOME_FILE@"
openfoam_selector_sysfile="@OPENFOAM_SELECTOR_SYSCONFDIR@/@OPENFOAM_SELECTOR_SYSCONFIG_FILE@"
# The selection name
unset openfoam_selection
if test -f "$openfoam_selector_homefile"
then
openfoam_selection=$(cat $openfoam_selector_homefile)
elif test -f "$openfoam_selector_sysfile"
then
openfoam_selection=$(cat $openfoam_selector_sysfile)
fi
# 1st: get selection name -> directory name correspondence
if test "$openfoam_selection" != "" -a -f "$openfoam_selector_dir/$openfoam_selection"
then
openfoam_selection=$(cat "$openfoam_selector_dir/$openfoam_selection")
# 2nd: test for and source OpenFOAM etc/bashrc
if test "$openfoam_selection" != "" -a -f "$openfoam_selection/etc/bashrc"
then
. "$openfoam_selection/etc/bashrc"
fi
fi
# -----------------------------------------------------------------------------
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment