Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
feature-scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Community
feature-scripts
Commits
c8d7a380
Commit
c8d7a380
authored
6 years ago
by
Mark OLESEN
Browse files
Options
Downloads
Patches
Plain Diff
Do not use function in define select mechanism (squashes aliases)
- bump VERSION
parent
fe0fad1c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
openfoam-selector/VERSION
+1
-1
1 addition, 1 deletion
openfoam-selector/VERSION
openfoam-selector/openfoam-selector.sh.in
+26
-39
26 additions, 39 deletions
openfoam-selector/openfoam-selector.sh.in
with
27 additions
and
40 deletions
openfoam-selector/VERSION
+
1
−
1
View file @
c8d7a380
1.0.
3
1.0.
4
This diff is collapsed.
Click to expand it.
openfoam-selector/openfoam-selector.sh.in
+
26
−
39
View file @
c8d7a380
# -*- sh -*-
# -*- sh -*-
# Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
# Copyright (C) 2018 OpenCFD Ltd.
# Copyright (C) 2018
-2019
OpenCFD Ltd.
#
#
# File installed for Bourne-shell startups to select which OPENFOAM
# File installed for Bourne-shell startups to select which OPENFOAM
# installation to use. Not using "alternatives" because we want to be
# installation to use. Not using "alternatives" because we want to be
# able to set per-user level defaults, not just system-wide defaults.
# able to set per-user level defaults, not just system-wide defaults.
#
# Define select mechanism as a function for later reuse
#
#
unset
-f
openfoam_select 2>/dev/null
# Would be nice to define select mechanism as a function for later reuse
openfoam_select
()
# but that squashes aliases
{
openfoam_selector_dir
=
"@OPENFOAM_SELECTOR_DATADIR@"
openfoam_selector_dir
=
"@OPENFOAM_SELECTOR_DATADIR@"
openfoam_selector_homefile
=
"
$HOME
/@OPENFOAM_SELECTOR_HOME_FILE@"
openfoam_selector_homefile
=
"
$HOME
/@OPENFOAM_SELECTOR_HOME_FILE@"
openfoam_selector_sysfile
=
"@OPENFOAM_SELECTOR_SYSCONFDIR@/@OPENFOAM_SELECTOR_SYSCONFIG_FILE@"
openfoam_selector_sysfile
=
"@OPENFOAM_SELECTOR_SYSCONFDIR@/@OPENFOAM_SELECTOR_SYSCONFIG_FILE@"
# Get the selection name
# The selection name
unset
openfoam_selection
unset
openfoam_selection
if
[
-f
"
$openfoam_selector_homefile
"
]
if
[
-f
"
$openfoam_selector_homefile
"
]
then
then
openfoam_selection
=
$(
cat
"
$openfoam_selector_homefile
"
)
# Home file
elif
[
-f
"
$openfoam_selector_sysfile
"
]
openfoam_selection
=
$(
cat
"
$openfoam_selector_homefile
"
)
then
elif
[
-f
"
$openfoam_selector_sysfile
"
]
openfoam_selection
=
$(
cat
"
$openfoam_selector_sysfile
"
)
then
fi
# System file
openfoam_selection
=
$(
cat
"
$openfoam_selector_sysfile
"
)
if
[
-n
"
$openfoam_selection
"
]
&&
\
fi
[
-f
"
$openfoam_selector_dir
/
$openfoam_selection
"
]
then
# Resolve to OpenFOAM directory
if
[
-n
"
$openfoam_selection
"
]
&&
\
openfoam_selection
=
$(
cat
"
$openfoam_selector_dir
/
$openfoam_selection
"
)
[
-f
"
$openfoam_selector_dir
/
$openfoam_selection
"
]
if
[
-n
"
$openfoam_selection
"
]
&&
[
-f
"
$openfoam_selection
/etc/bashrc"
]
then
then
# Resolve to OpenFOAM directory
.
"
$openfoam_selection
/etc/bashrc"
''
openfoam_selection
=
$(
cat
"
$openfoam_selector_dir
/
$openfoam_selection
"
)
if
[
-n
"
$openfoam_selection
"
]
&&
\
[
-f
"
$openfoam_selection
/etc/bashrc"
]
then
.
"
$openfoam_selection
/etc/bashrc"
''
fi
fi
fi
fi
# Cleanup
# Cleanup
unset
openfoam_selection openfoam_selector_dir
unset
openfoam_selection openfoam_selector_dir
unset
openfoam_selector_homefile openfoam_selector_sysfile
unset
openfoam_selector_homefile openfoam_selector_sysfile
}
# Execute the above
openfoam_select
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment