[IN PROGRESS] pratham-setup: make script more robust by checking if said steps are already completed successfully or not
This commit is contained in:
parent
98b91551ef
commit
cd048877b3
|
@ -32,40 +32,84 @@ kwriteconfig5 --file startkderc --group General --key systemdBoot true
|
||||||
# SSH KEYS
|
# SSH KEYS
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
# checking func
|
||||||
|
function generate_keys()
|
||||||
|
{
|
||||||
|
if [[ ! -f "$1" && ! -f "$1"".pub" ]]; then
|
||||||
|
ssh-keygen -f ed25519 -f $1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# create ssh keys
|
# create ssh keys
|
||||||
if [[ ! -d $HOME/.ssh ]]; then
|
if [[ ! -d $HOME/.ssh ]]; then
|
||||||
mkdir $HOME/.ssh
|
mkdir $HOME/.ssh
|
||||||
chmod 700 $HOME/.ssh
|
chmod 700 $HOME/.ssh
|
||||||
fi
|
fi
|
||||||
pushd $HOME/.ssh
|
pushd $HOME/.ssh
|
||||||
ssh-keygen -t ed25519 -f bluefeds
|
generate_keys "bluefeds"
|
||||||
ssh-keygen -t ed25519 -f flameboi
|
generate_keys "flameboi"
|
||||||
ssh-keygen -t ed25519 -f gitea
|
generate_keys "gitea"
|
||||||
ssh-keygen -t ed25519 -f github
|
generate_keys "github"
|
||||||
ssh-keygen -t ed25519 -f gitlab
|
generate_keys "gitlab"
|
||||||
ssh-keygen -t ed25519 -f sentinel
|
generate_keys "sentinel"
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# IP address for server is hidden behind cloudflare proxy
|
################################################################################
|
||||||
tput -x clear
|
# CUSTOM HOSTNAME FOR git.thefossguy.com
|
||||||
cat <<EOF > $HOME/.ssh/config
|
################################################################################
|
||||||
|
|
||||||
|
# check for an empty hostname in ~/.ssh/config
|
||||||
|
if [[ ! -f $HOME/.ssh/config ]]; then
|
||||||
|
EDIT_SSH_CONF=true
|
||||||
|
elif
|
||||||
|
CONTENTS_OF_SSH_CONF=$(grep -A 1 "git.thefossguy.com" ~/.ssh/config | tail -n 1 | rev)
|
||||||
|
|
||||||
|
if [[ "${CONTENTS_OF_SSH_CONF::1}" != "5" ]]; then
|
||||||
|
EDIT_SSH_CONF=true
|
||||||
|
else
|
||||||
|
EDIT_SSH_CONF=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# set the hostname
|
||||||
|
if [[ $EDIT_SSH_CONF == true ]]; then
|
||||||
|
tput -x clear
|
||||||
|
cat <<EOF > $HOME/.ssh/config
|
||||||
Host git.thefossguy.com
|
Host git.thefossguy.com
|
||||||
Hostname ::?
|
Hostname ::?
|
||||||
User git
|
User git
|
||||||
IdentityFile ~/.ssh/gitea
|
IdentityFile ~/.ssh/gitea
|
||||||
Port 22
|
Port 22
|
||||||
EOF
|
EOF
|
||||||
cat $HOME/.ssh/gitea.pub
|
cat $HOME/.ssh/gitea.pub
|
||||||
echo "Populate Hostname (IP addr) for \"git.thefossguy.com\" in ~/.ssh/config"
|
echo "Populate Hostname (IP addr) for \"git.thefossguy.com\" in ~/.ssh/config"
|
||||||
bash
|
bash
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# SETUP DEV ENVIRONMENT
|
# SETUP DEV ENVIRONMENT
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
# clone repos
|
||||||
|
function git_repo_check()
|
||||||
|
{
|
||||||
|
pushd $HOME/my-git-repos
|
||||||
|
if [[ ! -d "$1" ]]; then
|
||||||
|
git clone git@git.thefossguy.com:thefossguy/"$1"
|
||||||
|
else
|
||||||
|
pushd "$1"
|
||||||
|
tput -x clear
|
||||||
|
git fetch
|
||||||
|
git pull
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
# rust-lang
|
# rust-lang
|
||||||
#curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh (removed because paru has a hard dependency on Arch's cargo; this is handled by the `rustup` package)
|
|
||||||
rustup default stable
|
rustup default stable
|
||||||
rustup component add rust-src rust-analyzer
|
rustup component add rust-src rust-analyzer
|
||||||
rustup component add rust-analysis
|
rustup component add rust-analysis
|
||||||
|
@ -80,10 +124,8 @@ sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.
|
||||||
echo -ne "\n\n\n\n"
|
echo -ne "\n\n\n\n"
|
||||||
|
|
||||||
mkdir -p $HOME/my-git-repos
|
mkdir -p $HOME/my-git-repos
|
||||||
pushd $HOME/my-git-repos/
|
git_repo_check "dotfiles"
|
||||||
git clone git@git.thefossguy.com:thefossguy/dotfiles-priv.git
|
git_repo_check "dotfiles-priv"
|
||||||
git clone git@git.thefossguy.com:thefossguy/dotfiles.git
|
|
||||||
popd
|
|
||||||
|
|
||||||
rsync \
|
rsync \
|
||||||
--verbose --recursive --size-only --human-readable \
|
--verbose --recursive --size-only --human-readable \
|
||||||
|
|
Loading…
Reference in New Issue