Skip to content

Commit

Permalink
feat: adds kiauh module for homebrewed images (mainsail-crew#184)
Browse files Browse the repository at this point in the history
* feat: adds kiauh module for homebrewed images

This allows forks to add kiauh to their Image with ease.

Signed-off-by: Stephan Wendel <me@stephanwe.de>

---------

Signed-off-by: Stephan Wendel <me@stephanwe.de>
  • Loading branch information
KwadFan committed Oct 28, 2023
1 parent 6ef2e2b commit 146cfb5
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/modules/kiauh/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
#### KIAUH Install Module
####
#### Written by Stephan Wendel aka KwadFan <me@stephanwe.de>
#### Copyright 2022 - till today
#### https://github.com/mainsail-crew/MainsailOS
####
#### This File is distributed under GPLv3
####

#### All Credits to th33xitus for his great tool
#### https://github.com/th33xitus/kiauh

# shellcheck disable=all

# KIAUH repo
[[ -n "$KIAUH_REPO_SHIP" ]] || KIAUH_REPO_SHIP="https://github.com/th33xitus/kiauh.git"
[[ -n "$KIAUH_REPO_BRANCH" ]] || KIAUH_REPO_BRANCH="master"

# Add to $PATH ? (1: yes, 0: no)
[[ -n "$KIAUH_ADD_TO_PATH" ]] || KIAUH_ADD_TO_PATH="1"
45 changes: 45 additions & 0 deletions src/modules/kiauh/start_chroot_script
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
#### KIAUH Install Module
####
#### Written by Stephan Wendel aka KwadFan <me@stephanwe.de>
#### Copyright 2022 - till today
####
#### This File is distributed under GPLv3
####

#### All Credits to th33xitus for his great tool
#### https://github.com/th33xitus/kiauh

# shellcheck enable=requires-variable-braces

# Error handling
set -Ee

# shellcheck disable=SC1091
source /common.sh
install_cleanup_trap


echo_green "Installing sonar ..."

## Step 1: Force apt update
apt-get update --allow-releaseinfo-change

## Step 2: Make sure 'git' is installed!
check_install_pkgs git

## Step 3: Move to Home Dir as WorkingDirectoy
pushd "/home/${BASE_USER}" &> /dev/null || exit 1

## Step 4: clone KIAUH repo
echo_green "Clone KIAUH repository ..."
gitclone KIAUH_REPO kiauh

## Step 5: Link kiauh.sh in /usr/local/bin as kiauh
if [[ ${KIAUH_ADD_TO_PATH} = "1" ]]; then
echo_green "Add kiauh to PATH ..."
sudo ln -s "/home/${BASE_USER}/kiauh/kiauh.sh" "/usr/local/bin/kiauh"
fi

## Finish
echo_green "Installing KIAUH ... DONE!"
13 changes: 13 additions & 0 deletions src/modules/postrename/filesystem/root/postrename
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ fix_mainsailcfg_links() {
ln -sf "${src_dir}/mainsail.cfg" "${config_dir}/mainsail.cfg"
}

# Optional if kiauh module is used
fix_kiauh_links() {
local src_dir target_dir
src_dir="/home/${DEFAULT_USER}/kiauh"
target_dir="/usr/local/bin"
ln -sf "${src_dir}/kiauh.sh" "${target_dir}/kiauh"
}


fix_cn_links() {
local tools_dir
tools_dir="/home/${DEFAULT_USER}/crowsnest/tools"
Expand Down Expand Up @@ -231,6 +240,10 @@ echo -en "${WHITE}Fix broken symlinks ...${NOC}\r"
fix_broken_links
fix_timelapse_links
fix_mainsailcfg_links
# Optional if kiauh module is used
if [[ -d "/home/${DEFAULT_USER}/kiauh" ]]; then
fix_kiauh_links
fi
fix_cn_links
echo -e "${WHITE}Fix broken symlinks ...${NOC}[${GRE}OK${NOC}]"
## do a short break
Expand Down

0 comments on commit 146cfb5

Please sign in to comment.