install.fairie/home/.chezmoiscripts/universal/run_onchange_after_06-bin-symlink.sh.tmpl
Brian Zalewski 84311be753 Update 2 files
- /home/.chezmoiscripts/universal/run_onchange_after_06-bin-symlink.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_06-bin-symlink.sh.tmpl
2023-04-11 22:04:05 +00:00

20 lines
852 B
Cheetah

{{- if (ne .host.distro.family "windows") -}}
#!/usr/bin/env bash
# @file Python Symlink
# @brief Symlinks `python` to `python3` when Python 2.7 is not installed
# @description
# This script checks if `python3` is available and if `python` is not available. If both are true, then the script
# symlinks `python` to `python3` so that the `python` command uses `python3`.
#
# This is useful if you do not want to install Python 2.7 and would like Python 3 to be used in all cases.
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### Symlink python3 to python if it is unavailable
if ! command -v python > /dev/null && command -v python3 > /dev/null; then
logg info 'Symlinking `python3` to `python` since the latter is unavailable'
sudo ln -s "$(which python3)" /usr/local/bin/python
fi
{{ end -}}