workspaces-issues icon indicating copy to clipboard operation
workspaces-issues copied to clipboard

[Feature Request] - slight enhancement on the upgrade script for a kasm location moved elsewhere

Open Daryes opened this issue 1 year ago • 0 comments

Existing Resources

The script upgrade.sh from kasm 1.13.1 contains the following near the start :

CURRENT_VERSION=$(readlink -f /opt/kasm/current | awk -F'/' '{print $4}')

On a system where Kasm is moved from /opt using a symlink, the $4 can give different results than expected.

For example :

  • original location: /opt/kasm
    which is now a symlink to the real location
  • real location : /server/kasm/data
  • readlink will return : /server/kasm/data/1.11.0
  • awk will return : data

A slight change to the awk parameters using $NF instead of $4, will give the correct result.

awk -F'/' '{print $NF}'

NF being the number of field, using it with print will always return the last field.

Alternative :

CURRENT_VERSION=$( basename `readlink -f /opt/kasm/current` )

Daryes avatar Jul 22 '23 13:07 Daryes