mirror of
https://github.com/the-sane/lug-helper.git
synced 2024-12-27 10:44:18 +00:00
Add sanity checks
This commit is contained in:
parent
f5ee994599
commit
4896db1e5d
@ -2405,10 +2405,22 @@ update_launcher() {
|
|||||||
|
|
||||||
# Backup the file
|
# Backup the file
|
||||||
cp "$wine_prefix/$wine_launch_script_name" "$wine_prefix/$(basename "$wine_launch_script_name" .sh).bak"
|
cp "$wine_prefix/$wine_launch_script_name" "$wine_prefix/$(basename "$wine_launch_script_name" .sh).bak"
|
||||||
|
|
||||||
# Backup the variables we know we need
|
# Backup the variables we know we need
|
||||||
bak_wineprefix="$(grep "^export WINEPREFIX=" "$wine_prefix/$wine_launch_script_name" | awk -F '=' '{print $2}')"
|
bak_wineprefix="$(grep "^export WINEPREFIX=" "$wine_prefix/$wine_launch_script_name" | awk -F '=' '{print $2}')"
|
||||||
bak_winepath="$(grep -e "^export wine_path=" -e "^wine_path=" "$wine_prefix/$wine_launch_script_name" | awk -F '=' '{print $2}')"
|
bak_winepath="$(grep -e "^export wine_path=" -e "^wine_path=" "$wine_prefix/$wine_launch_script_name" | awk -F '=' '{print $2}')"
|
||||||
|
|
||||||
|
# If wineprefix isn't found in the file, something is wrong and we shouldn't proceed
|
||||||
|
if [ -z "$bak_wineprefix" ]; then
|
||||||
|
message error "The WINEPREFIX env var was not found in your launch script. Unable to proceed!\n\n$wine_prefix/$wine_launch_script_name"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If wine_path is empty, it may be an older version of the launch script. Default to system wine
|
||||||
|
if [ -z "$bak_winepath" ]; then
|
||||||
|
bak_winepath="$(command -v wine | xargs dirname)"
|
||||||
|
fi
|
||||||
|
|
||||||
# Copy in the new launch script
|
# Copy in the new launch script
|
||||||
cp "$wine_launch_script" "$wine_prefix"
|
cp "$wine_launch_script" "$wine_prefix"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user