mirror of
https://github.com/phaleixo/after_install_debian_12.git
synced 2025-12-06 05:49:45 -03:00
Atualizar o wallpapers.sh
This commit is contained in:
parent
5f257f1bf6
commit
1447b54c85
@ -9,83 +9,96 @@ echo "https://github.com/phaleixo/after_install_debian_12"
|
|||||||
|
|
||||||
### Confirm script execution
|
### Confirm script execution
|
||||||
read -p "Do you want to proceed? (y/n): " response
|
read -p "Do you want to proceed? (y/n): " response
|
||||||
[[ "$response" != "y" ]] && inform "Operation canceled by the user." && exit 0
|
[[ "$response" != "y" ]] && echo "Operation canceled by the user." && exit 0
|
||||||
|
|
||||||
### check if the distribution is compatible
|
### Check if the distribution is Debian 12 (Bookworm)
|
||||||
if [[ $(lsb_release -cs) = "bookworm" ]]
|
if [[ $(lsb_release -is) != "Debian" ]] || [[ $(lsb_release -cs) != "bookworm" ]]; then
|
||||||
then
|
echo -e "\e[31;1mThis script is designed for Debian 12 (Bookworm) only.\e[m"
|
||||||
echo ""
|
|
||||||
echo -e "\e[32;1mDebian 12 Distribution.\e[m"
|
|
||||||
echo ""
|
|
||||||
echo "Continuing with the script..."
|
|
||||||
echo ""
|
|
||||||
else
|
|
||||||
echo -e "\e[31;1mDistribution not approved for use with this script.\e[m"
|
|
||||||
exit 1
|
exit 1
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo -e "\e[32;1mDebian 12 (Bookworm) detected.\e[m"
|
||||||
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### check if there is an internet connection.
|
### Check internet connection
|
||||||
if ping -q -c 3 -W 1 1.1.1.1 >/dev/null;
|
if ! ping -q -c 3 -W 1 1.1.1.1 >/dev/null; then
|
||||||
then
|
echo -e "\e[31;1mNo internet connection. Please check your network.\e[m"
|
||||||
echo ""
|
exit 1
|
||||||
|
else
|
||||||
echo -e "\e[32;1mInternet connection OK.\e[m"
|
echo -e "\e[32;1mInternet connection OK.\e[m"
|
||||||
echo ""
|
fi
|
||||||
echo "Continuing with the script..."
|
|
||||||
echo ""
|
clear
|
||||||
|
|
||||||
|
### Install required packages if missing
|
||||||
|
if ! command -v wget &> /dev/null; then
|
||||||
|
echo "Installing wget..."
|
||||||
|
sudo apt update && sudo apt install -y wget
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command -v unzip &> /dev/null; then
|
||||||
|
echo "Installing unzip..."
|
||||||
|
sudo apt update && sudo apt install -y unzip
|
||||||
|
fi
|
||||||
|
|
||||||
|
### Download wallpapers
|
||||||
|
echo "Downloading wallpapers..."
|
||||||
|
wget -O my_wallpapers.xml "https://github.com/phaleixo/after_install_debian_12/raw/main/src/my_wallpapers.xml"
|
||||||
|
wget -O wallpapers.zip "https://github.com/phaleixo/after_install_debian_12/raw/main/src/wallpapers.zip"
|
||||||
|
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo -e "\e[31;1mFailed to download wallpapers.\e[m"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
### Extract wallpapers
|
||||||
|
echo "Extracting wallpapers..."
|
||||||
|
unzip -q wallpapers.zip -d ~/
|
||||||
|
|
||||||
|
### Detect desktop environment
|
||||||
|
DE=""
|
||||||
|
if [[ $XDG_CURRENT_DESKTOP == *"GNOME"* ]]; then
|
||||||
|
DE="gnome"
|
||||||
|
elif [[ $XDG_CURRENT_DESKTOP == *"XFCE"* ]]; then
|
||||||
|
DE="xfce"
|
||||||
else
|
else
|
||||||
echo -e "\e[31;1mYou are not connected to the internet. Check your network or Wi-Fi connection before proceeding.\e[m"
|
# Fallback detection for Debian
|
||||||
exit 1
|
if pgrep -x "gnome-session" > /dev/null; then
|
||||||
|
DE="gnome"
|
||||||
|
elif pgrep -x "xfce4-session" > /dev/null; then
|
||||||
|
DE="xfce"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clear
|
### Install wallpapers according to DE
|
||||||
|
case $DE in
|
||||||
|
"gnome")
|
||||||
|
echo "Installing for GNOME..."
|
||||||
|
sudo mv ~/wallpapers /usr/share/backgrounds/
|
||||||
|
sudo mv my_wallpapers.xml /usr/share/gnome-background-properties/
|
||||||
|
|
||||||
|
# Set wallpaper
|
||||||
|
gsettings set org.gnome.desktop.background picture-uri 'file:///usr/share/backgrounds/wallpapers/21.jpg'
|
||||||
|
gsettings set org.gnome.desktop.background picture-uri-dark 'file:///usr/share/backgrounds/wallpapers/21.jpg'
|
||||||
|
;;
|
||||||
|
"xfce")
|
||||||
|
echo "Installing for XFCE..."
|
||||||
|
sudo mv ~/wallpapers /usr/share/xfce4/backdrops/
|
||||||
|
|
||||||
wget --version > /dev/null
|
# Set wallpaper for all monitors
|
||||||
|
for monitor in $(xfconf-query -c xfce4-desktop -l | grep last-image); do
|
||||||
|
xfconf-query -c xfce4-desktop -p $monitor -s /usr/share/xfce4/backdrops/wallpapers/21.jpg
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown desktop environment. Installing to common location..."
|
||||||
|
sudo mv ~/wallpapers /usr/share/backgrounds/
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then
|
### Clean up
|
||||||
echo "wget not available , installing"
|
rm -f wallpapers.zip
|
||||||
sudo apt update && sudo apt install wget -y
|
|
||||||
fi
|
|
||||||
|
|
||||||
unzip >> /dev/null
|
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then
|
|
||||||
echo "unzip not available , installing"
|
|
||||||
sudo apt update && sudo apt install unzip -y
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
wget -O my_wallpapers.xml "https://github.com/phaleixo/after_install_debian_12/blob/main/src/my_wallpapers.xml"
|
|
||||||
|
|
||||||
wget -O wallpapers.zip "https://github.com/phaleixo/after_install_debian_12/blob/main/src/wallpapers.zip"
|
|
||||||
|
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then
|
|
||||||
echo "Downloading failed , exiting"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
unzip wallpapers.zip -d ~/
|
|
||||||
sudo mv wallpapers /usr/share/backgrounds/
|
|
||||||
sudo mv my_wallpapers.xml /usr/share/gnome-background-properties/
|
|
||||||
|
|
||||||
|
|
||||||
clear
|
|
||||||
|
|
||||||
echo "Done"
|
|
||||||
sleep 2
|
|
||||||
clear
|
|
||||||
echo "Set Wallpaper "
|
|
||||||
|
|
||||||
gsettings set org.gnome.desktop.background picture-uri-dark 'file:///usr/share/backgrounds/wallpapers/21.jpg'
|
|
||||||
|
|
||||||
gsettings set org.gnome.desktop.background picture-uri 'file:///usr/share/backgrounds/wallpapers/21.jpg'
|
|
||||||
|
|
||||||
clear
|
|
||||||
|
|
||||||
rm -rf wallpapers.zip
|
|
||||||
|
|
||||||
|
|
||||||
echo -e "Wallpapers installed"
|
|
||||||
|
|
||||||
|
echo -e "\e[32;1mWallpapers installed successfully!\e[m"
|
||||||
exit 0
|
exit 0
|
||||||
Loading…
x
Reference in New Issue
Block a user