forked from OnurGumus/Banking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostbuild.sh
executable file
·37 lines (28 loc) · 983 Bytes
/
postbuild.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Remove existing installation
sudo rm -f /usr/bin/dotnet
sudo rm -rf /usr/share/dotnet
# Get script to install .NET if not there
if [ ! -f "dotnet-install.sh" ]; then
wget https://dot.net/v1/dotnet-install.sh
chmod +x dotnet-install.sh
fi
# Install .NET
./dotnet-install.sh --install-dir /usr/share/dotnet --channel 9.0
# Create symbolic link
sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
# Add to shell configurations
DOTNET_ENV='export DOTNET_ROOT=/usr/share/dotnet\nexport PATH=$PATH:$DOTNET_ROOT'
# Update both bash and zsh configs if they exist
if [ -f "$HOME/.bashrc" ]; then
echo -e "$DOTNET_ENV" >> "$HOME/.bashrc"
fi
if [ -f "$HOME/.zshrc" ]; then
echo -e "$DOTNET_ENV" >> "$HOME/.zshrc"
fi
# Set environment variables for current session
export DOTNET_ROOT=/usr/share/dotnet
export PATH=$PATH:$DOTNET_ROOT
# Restore tools
dotnet tool restore
echo "Setup complete. Please restart your shell or run: source ~/.bashrc (or ~/.zshrc)"