From d8dff46fdc97f91d9412d2f375f32c9e2554ed04 Mon Sep 17 00:00:00 2001 From: madumlao Date: Sat, 2 Mar 2024 18:43:44 +0800 Subject: [PATCH] Add quick install instructions --- README.md | 7 +++++++ install.sh | 32 ++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3055f16..81ba5d4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,13 @@ Git repo of my personal shell profile variables ## Installing +### Quick Install + +``` +curl https://raw.githubusercontent.com/madumlao/madumlao-profile/master/install.sh | bash +``` + +### Manual Install Copy this directory somewhere in your home directory. The directory should be persistent, so probably keep this in your "projects" directory or somewhere similar. If in doubt, you can keep this under `.local/share/madumlao-profile`. Next, run the `install.sh` script. It should backup your existing profile and replace it with symlinks to this version. diff --git a/install.sh b/install.sh index 77a3479..049de12 100755 --- a/install.sh +++ b/install.sh @@ -1,13 +1,37 @@ #!/bin/bash -APP_DIR="$(dirname "$0")" -cd "$APP_DIR" -APP_DIR="$(pwd)" +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 echo "Run an apt update" if sudo -l apt; then sudo apt update +else + echo "Unable to run apt commands, please install manually" fi +echo "Install git and friends" +if sudo -l apt; then + sudo apt install git +else + echo "Unable to autoinstall git and friends, please install manually" +fi + +if [ "$DOWNLOAD_APP" ]; then + echo "Downloading master copy" + mkdir -pv "$APP_DIR" + git clone https://github.com/madumlao/madumlao-profile "$APP_DIR" +fi + +echo "Set pwd to $APP_DIR" +cd "$APP_DIR" +APP_DIR="$(pwd)" + echo "Install zsh and friends" if sudo -l apt; then sudo apt install zsh command-not-found @@ -62,7 +86,7 @@ IFS="$OLDIFS" echo "Install vim-nox and friends" if sudo -l apt; then - sudo apt install vim-nox git + sudo apt install vim-nox else echo "Unable to autoinstall vim-nox and friends, please install manually" fi