diff options
| author | Daniil Baturin <daniil@vyos.io> | 2023-04-03 08:04:19 +0100 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-03 08:04:19 +0100 | 
| commit | 2ec876ba9034c4e35538860d3128c6c13e185825 (patch) | |
| tree | 246f8d3b118249f8e7a635cc959cc49e693c101a /scripts/install/install-functions | |
| parent | e06078916c59b15a318447400d27d8158f4f70fd (diff) | |
| parent | 36f08f78b806639827c9ae3a81275e057309bb1d (diff) | |
| download | vyatta-cfg-system-2ec876ba9034c4e35538860d3128c6c13e185825.tar.gz vyatta-cfg-system-2ec876ba9034c4e35538860d3128c6c13e185825.zip  | |
T5136: properly unmount filesystems after installation
Diffstat (limited to 'scripts/install/install-functions')
| -rwxr-xr-x | scripts/install/install-functions | 24 | 
1 files changed, 22 insertions, 2 deletions
diff --git a/scripts/install/install-functions b/scripts/install/install-functions index b3ec42c1..feeeb489 100755 --- a/scripts/install/install-functions +++ b/scripts/install/install-functions @@ -86,10 +86,10 @@ tolower () {  }  # Validates a user response.  Returns the response if valid. -# Returns the default is the user just hits enter.   +# Returns the default is the user just hits enter.  # Returns nothing if not valid.  Default parameter is $1.  # Options are in $2.  If options are defined return must be a member -# of the enum.  +# of the enum.  get_response () {    local ldefault=$(tolower "$1")    local loptions=$(tolower "$2") @@ -370,6 +370,26 @@ EOF    return 1  } +# try to unmount. log any errors and return the appropriate status. +# $1: arguments for umount +try_unmount () +{ +  args="$*" +  output=$(eval "umount $args 2>&1") +  status=$? +  if [ $status == 0 ]; then +    return 0 +  fi +  # error +  cat <<EOF +Error trying to unmount a partition/directory. +Please see $INSTALL_LOG for details. +EOF +  lecho 'Error trying to unmount a partition/directory.' +  lecho "umount $args\n$output" +  return 1 +} +  # Find 2 drives of the same size.  get_size_raid ()  {  | 
