First stab at generic install method

This commit is contained in:
2023-03-15 17:32:59 -04:00
parent 3ca121d7f3
commit 9c5e25e574

View File

@@ -25,6 +25,7 @@ declare -g MCVERSION_HARDCODE="${MCVERSION:-"30.0.72"}" # Hardcoded fallback
declare -g CREATEREPO_WEBROOT="/var/www/jriver" declare -g CREATEREPO_WEBROOT="/var/www/jriver"
declare -g USER="${SUDO_USER:-$USER}" declare -g USER="${SUDO_USER:-$USER}"
declare -g HOME; HOME=$(getent passwd "$USER" | cut -d: -f6) declare -g HOME; HOME=$(getent passwd "$USER" | cut -d: -f6)
declare -g SCRIPTDIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
printHelp() { printHelp() {
debug "Running: ${FUNCNAME[0]}" debug "Running: ${FUNCNAME[0]}"
@@ -329,13 +330,15 @@ init() {
ID="arch" ID="arch"
else else
err "OS detection failed!" err "OS detection failed!"
askOk "" askOk "Continue with manual installation?" || exit 1
ID="unknown" ID="unknown"
exit 1 REPO_INSTALL_SWITCH=0
BUILD_SWITCH=1
LOCAL_INSTALL_SWITCH=1
fi fi
esac esac
debug "Using host platform: $ID $VERSION_ID" [[ $ID != "unknown" ]] && debug "Using host platform: $ID $VERSION_ID"
# Abstract distro-specific package manager commands # Abstract distro-specific package manager commands
case "$ID" in case "$ID" in
@@ -368,7 +371,7 @@ init() {
PKG_INSTALL_LOCAL(){ installMCARCH; } PKG_INSTALL_LOCAL(){ installMCARCH; }
;; ;;
unknown) unknown)
PKG_INSTALL_LOCAL(){ installMCRAW; } PKG_INSTALL_LOCAL(){ installMCGENERIC; }
esac esac
} }
@@ -846,10 +849,26 @@ installMCRPM() {
####################################### #######################################
# Installs Media Center manually # Installs Media Center manually
####################################### #######################################
installMCRAW() { installMCGENERIC() {
debug "Running: ${FUNCNAME[0]}" debug "Running: ${FUNCNAME[0]}"
echo "Using raw installation method!"
declare extract_dir && extract_dir="$(mktemp -d)"
pushd "$extract_dir" &>/dev/null || return
ar x "$MCDEB"
tar xvf "control.tar.gz"
echo "You must install the following dependencies manually:"
cat control
tar xvf "data.tar.gz"
pushd data &>/dev/null || return
# Add list of files to log for uninstall
find . -mindepth 1 >> "$SCRIPTDIR/.uninstall"
# Manually install files
sudo cp -a ./etc/* /etc/
sudo cp -a ./usr/* /usr/
popd -1 &>/dev/null || return
popd &>/dev/null || return
} }
@@ -1619,6 +1638,14 @@ uninstall() {
else else
err "Could not remove Media Center package" err "Could not remove Media Center package"
fi fi
if [[ -f "$SCRIPTDIR/.uninstall" ]]; then
echo "Removing files from .uninstall log"
while read -r p; do
[[ -d $p ]] && sudo rm -rf "$p"
done < "$SCRIPTDIR/.uninstall"
mv "$SCRIPTDIR/.uninstall" "$SCRIPTDIR/.uninstall.bk"
fi
} }