Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,22 @@

# TKG-Installer 🐸

#### Commandline tool to assist with the installation and configuration of the powerful TKG packages from the repositories of the [Frogging-Family](https://github.com/Frogging-Family).
#### All-in one build of the powerful TKG packages from the repositories of the [Frogging-Family](https://github.com/Frogging-Family).

##### Thanks to their flexible configuration and powerful settings functions, TKG packages can be precisely tailored to different systems and personal requirements.
##### Thanks to their flexible configuration and powerful settings, TKG packages can be precisely tailored to different systems and personal preferences.

##### I've been using this script successfully for quite a while—maybe it will help you too!

---

## Features

- **Dual Mode Operation**: Use either an interactive `fzf`-menu or fast direct `command-line` mode.
- **Advanced Package Configuration**: This script can create and manage external configuration files for all TKG packages and tools.
- **Multi-Distro Support**: Works seamlessly on Arch-based systems and most other Linux distributions support by the Frogging-Family.
- **Dual-Mode**: Use either an interactive `fzf` menu or a fast, direct command-line mode.
- **Manage `customization.cfg`**: Create, edit, and compare `customization.cfg` files.
- **Multi-Distribution**: Works seamlessly on Arch-based systems and on most other Linux distributions supported by the Frogging-Family.

[![tkginstaller-fzf](images/fzf.png)](images/fzf.png)
[![tkginstaller-fzf2](images/fzf2.png)](images/fzf2.png)
[![tkginstaller-fzfconfig](images/config.png)](images/config.png)
[![tkginstaller-linuxdirect](images/linux.png)](images/linux.png)
[![tkginstaller-winedirect](images/wine.png)](images/wine.png)
[![tkginstaller-protondirect](images/proton.png)](images/proton.png)

---

Expand Down Expand Up @@ -97,6 +93,7 @@
> - **`fzf`**: Powers the interactive menu.
> - **`glow`**: For preview markdown files in the terminal.
> - **`nano`, `micro`, `vim`, etc.** The script uses the `$EDITOR` environment variable.
> - **`wdiff`** For comparing `customization.cfg` files.

#### Individual TKG packages have their own dependencies: [https://github.com/Frogging-Family](https://github.com/Frogging-Family)

Expand Down
2 changes: 1 addition & 1 deletion docs/clean.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 🧹 TKG-Installer - Cleaning
## TKG-Installer - Cleaning

---

Expand Down
2 changes: 1 addition & 1 deletion docs/exit.md → docs/close.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 👋 TKG-Installer - Exit
## TKG-Installer - Close

---

Expand Down
2 changes: 1 addition & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 🛠️ TKG-Installer - Config menu
## TKG-Installer - Config menu

---

Expand Down
2 changes: 1 addition & 1 deletion docs/help.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## TKG-Installer - Help
## TKG-Installer - Help

---

Expand Down
2 changes: 1 addition & 1 deletion docs/linux.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 🧠 Linux-TKG ─ Custom Linux kernels
## Linux-TKG ─ Custom Linux kernels

---

Expand Down
2 changes: 1 addition & 1 deletion docs/mesa.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 🧩 Mesa-TKG ─ Open-Source graphics driver for AMD and Intel
## Mesa-TKG ─ Open-Source graphics driver for AMD and Intel

---

Expand Down
2 changes: 1 addition & 1 deletion docs/nvidia.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 🖥️ Nvidia-TKG ─ Open-Source or proprietary graphics driver
## Nvidia-TKG ─ Open-Source or proprietary graphics driver

---

Expand Down
2 changes: 1 addition & 1 deletion docs/proton.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 🎮 Proton-TKG ─ Windows compatibility layer for Steam / Gaming
## Proton-TKG ─ Windows compatibility layer for Steam / Gaming

---

Expand Down
2 changes: 1 addition & 1 deletion docs/return.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Return - Exit editor menu
## Return - Exit editor menu

---

Expand Down
2 changes: 1 addition & 1 deletion docs/wine.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 🍷 Wine-TKG ─ Windows compatibility layer
## Wine-TKG ─ Windows compatibility layer

---

Expand Down
82 changes: 48 additions & 34 deletions tkginstaller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
# shellcheck disable=SC2218 # Allow usage of printf with variable format strings

# TKG-Installer VERSION definition
export _tkg_version="v0.22.5"
export _tkg_version="v0.22.6"

# Lock file to prevent concurrent execution of the script
export _lock_file="/tmp/tkginstaller.lock"
Expand Down Expand Up @@ -245,13 +245,17 @@ __msg_pkg() {
local _pkg_name="${1:-TKG package}"
local _config_url="${2:-${_frog_repo_url}}"

__msg_info "${_break}${_green_neon}${_uline_on}NOTICE:${_uline_off}${_reset}${_green_light} customization.cfg${_reset}${_break}"
__msg_plain " A wide range of options are available."
__msg_plain " Thanks to their flexible configuration and powerful settings functions, TKG packages"
__msg_plain " can be precisely tailored to different systems and personal requirements."
__msg_plain " The${_gray} customization.cfg${_reset} files can be set up using a short setup guide via the interactive menu or with${_reset}${_gray} ‘tkginstaller ${_pkg_name,,} config’${_reset}."
__msg_plain " The tool then offers you the option to make the adjustments in your preferred text editor."
__msg_plain " Please make sure to adjust the settings correctly."
__msg_info "${_break}${_green_neon}${_uline_on}NOTICE:${_uline_off}${_reset}${_green_light} Create, edit, and compare${_gray} customization.cfg${_reset}${_green_light} files${_reset}${_break}"
__msg_plain " A wide range of options are available!"
__msg_plain " Thanks to their flexible configuration and powerful settings, TKG packages"
__msg_plain " can be precisely tailored to different systems and personal preferences.${_break}"
__msg_plain " The${_gray} customization.cfg${_reset} files can be set up by using a short process:"
__msg_plain " 1) ${_gray} Interactive menu -> Config -> ${_pkg_name,,}"
__msg_plain " 2) ${_gray} tkginstaller ${_pkg_name,,} config${_break}"
__msg_plain " The file(s) are saved in the ${_gray} ~/.config/frogminer/${_reset} directory according to the standard specifications."
__msg_plain " Once the setup is complete, the configs are immediately ready to be edited and compared"
__msg_plain " The tool offers the option to make the adjustments in your preferred text editor."
__msg_plain " ${_uline_on}Please make sure to adjust the settings correctly.${_uline_off}"
__msg_plain " Refer to the${_gray} customization.cfg${_reset} documentation for detailed configuration options."
__msg_plain " Location:${_reset}${_gray} ${_config_url}"
}
Expand Down Expand Up @@ -370,7 +374,7 @@ __prepare() {
local _dep=(git onefetch)
if [[ "$_load_preview" == "true" ]]; then
# Add optional dependencies for interactive mode
_dep+=(bat curl glow fzf)
_dep+=(bat curl glow fzf wdiff)
fi

# Define package names per distro for missing dependencies installation mapping
Expand All @@ -381,6 +385,7 @@ __prepare() {
[glow]=glow
[fzf]=fzf
[onefetch]=onefetch
[wdiff]=wdiff
)

# Set install command based on detected Linux distribution
Expand All @@ -402,6 +407,7 @@ __prepare() {
[glow]=app-text/glow
[fzf]=app-misc/fzf
[onefetch]=app-misc/onefetch
[wdiff]=app-text/wdiff
)
_install_cmd_dep="emerge"
;;
Expand Down Expand Up @@ -555,9 +561,8 @@ __fzf_menu() {
local _header_text="$3" # Header text (string)
local _footer_text="$4" # Footer text (string)
local _border_label_text="${5:-$_tkg_version}" # Border label text (string, optional)
local _preview_window_settings="${6:-right:nowrap:60%}" # Preview window settings (string, optional)
# Fuzzy finder key bindings for preview toggle and config edit (open)
local _fzf_bind="ctrl-p:toggle-preview"
local _preview_window_settings="${6:-right:wrap:60%,right:wrap:90%}" # start: 60%, then 90%, then hidden
local _fzf_bind="${7:-ctrl-p:toggle-preview}" # Key binding for fzf (optional)

# Run fzf with provided parameters and predefined settings
fzf \
Expand Down Expand Up @@ -1016,16 +1021,13 @@ __edit_config() {
local _error_config_not_exist="${_orange} No external configuration file found.${_reset}${_break}${_break}${_green_light} This configuration file is required for customizing TKG builds and options.${_break}${_green_light} Select and confirm a option to download the missing${_reset}${_gray} customization.cfg${_reset}${_green_light} file now, or create your own later.${_reset}${_break}${_green_dark}${_line}${_break}"

# Define a reusable bat command for the preview window
local _bat_cmd="bat --style=plain --language=cfg --force-colorization --theme='Visual Studio Dark+'"

# Define a reusable diff command for the preview window
local _cols
_cols=$(tput cols 2>/dev/null || echo 120)

#local _diff_cmd="git diff --compact-summary --color=always --word-diff=color --unified=3 --ignore-all-space --ignore-blank-lines"
#local _diff_cmd="colordiff --color=yes --side-by-side"
local _diff_cmd="diff --color=always --side-by-side"

local _bat_cmd="LC_ALL=C bat --style=plain --language=cfg --wrap character --terminal-width ${_cols} --force-colorization --theme='Visual Studio Dark+'"

#local _diff_cmd="LC_ALL=C git diff --compact-summary --color=always --word-diff=color --unified=3 --ignore-all-space --ignore-blank-lines"
#local _diff_cmd="LC_ALL=C colordiff --color=yes --side-by-side"
#local _diff_cmd="LC_ALL=C diff --color=always --side-by-side"
local _diff_cmd="LC_ALL=C wdiff --terminal --start-delete='${_red}' --end-delete='${_reset}' --start-insert='${_green_light}' --end-insert='${_reset}'"

# Define preview command for fzf menu to show config file content or diff vs remote default
# It fetches the remote default config file and compares it with the local one if it exists
local _preview_command='
Expand Down Expand Up @@ -1061,12 +1063,12 @@ __edit_config() {

# Define header, footer, border label, and preview window settings for fzf menu
local _header_text="🐸${_green_neon} TKG-Installer ─ Config menu${_reset}${_break}${_break}${_green_light} Adjust external configuration file${_break} Default directory:${_reset}${_gray} ~/.config/frogminer/ "
local _footer_text="${_green_light} Use arrow keys ⌨️ or 🖱️ mouse to navigate, Enter to select, ESC to exit${_break} Press${_reset}${_gray} Ctrl+P${_reset}${_green_light} to toggle the preview window${_break}${_green_light} Info:${_reset}${_gray} https://github.com/Frogging-Family${_reset}${_break}${_gray} https://github.com/damachine/tkginstaller"
local _footer_text="${_green_light} Use arrow keys ⌨️ or 🖱️ mouse to navigate, Enter to select, ESC to exit${_break} Press${_reset}${_gray} [Ctrl+P]${_reset}${_green_light} to toggle the preview window${_break}${_green_light} Info:${_reset}${_gray} https://github.com/Frogging-Family${_reset}${_break}${_gray} https://github.com/damachine/tkginstaller"
local _border_label_text="${_tkg_version}"
local _preview_window_settings='right:nowrap:70%'
local _preview_window_settings='right:wrap:75%'

# Show fzf menu and get user selection for configuration file editing
_config_choice=$(__fzf_menu "$_menu_content" "$_preview_command" "$_header_text" "$_footer_text" "$_border_label_text" "$_preview_window_settings")
_config_choice=$(__fzf_menu "$_menu_content" "$_preview_command" "$_header_text" "$_footer_text" "$_border_label_text" "$_preview_window_settings" "$_fzf_bind" )

# Handle cancelled selection (ESC key) or empty choice to exit editor menu gracefully
if [[ -z "$_config_choice" ]]; then
Expand Down Expand Up @@ -1325,31 +1327,43 @@ __menu() {
key=$(echo {} | cut -d"|" -f1 | xargs)
case $key in
Linux*)
glow --pager --width 80 --style "${_glow_style:-dark}" "${_tkg_raw_url}/linux.md" ;;
glow --pager --width 80 --style "${_glow_style:-dark}" "${_tkg_raw_url}/linux.md"
glow --pager --width 80 --style "${_glow_style:-dark}" "${_frog_raw_url}/linux-tkg/refs/heads/master/README.md"
;;
Nvidia*)
glow --pager --width 80 --style "${_glow_style:-dark}" "${_tkg_raw_url}/nvidia.md" ;;
glow --pager --width 80 --style "${_glow_style:-dark}" "${_tkg_raw_url}/nvidia.md"
glow --pager --width 80 --style "${_glow_style:-dark}" "${_frog_raw_url}/nvidia-all/refs/heads/master/README.md"
;;
Mesa*)
glow --pager --width 80 --style "${_glow_style:-dark}" "${_tkg_raw_url}/mesa.md" ;;
glow --pager --width 80 --style "${_glow_style:-dark}" "${_tkg_raw_url}/mesa.md"
glow --pager --width 80 --style "${_glow_style:-dark}" "${_frog_raw_url}/mesa-git/refs/heads/master/README.md"
;;
Wine*)
glow --pager --width 80 --style "${_glow_style:-dark}" "${_tkg_raw_url}/wine.md" ;;
glow --pager --width 80 --style "${_glow_style:-dark}" "${_tkg_raw_url}/wine.md"
glow --pager --width 80 --style "${_glow_style:-dark}" "${_frog_raw_url}/wine-tkg-git/refs/heads/master/wine-tkg-git/README.md"
;;
Proton*)
glow --pager --width 80 --style "${_glow_style:-dark}" "${_tkg_raw_url}/proton.md" ;;
glow --pager --width 80 --style "${_glow_style:-dark}" "${_tkg_raw_url}/proton.md"
glow --pager --width 80 --style "${_glow_style:-dark}" "${_frog_raw_url}/wine-tkg-git/refs/heads/master/proton-tkg/README.md"
;;
Config*)
glow --pager --width 80 --style "${_glow_style:-dark}" "${_tkg_raw_url}/config.md" ;;
glow --pager --width 80 --style "${_glow_style:-dark}" "${_tkg_raw_url}/config.md"
glow --pager --width 80 --style "${_glow_style:-dark}" "${_frog_raw_url}/config-tkg/refs/heads/master/README.md"
;;
Clean*)
glow --pager --width 80 --style "${_glow_style:-dark}" "${_tkg_raw_url}/clean.md" ;;
Help*)
glow --pager --width 80 --style "${_glow_style:-dark}" "${_tkg_raw_url}/help.md" ;;
Close*)
glow --pager --width 80 --style "${_glow_style:-dark}" "${_tkg_raw_url}/exit.md" ;;
glow --pager --width 80 --style "${_glow_style:-dark}" "${_tkg_raw_url}/close.md" ;;
esac
'

# Define header and footer texts for fzf menu display with TKG version info and instructions
local _header_text="🐸${_green_neon} TKG-Installer ─ Main menu${_reset}${_break}${_break}${_green_light} Adjust, download, build, and install -TKG- packages${_break} Select an option below"
local _footer_text="${_green_light} Use arrow keys ⌨️ or 🖱️ mouse to navigate, Enter to select, ESC to exit${_break} Press${_reset}${_gray} Ctrl+P${_reset}${_green_light} to toggle the preview window${_break}${_green_light} Info:${_reset}${_gray} https://github.com/Frogging-Family${_reset}${_break}${_gray} https://github.com/damachine/tkginstaller"
local _footer_text="${_green_light} Use arrow keys ⌨️ or 🖱️ mouse to navigate, Enter to select, ESC to exit${_break} Press${_reset}${_gray} [Ctrl+P]${_reset}${_green_light} to toggle the preview window${_break}${_green_light} Info:${_reset}${_gray} https://github.com/Frogging-Family${_reset}${_break}${_gray} https://github.com/damachine/tkginstaller"
local _border_label_text="${_tkg_version}"
local _preview_window_settings='right:wrap:60%' #:hidden
local _preview_window_settings='right:nowrap:55%'

# Show fzf menu and get user selection for main menu options using defined parameters and preview command
local _main_choice
Expand Down
2 changes: 1 addition & 1 deletion tkginstaller.sh.sha256sum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5d86cecb22eea5302c52b725fdd190a195f7a3cc22295bb4515d501d2c7ca158
30dceeaa4d55753e02df72000c41d5b58b3f0cb6a8a708f064deaf9c3603c404