|
||
---|---|---|
LICENSE | ||
README.md | ||
fed2date.sh |
README.md
Fed2date
Fed2date is a powerful bash script designed for Fedora 38 that streamlines the process of system updates. The script is crafted to handle package updates, cleanup of old packages, handling leftover RPM configuration files, updating Flatpak packages, and cleaning up cached package data.
Usage
You can download, make executable, and run the script on your Fedora system using a single command line:
curl -o fed2date.sh "https://codeberg.org/CYBERHUB/Fed2date/src/branch/master/fed2date.sh" && chmod +x fed2date.sh && sudo ./fed2date.sh
Optionally, you could also copy/paste the entire script and execute it yourself.
#!/bin/bash
# Install necessary dependencies if not already installed
if ! command -v rpmconf &> /dev/null; then
sudo dnf install -y rpmconf
fi
if ! command -v flatpak &> /dev/null; then
sudo dnf install -y flatpak
fi
# Ensure remove-retired-packages is installed
if ! command -v remove-retired-packages &> /dev/null; then
sudo dnf install -y remove-retired-packages
fi
# Starting system updates message
echo -e "\033[1m\033[7mStarting system updates...\033[0m"
# Refreshing the cache
echo "Refreshing the DNF cache..."
sudo dnf -y makecache --refresh
# Update all packages
echo "Updating all packages..."
sudo dnf -y update
# Update the core group packages
echo "Updating the core group packages..."
sudo dnf -y groupupdate core
# Handling RPM configuration files
echo "Handling leftover RPM configuration files..."
sudo rpmconf -a
# Checking for and installing security updates
echo "Checking for security updates..."
SECUP=$(sudo dnf check-update --security | grep updates)
if [ -z "$SECUP" ]
then
echo "No security updates found."
else
echo "Installing security updates..."
sudo dnf update --security -y
fi
# This tool checks which packages has been retired (removed) between current version of Fedora Linux and previous versions
echo "Running remove-retired-packages..."
sudo remove-retired-packages
# Remove old kernels
echo "Removing old kernels..."
old_kernels=($(dnf repoquery --installonly --latest-limit=-2 -q))
if [ "${#old_kernels[@]}" -eq 0 ]; then
echo "No old kernels found"
else
if ! sudo dnf -y remove "${old_kernels[@]}"; then
echo "Failed to remove old kernels"
exit 1
fi
echo "Removed old kernels"
fi
# Cleaning up old packages
echo "Cleaning up old packages..."
sudo dnf -y autoremove
# Updating Flatpak packages and removing unused ones
echo "Updating Flatpak packages and removing unused ones..."
flatpak -y update
flatpak uninstall --unused
# Cleaning up all cached package data
echo "Cleaning up all cached package data..."
sudo dnf clean all
echo -e "\033[1m\033[7mSystem updates have been completed. What would you like to do next?\033[0m"
echo "1. Reboot"
echo "2. Power-off"
echo "3. Exit the Terminal"
read choice
case $choice in
1)
sudo reboot
;;
2)
sudo poweroff
;;
3)
exit
;;
*)
echo "Invalid choice. Please choose 1, 2, or 3."
;;
esac
License
Fed2date is licensed under the Creative Commons Zero v1.0 Universal license. This is a very permissive license that allows for all types of reuse as long as they comply with the license terms. It is also often interpreted as a waiver of all copyrights and related rights, effectively releasing the work into the public domain. Please see the LICENSE file for the full text of the Creative Commons Zero v1.0 Universal license.
Disclaimer
Always be careful when downloading scripts from the internet and running them with sudo privileges. Please review the contents of the script before executing it.
Contributing
We welcome contributions to the Fed2date Project! Feel free to submit pull requests or open issues on our Codeberg.org page.
Support
If you need help with Fed2date, please open an issue on our GitLab page. I'll do our best to help you out!