WSL fixes
This commit is contained in:
@@ -10,7 +10,7 @@ push_all() {
|
||||
printfe "%s\n" "cyan" "Pushing all changes to all remotes..."
|
||||
|
||||
# For each remote, push all changes
|
||||
for remote in $remotes; do
|
||||
for remote in "${remotes[@]}"; do
|
||||
printfe "%s" "green" " - Pushing to ["
|
||||
printfe "%s" "blue" "$remote"
|
||||
printfe "%s\n" "green" "]..."
|
||||
|
@@ -8,23 +8,43 @@ source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
printfe "%s\n" "cyan" "Fetching password from 1Password..."
|
||||
echo -en '\r'
|
||||
|
||||
# if WSL alias op to op.exe
|
||||
if [[ $(uname -a) == *"microsoft-standard-WSL2"* ]]; then
|
||||
alias op="op.exe"
|
||||
if is_wsl; then
|
||||
output=$(op.exe item get "Dotfiles Secrets" --fields password)
|
||||
else
|
||||
alias op="op"
|
||||
output=$(op item get "Dotfiles Secrets" --fields password)
|
||||
fi
|
||||
|
||||
output=$(op item get "Dotfiles Secrets" --fields password)
|
||||
|
||||
# Check if the password was found
|
||||
if [[ -z "$output" ]]; then
|
||||
printfe "%s\n" "red" "Password not found in 1Password, add a login item with the name 'Dotfiles Secrets' and give it a password."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
command=$(echo "$output" | grep -oP "(?<=use ').*(?=')")
|
||||
password=$(eval $command | grep -oP "(?<= password: ).*" | tr -d '\n')
|
||||
token=$(echo "$output" | grep -oP "(?<=\[use 'op item get ).*(?= --)")
|
||||
printfe "%s\n" "cyan" "Got fetch token: $token"
|
||||
|
||||
if is_wsl; then
|
||||
password=$(op.exe item get $token --reveal --field password)
|
||||
else
|
||||
password=$(op item get $token --reveal --fields password)
|
||||
fi
|
||||
|
||||
# only continue if password isn't empty
|
||||
if [[ -z "$password" ]]; then
|
||||
printfe "%s\n" "red" "Something went wrong while fetching the password from 1Password."
|
||||
|
||||
# Ask for manual input
|
||||
printfe "%s" "cyan" "Enter the password manually: "
|
||||
read -s password
|
||||
echo
|
||||
|
||||
if [[ -z "$password" ]]; then
|
||||
printfe "%s\n" "red" "Password cannot be empty."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printfe "%s\n" "green" "Password entered successfully."
|
||||
fi
|
||||
|
||||
encrypt_folder() {
|
||||
for file in $1/*; do
|
||||
|
@@ -11,6 +11,11 @@ countdown() {
|
||||
}
|
||||
|
||||
run_startup_scripts() {
|
||||
if is_wsl; then
|
||||
echo "Running in WSL, skipping startup scripts."
|
||||
return
|
||||
fi
|
||||
|
||||
logo continue
|
||||
echo ""
|
||||
local time_of_day
|
||||
|
@@ -97,7 +97,7 @@ symlinks() {
|
||||
symlinks=($(cat $HOME/dotfiles/config/config.yaml | shyaml keys config.symlinks))
|
||||
printfe "%s\n" "cyan" "Updating symlinks..."
|
||||
|
||||
for symlink in $symlinks; do
|
||||
for symlink in "${symlinks[@]}"; do
|
||||
ensure_symlink $symlink
|
||||
done
|
||||
}
|
||||
@@ -155,6 +155,11 @@ pipxpkgs() {
|
||||
}
|
||||
|
||||
flatpakpkgs() {
|
||||
if is_wsl; then
|
||||
printfe "%s\n" "yellow" "Running in WSL, skipping Flatpak."
|
||||
return
|
||||
fi
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring Flatpak packages are installed..."
|
||||
source $HOME/dotfiles/bin/helpers/flatpak_packages.sh
|
||||
ensure_flatpak_packages_installed
|
||||
@@ -167,12 +172,22 @@ dockercmd() {
|
||||
}
|
||||
|
||||
tailscalecmd() {
|
||||
if is_wsl; then
|
||||
printfe "%s\n" "yellow" "Running in WSL, skipping Tailscale."
|
||||
return
|
||||
fi
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring Tailscale is installed..."
|
||||
source $HOME/dotfiles/bin/helpers/tailscale.sh
|
||||
ensure_tailscale_installed
|
||||
}
|
||||
|
||||
extensions() {
|
||||
if is_wsl; then
|
||||
printfe "%s\n" "yellow" "Running in WSL, skipping extensions."
|
||||
return
|
||||
fi
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring GNOME Extensions are installed..."
|
||||
source $HOME/dotfiles/bin/helpers/gnome_extensions.sh
|
||||
ensure_gnome_extensions_installed
|
||||
@@ -194,18 +209,33 @@ extensions() {
|
||||
####################################################################################################
|
||||
|
||||
keyboard() {
|
||||
if is_wsl; then
|
||||
printfe "%s\n" "yellow" "Running in WSL, skipping keyboard shortcuts."
|
||||
return
|
||||
fi
|
||||
|
||||
printfe "%s\n" "cyan" "Setting up keyboard shortcuts..."
|
||||
source $HOME/dotfiles/bin/helpers/keyboard_shortcuts.sh
|
||||
ensure_keyboard_shortcuts
|
||||
}
|
||||
|
||||
fonts() {
|
||||
if is_wsl; then
|
||||
printfe "%s\n" "yellow" "Running in WSL, skipping fonts."
|
||||
return
|
||||
fi
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring fonts are installed..."
|
||||
source $HOME/dotfiles/bin/helpers/fonts.sh
|
||||
ensure_fonts_installed
|
||||
}
|
||||
|
||||
terminal() {
|
||||
if is_wsl; then
|
||||
printfe "%s\n" "yellow" "Running in WSL, skipping setting default terminal."
|
||||
return
|
||||
fi
|
||||
|
||||
printfe "%s\n" "cyan" "Setting gnome-terminal as default terminal..."
|
||||
if [ -x "$(command -v gnome-terminal)" ]; then
|
||||
current_terminal=$(sudo update-alternatives --query x-terminal-emulator | grep '^Value:' | awk '{print $2}')
|
||||
@@ -270,8 +300,8 @@ if [ "$#" -eq 0 ]; then
|
||||
aptpkgs
|
||||
cargopkgs
|
||||
pipxpkgs
|
||||
flatpakpkgs
|
||||
dockercmd
|
||||
flatpakpkgs
|
||||
tailscalecmd
|
||||
extensions
|
||||
keyboard
|
||||
|
Reference in New Issue
Block a user