Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📃 fix: replace every ~ AND ,, for posix compliance #666

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/tabs/applications-setup/dwmtitus-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ picom_animations() {

clone_config_folders() {
# Ensure the target directory exists
[ ! -d ~/.config ] && mkdir -p ~/.config
[ ! -d "$HOME/.config" ] && mkdir -p "$HOME/.config"

# Iterate over all directories in config/*
for dir in config/*/; do
Expand All @@ -138,7 +138,7 @@ clone_config_folders() {

# Clone the directory to ~/.config/
if [ -d "$dir" ]; then
cp -r "$dir" ~/.config/
cp -r "$dir" "$HOME/.config/"
printf "%b\n" "${GREEN}Cloned $dir_name to ~/.config/${RC}"
else
printf "%b\n" "${RED}Directory $dir_name does not exist, skipping${RC}"
Expand All @@ -157,7 +157,7 @@ configure_backgrounds() {
if [ ! -d "$PIC_DIR" ]; then
# If it doesn't exist, print an error message and return with a status of 1 (indicating failure)
printf "%b\n" "${RED}Pictures directory does not exist${RC}"
mkdir ~/Pictures
mkdir "$HOME/Pictures"
printf "%b\n" "${GREEN}Directory was created in Home folder${RC}"
fi

Expand Down
4 changes: 2 additions & 2 deletions core/tabs/applications-setup/mybash-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ installStarshipAndFzf() {
if command_exists fzf; then
printf "%b\n" "${GREEN}Fzf already installed${RC}"
else
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
"$ESCALATION_TOOL" ~/.fzf/install
git clone --depth 1 https://github.com/junegunn/fzf.git "$HOME/.fzf"
"$ESCALATION_TOOL" "$HOME/.fzf/install"
fi
}

Expand Down
24 changes: 12 additions & 12 deletions core/tabs/utils/ssh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
. ../common-script.sh

# Check if ~/.ssh/config exists, if not, create it
if [ ! -f ~/.ssh/config ]; then
touch ~/.ssh/config
chmod 600 ~/.ssh/config
if [ ! -f "$HOME/.ssh/config" ]; then
touch "$HOME/.ssh/config"
chmod 600 "$HOME/.ssh/config"
fi

# Function to show available hosts from ~/.ssh/config
show_available_hosts() {
printf "%b\n" "Available Systems:"
grep -E "^Host " ~/.ssh/config | awk '{print $2}'
grep -E "^Host " "$HOME/.ssh/config" | awk '{print $2}'
printf "%b\n" "-------------------"
}

Expand All @@ -27,18 +27,18 @@ ask_for_host_details() {
printf "%b\n" "Host $host_alias"
printf "%b\n" " HostName $host"
printf "%b\n" " User $user"
printf "%b\n" " IdentityFile ~/.ssh/id_rsa"
printf "%b\n" " IdentityFile $HOME/.ssh/id_rsa"
printf "%b\n" " StrictHostKeyChecking no"
printf "%b\n" " UserKnownHostsFile=/dev/null"
} >> ~/.ssh/config
} >> "$HOME/.ssh/config"
printf "%b\n" "Host $host_alias added successfully."
}

# Function to generate SSH key if not exists
generate_ssh_key() {
if [ ! -f ~/.ssh/id_rsa ]; then
if [ ! -f "$HOME/.ssh/id_rsa" ]; then
printf "%b\n" "SSH key not found, generating one..."
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N "" -C "$(whoami)@$(hostname)"
ssh-keygen -t rsa -b 4096 -f "$HOME/.ssh/id_rsa -N" "" -C "$(whoami)@$(hostname)"
else
printf "%b\n" "SSH key already exists."
fi
Expand Down Expand Up @@ -150,7 +150,7 @@ move_directory_to_remote() {
remove_system() {
printf "%b\n" "Enter the alias of the host to remove: "
read -r host_alias
sed -i "/^Host $host_alias/,+3d" ~/.ssh/config
sed -i "/^Host $host_alias/,+3d" "$HOME/.ssh/config"
printf "%b\n" "Removed $host_alias from SSH configuration."
}

Expand All @@ -159,9 +159,9 @@ view_ssh_config() {
printf "%b\n" "Enter the alias of the host to view (or press Enter to view all): "
read -r host_alias
if [ -z "$host_alias" ]; then
cat ~/.ssh/config
cat "$HOME/.ssh/config"
else
grep -A 3 "^Host $host_alias" ~/.ssh/config
grep -A 3 "^Host $host_alias" "$HOME/.ssh/config"
fi
}

Expand Down Expand Up @@ -249,4 +249,4 @@ done

checkEnv
checkEscalationTool
main
main
Loading