Skip to content

Commit

Permalink
Run install.bash isolated
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthijsBurgh committed Dec 4, 2023
1 parent 0d447bf commit ab6a2ba
Showing 1 changed file with 79 additions and 1 deletion.
80 changes: 79 additions & 1 deletion installer/tue-install-impl.bash
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ function date_stamp
date +%Y_%m_%d_%H_%M_%S
}

export -f date_stamp

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function version_gt()
{
test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1";
}

export -f version_gt

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-error
Expand All @@ -54,6 +58,8 @@ Logfile: $INSTALL_DETAILS_FILE
exit 1
}

export -f tue-install-error

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-warning
Expand All @@ -62,6 +68,8 @@ function tue-install-warning
TUE_INSTALL_WARNINGS=" [$TUE_INSTALL_CURRENT_TARGET] $*\n${TUE_INSTALL_WARNINGS}"
}

export -f tue-install-warning

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-info
Expand All @@ -70,6 +78,8 @@ function tue-install-info
TUE_INSTALL_INFOS=" [$TUE_INSTALL_CURRENT_TARGET] $*\n${TUE_INSTALL_INFOS}"
}

export -f tue-install-info

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-debug
Expand All @@ -82,20 +92,26 @@ function tue-install-debug
fi
}

export -f tue-install-debug

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-echo
{
echo -e "\e[0;1m[$TUE_INSTALL_CURRENT_TARGET]: $*\e[0m" | tee --append "$INSTALL_DETAILS_FILE"
}

export -f tue-install-echo

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-tee
{
echo -e "$*" | tee --append "$INSTALL_DETAILS_FILE"
}

export -f tue-install-tee

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-pipe
Expand All @@ -111,6 +127,8 @@ function tue-install-pipe
return $return_code
}

export -f tue-install-pipe

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function _remove_old_target_dep_recursively
Expand Down Expand Up @@ -191,6 +209,8 @@ function _remove_old_target_dep_recursively
return ${error_code}
}

export -f _remove_old_target_dep_recursively

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-target-now
Expand All @@ -205,6 +225,8 @@ function tue-install-target-now
return $?
}

export -f tue-install-target-now

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-target
Expand Down Expand Up @@ -334,7 +356,7 @@ function tue-install-target
else
tue-install-debug "Sourcing $install_file.bash"
# shellcheck disable=SC1090
source "$install_file".bash
(source "${install_file}".bash)
tue-install-debug "Done: Sourcing $install_file.bash"
fi
target_processed=true
Expand Down Expand Up @@ -381,6 +403,8 @@ function tue-install-target
tue-install-debug "Finished installing $target"
}

export -f tue-install-target

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function _show_update_message
Expand All @@ -398,6 +422,8 @@ function _show_update_message
fi
}

export -f _show_update_message

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function _try_branch_git
Expand Down Expand Up @@ -440,6 +466,8 @@ function _try_branch_git
return ${_checkout_error_code}
}

export -f _try_branch_git

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-git
Expand Down Expand Up @@ -573,6 +601,8 @@ function tue-install-git
_show_update_message "$TUE_INSTALL_CURRENT_TARGET" "$res"
}

export -f tue-install-git

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-apply-patch
Expand All @@ -599,6 +629,8 @@ function tue-install-apply-patch
patch -s -N -r - -p0 -d "$TUE_INSTALL_PKG_DIR" < "$patch_file"
}

export -f tue-install-apply-patch

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-cp
Expand Down Expand Up @@ -660,6 +692,8 @@ Command: tue-install-cp $*"
done
}

export -f tue-install-cp

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-ln
Expand Down Expand Up @@ -745,6 +779,8 @@ Command: tue-install-ln $*"
fi
}

export -f tue-install-ln

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# Reads SOURCE_FILE and looks in TARGET_FILE for the first and last line of SOURCE_FILE. If these
Expand Down Expand Up @@ -844,6 +880,8 @@ function tue-install-add-text
fi
}

export -f tue-install-add-text

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-get-releases
Expand Down Expand Up @@ -871,6 +909,8 @@ function tue-install-get-releases
tue-install-error "Failed to get '$filename' from '$repo_short_url'"
}

export -f tue-install-get-releases

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-system
Expand All @@ -885,6 +925,8 @@ function tue-install-system
TUE_INSTALL_SYSTEMS="$1 $TUE_INSTALL_SYSTEMS"
}

export -f tue-install-system

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-system-now
Expand Down Expand Up @@ -946,6 +988,8 @@ function tue-install-system-now
fi
}

export -f tue-install-system-now

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-apt-get-update
Expand All @@ -955,6 +999,8 @@ function tue-install-apt-get-update
rm -f $TUE_APT_GET_UPDATED_FILE
}

export -f tue-install-apt-get-update

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-ppa
Expand All @@ -976,6 +1022,8 @@ function tue-install-ppa
TUE_INSTALL_PPA="${TUE_INSTALL_PPA} ${ppa// /^}" # Replace space by ^ to support for-loops later
}

export -f tue-install-ppa

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-ppa-now
Expand Down Expand Up @@ -1056,6 +1104,8 @@ function tue-install-ppa-now
fi
}

export -f tue-install-ppa-now

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function _tue-install-pip
Expand All @@ -1079,17 +1129,23 @@ function _tue-install-pip
declare -g "$list"="$name ${!list}"
}

export -f _tue-install-pip

# Needed for backward compatibility
function tue-install-pip
{
_tue-install-pip "3" "$@"
}

export -f tue-install-pip

function tue-install-pip3
{
_tue-install-pip "3" "$@"
}

export -f tue-install-pip3

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function _tue-install-pip-now
Expand Down Expand Up @@ -1202,6 +1258,8 @@ function _tue-install-pip-now
fi
}

export -f _tue-install-pip-now

function _tue-install-pip-check
{
tue-install-debug "_tue-install-pip-check $*"
Expand Down Expand Up @@ -1243,17 +1301,23 @@ function _tue-install-pip-check
done
}

export -f _tue-install-pip-check

# Needed for backward compatibility
function tue-install-pip-now
{
_tue-install-pip-now "3" "$@"
}

export -f tue-install-pip-now

function tue-install-pip3-now
{
_tue-install-pip-now "3" "$@"
}

export -f tue-install-pip3-now

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-snap
Expand All @@ -1268,6 +1332,8 @@ function tue-install-snap
TUE_INSTALL_SNAPS="$1 $TUE_INSTALL_SNAPS"
}

export -f tue-install-snap

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-snap-now
Expand Down Expand Up @@ -1304,6 +1370,8 @@ function tue-install-snap-now
fi
}

export -f tue-install-snap-now

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-gem
Expand All @@ -1318,6 +1386,8 @@ function tue-install-gem
TUE_INSTALL_GEMS="$1 $TUE_INSTALL_GEMS"
}

export -f tue-install-gem

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-gem-now
Expand Down Expand Up @@ -1352,6 +1422,8 @@ function tue-install-gem-now
fi
}

export -f tue-install-gem-now

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-dpkg-now
Expand All @@ -1361,6 +1433,8 @@ function tue-install-dpkg-now
tue-install-dpkg "$@"
}

export -f tue-install-dpkg-now

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-dpkg
Expand All @@ -1375,6 +1449,8 @@ function tue-install-dpkg
tue-install-pipe sudo apt-get --fix-broken --assume-yes -q install || tue-install-error "An error occured while fixing dpkg install"
}

export -f tue-install-dpkg

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function tue-install-ros
Expand Down Expand Up @@ -1519,6 +1595,8 @@ function tue-install-ros
TUE_INSTALL_PKG_DIR=$ros_pkg_dir
}

export -f tue-install-ros

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function _missing_targets_check
Expand Down

0 comments on commit ab6a2ba

Please sign in to comment.