#!/bin/bash if ! [ -t 0 ]; then echo "exec from pipe" DOWNLOAD_APP=y APP_DIR="$HOME/.local/share/madumlao-profile" else DOWNLOAD_APP= APP_DIR="$(dirname "$0")" fi if [ "$DOWNLOAD_APP" ]; then echo "Downloading master copy" PARENT_DIR="$(dirname "$APP_DIR")" mkdir -pv "$PARENT_DIR" if [ -x git ]; then cd "$PARENT_DIR" git clone https://gitea.madumlao.com/madumlao/madumlao-profile else curl -o madumlao-profile-master.tar.gz https://gitea.madumlao.com/madumlao/madumlao-profile/archive/master.tar.gz tar -zxf madumlao-profile-master.tar.gz -C "$PARENT_DIR" fi fi echo "Set pwd to $APP_DIR" cd "$APP_DIR" APP_DIR="$(pwd)" if [ "$(uname)" == "Linux" ]; then # detect WSL if uname -r | grep -q WSL > /dev/null; then export PROFILE_WSL=y fi source /etc/os-release export PROFILE_DISTRO="$ID" export PROFILE_DISTRO_VERSION="$VERSION_ID" export PROFILE_DISTRO_CODENAME="$VERSION_CODENAME" export PROFILE_DISTRO_FAMILY="$ID_LIKE" case "$PROFILE_DISTRO" in ubuntu ) ./install-ubuntu.sh ;; ol | rhel ) ./install-rhel.sh ;; * ) echo "Unknown distro, install manually" esac elif [ "$(uname)" == "Darwin" ]; then echo TODO: install-macos.sh else echo Unsupported environment, need to manual install fi