Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
feature-scripts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Community
feature-scripts
Commits
c8d7a380
Commit
c8d7a380
authored
May 06, 2019
by
Mark Olesen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not use function in define select mechanism (squashes aliases)
- bump VERSION
parent
fe0fad1c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
40 deletions
+27
-40
openfoam-selector/VERSION
openfoam-selector/VERSION
+1
-1
openfoam-selector/openfoam-selector.sh.in
openfoam-selector/openfoam-selector.sh.in
+26
-39
No files found.
openfoam-selector/VERSION
View file @
c8d7a380
1.0.
3
1.0.
4
openfoam-selector/openfoam-selector.sh.in
View file @
c8d7a380
# -*- sh -*-
# 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
# installation to use. Not using "alternatives" because we want to be
# 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
openfoam_select
()
{
# Would be nice to define select mechanism as a function for later reuse
# but that squashes aliases
openfoam_selector_dir
=
"@OPENFOAM_SELECTOR_DATADIR@"
openfoam_selector_homefile
=
"
$HOME
/@OPENFOAM_SELECTOR_HOME_FILE@"
openfoam_selector_sysfile
=
"@OPENFOAM_SELECTOR_SYSCONFDIR@/@OPENFOAM_SELECTOR_SYSCONFIG_FILE@"
# Get the selection name
unset
openfoam_selection
if
[
-f
"
$openfoam_selector_homefile
"
]
then
# Home file
openfoam_selection
=
$(
cat
"
$openfoam_selector_homefile
"
)
elif
[
-f
"
$openfoam_selector_sysfile
"
]
then
# System file
openfoam_selection
=
$(
cat
"
$openfoam_selector_sysfile
"
)
fi
if
[
-n
"
$openfoam_selection
"
]
&&
\
[
-f
"
$openfoam_selector_dir
/
$openfoam_selection
"
]
# The selection name
unset
openfoam_selection
if
[
-f
"
$openfoam_selector_homefile
"
]
then
openfoam_selection
=
$(
cat
"
$openfoam_selector_homefile
"
)
elif
[
-f
"
$openfoam_selector_sysfile
"
]
then
openfoam_selection
=
$(
cat
"
$openfoam_selector_sysfile
"
)
fi
if
[
-n
"
$openfoam_selection
"
]
&&
\
[
-f
"
$openfoam_selector_dir
/
$openfoam_selection
"
]
then
# Resolve to OpenFOAM directory
openfoam_selection
=
$(
cat
"
$openfoam_selector_dir
/
$openfoam_selection
"
)
if
[
-n
"
$openfoam_selection
"
]
&&
[
-f
"
$openfoam_selection
/etc/bashrc"
]
then
# Resolve to OpenFOAM directory
openfoam_selection
=
$(
cat
"
$openfoam_selector_dir
/
$openfoam_selection
"
)
if
[
-n
"
$openfoam_selection
"
]
&&
\
[
-f
"
$openfoam_selection
/etc/bashrc"
]
then
.
"
$openfoam_selection
/etc/bashrc"
''
fi
.
"
$openfoam_selection
/etc/bashrc"
''
fi
fi
# Cleanup
unset
openfoam_selection openfoam_selector_dir
unset
openfoam_selector_homefile openfoam_selector_sysfile
}
# Execute the above
openfoam_select
# Cleanup
unset
openfoam_selection openfoam_selector_dir
unset
openfoam_selector_homefile openfoam_selector_sysfile
# -----------------------------------------------------------------------------
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment