2024-09-30 17:43:10 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Ensure the script stops executing if an error occurs
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Update the system's package list
|
|
|
|
echo "Updating system package list..."
|
|
|
|
sudo apt update
|
|
|
|
|
|
|
|
# Install necessary tools
|
|
|
|
echo "Installing gnupg and curl..."
|
|
|
|
sudo apt install -y gnupg curl
|
|
|
|
|
|
|
|
# Add GPG key to the system
|
|
|
|
echo "Adding GPG key..."
|
|
|
|
curl https://source.moyanjdc.top/deb/gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/moyan.gpg
|
|
|
|
|
|
|
|
# Add the repository to the system's sources.list.d directory
|
|
|
|
echo "Adding repository..."
|
2024-09-30 18:19:11 +08:00
|
|
|
mkdir -p /etc/apt/sources.list.d
|
2024-09-30 17:43:10 +08:00
|
|
|
echo "deb [signed-by=/usr/share/keyrings/moyan.gpg] https://source.moyanjdc.top/deb/ debs main" | sudo tee /etc/apt/sources.list.d/moyan.list
|
|
|
|
|
|
|
|
# Update the package list to include the newly added repository
|
|
|
|
echo "Updating package list..."
|
|
|
|
sudo apt update
|
|
|
|
|
|
|
|
# Print completion message
|
|
|
|
echo "Third-party repository added successfully."
|