add apt-cacher
This commit is contained in:
parent
d9cfffa661
commit
6f1169f204
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/bash
|
||||||
|
sudo apt install squid-deb-proxy-client
|
|
@ -1,14 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit immediately if a command exits with a non-zero status.
|
# Default terminal icon value (empty if not provided)
|
||||||
set -e
|
terminal_icon=""
|
||||||
|
|
||||||
# Default icon value (empty if not provided)
|
|
||||||
icon=""
|
|
||||||
|
|
||||||
# Function to display script usage
|
# Function to display script usage
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: $0 [--icon <nerd font symbol>]"
|
echo "Usage: $0 [--terminal-icon <nerd font symbol>]"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,8 +14,8 @@ while [[ $# -gt 0 ]]; do
|
||||||
key="$1"
|
key="$1"
|
||||||
|
|
||||||
case $key in
|
case $key in
|
||||||
--icon)
|
--terminal-icon)
|
||||||
icon="$2"
|
terminal_icon="$2"
|
||||||
shift # past argument
|
shift # past argument
|
||||||
shift # past value
|
shift # past value
|
||||||
;;
|
;;
|
||||||
|
@ -29,57 +26,17 @@ while [[ $# -gt 0 ]]; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Function to install Fish shell
|
configure_terminal() {
|
||||||
install_fish() {
|
echo "Configuring terminal..."
|
||||||
echo "Installing Fish shell..."
|
sudo chmod +x ./terminal/setup.sh
|
||||||
sudo apt update
|
./terminal/setup.sh --icon "$terminal_icon"
|
||||||
sudo apt install -y fish
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to set Fish as the default shell
|
|
||||||
set_default_fish() {
|
|
||||||
echo "Setting Fish as the default shell..."
|
|
||||||
chsh -s $(which fish)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install Starship
|
configure_apt_cacher() {
|
||||||
install_starship() {
|
echo "Configuring apt-cacher..."
|
||||||
echo "Installing Starship..."
|
sudo chmod +x ./apt-cacher/setup.sh
|
||||||
curl -sS https://starship.rs/install.sh | sh -s -- -y
|
./apt-cacher/setup.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to configure Starship for Fish
|
configure_terminal
|
||||||
configure_starship() {
|
configure_apt_cacher
|
||||||
echo "Configuring Starship for Fish..."
|
|
||||||
mkdir -p ~/.config/fish
|
|
||||||
echo 'starship init fish | source' >> ~/.config/fish/config.fish
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to overwrite starship.toml
|
|
||||||
overwrite_starship_toml() {
|
|
||||||
if [ -f "./terminal/starship.toml" ]; then
|
|
||||||
echo "Overwriting starship.toml..."
|
|
||||||
cp ./terminal/starship.toml ~/.config/starship.toml
|
|
||||||
|
|
||||||
# Check if icon parameter is provided
|
|
||||||
if [ ! -z "$icon" ]; then
|
|
||||||
echo "Adding icon [$icon](bg:color_purple fg:color_white) to starship.toml..."
|
|
||||||
# Escape special characters in icon variable for sed
|
|
||||||
escaped_icon=$(printf '%s\n' "$icon" | sed -e 's/[]\/$*.^[]/\\&/g')
|
|
||||||
sed -i "5i\[$escaped_icon](fg:color_white bg:color_purple)\\\\" ~/.config/starship.toml
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "starship.toml not found in the repository."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Main script execution
|
|
||||||
install_fish
|
|
||||||
set_default_fish
|
|
||||||
install_starship
|
|
||||||
configure_starship
|
|
||||||
overwrite_starship_toml
|
|
||||||
|
|
||||||
echo "Fish shell and Starship prompt setup complete!"
|
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Exit immediately if a command exits with a non-zero status.
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Default icon value (empty if not provided)
|
||||||
|
icon=""
|
||||||
|
|
||||||
|
# Function to display script usage
|
||||||
|
usage() {
|
||||||
|
echo "Usage: $0 [--icon <nerd font symbol>]"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Parse command-line options
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
key="$1"
|
||||||
|
|
||||||
|
case $key in
|
||||||
|
--icon)
|
||||||
|
icon="$2"
|
||||||
|
shift # past argument
|
||||||
|
shift # past value
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# unknown option
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Function to install Fish shell
|
||||||
|
install_fish() {
|
||||||
|
echo "Installing Fish shell..."
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y fish
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to set Fish as the default shell
|
||||||
|
set_default_fish() {
|
||||||
|
echo "Setting Fish as the default shell..."
|
||||||
|
chsh -s $(which fish)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install Starship
|
||||||
|
install_starship() {
|
||||||
|
echo "Installing Starship..."
|
||||||
|
curl -sS https://starship.rs/install.sh | sh -s -- -y
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to configure Starship for Fish
|
||||||
|
configure_starship() {
|
||||||
|
echo "Configuring Starship for Fish..."
|
||||||
|
mkdir -p ~/.config/fish
|
||||||
|
echo 'starship init fish | source' >> ~/.config/fish/config.fish
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to overwrite starship.toml
|
||||||
|
overwrite_starship_toml() {
|
||||||
|
if [ -f "./terminal/starship.toml" ]; then
|
||||||
|
echo "Overwriting starship.toml..."
|
||||||
|
cp ./terminal/starship.toml ~/.config/starship.toml
|
||||||
|
|
||||||
|
# Check if icon parameter is provided
|
||||||
|
if [ ! -z "$icon" ]; then
|
||||||
|
echo "Adding icon [$icon](bg:color_purple fg:color_white) to starship.toml..."
|
||||||
|
# Escape special characters in icon variable for sed
|
||||||
|
escaped_icon=$(printf '%s\n' "$icon" | sed -e 's/[]\/$*.^[]/\\&/g')
|
||||||
|
sed -i "5i\[$escaped_icon](fg:color_white bg:color_purple)\\\\" ~/.config/starship.toml
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "starship.toml not found in the repository."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main script execution
|
||||||
|
install_fish
|
||||||
|
set_default_fish
|
||||||
|
install_starship
|
||||||
|
configure_starship
|
||||||
|
overwrite_starship_toml
|
||||||
|
|
||||||
|
echo "Fish shell and Starship prompt setup complete!"
|
Loading…
Reference in New Issue