Skip to content

Commit

Permalink
🐛 symlink with sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
ras0q committed Dec 13, 2024
1 parent 59eaa00 commit 0d88089
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ mkdir -p $backup_dir
echo "*" > $backup_dir/.gitignore

function symlink() {
[[ -e $2 ]] && mv $2 $backup_dir
ln -sfn $1 $2
sudo_prefix=""
[[ $2 == $HOME/* ]] || sudo_prefix="sudo"
[[ -e $2 ]] && $sudo_prefix mv $2 $backup_dir
$sudo_prefix ln -sfn $1 $2
}

set -x
Expand All @@ -53,7 +55,7 @@ case "$os" in
Linux)
if [[ "$(uname -r)" == *-microsoft-standard-WSL2 ]]; then
symlink $root/common/vscode/settings.json ~/.vscode-server/data/Machine/settings.json
$sudoer_mode && sudo symlink $root/wsl/wsl.conf /etc/wsl.conf
$sudoer_mode && symlink $root/wsl/wsl.conf /etc/wsl.conf
fi

if command -v apt >/dev/null 2>&1; then
Expand Down

0 comments on commit 0d88089

Please sign in to comment.