mirror of
https://github.com/Snigdha-OS/snigdhaos-system-config.git
synced 2025-12-06 08:03:53 +01:00
43 lines
1.1 KiB
Bash
Executable File
43 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Ask the user whether to copy contents from /etc/skel to the Home directory
|
|
echo "Copy contents from /etc/skel to Home directory? (Y/n)"
|
|
read -r response
|
|
|
|
# Check if the user agrees (Y or y)
|
|
if [[ "$response" == [yY] ]]; then
|
|
# Get current date and time to append to backup folder name
|
|
time=$(date +%Y.%m.%d-%H.%M.%S)
|
|
|
|
# Ensure the ~/.config directory exists, if not, create it
|
|
if [ ! -d "$HOME/.config" ]; then
|
|
mkdir -p "$HOME/.config"
|
|
fi
|
|
|
|
echo
|
|
# Notify user about the backup of .config folder
|
|
echo "Backing up .config folder to $HOME/.config-backup-$time"
|
|
echo
|
|
|
|
# Backup the current .config folder with a timestamped name
|
|
cp -Rf "$HOME/.config" "$HOME/.config-backup-$time"
|
|
|
|
echo
|
|
# Inform the user that the .config folder will be overwritten
|
|
echo "Overwriting existing .config folder with files from /etc/skel"
|
|
echo
|
|
|
|
# Copy the contents of /etc/skel to the user's home directory
|
|
cp -r /etc/skel/. "$HOME"
|
|
|
|
echo
|
|
echo "Task Completed!"
|
|
echo
|
|
|
|
else
|
|
# User chose not to make any changes
|
|
echo
|
|
echo "No change made!"
|
|
echo
|
|
fi
|