addet debian
This commit is contained in:
parent
f034986fba
commit
58a037aad6
2 changed files with 101 additions and 1 deletions
86
core/tabs/system-setup/debian/unattendet-upgrades.sh
Normal file
86
core/tabs/system-setup/debian/unattendet-upgrades.sh
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
LOG_FILE="/var/log/unattended-upgrades-check.log"
|
||||||
|
|
||||||
|
# Colors
|
||||||
|
RED='\033[0;31m'
|
||||||
|
CYAN='\033[0;36m'
|
||||||
|
YELLOW='\033[0;33m'
|
||||||
|
LIGHT_GREEN='\033[0;92m'
|
||||||
|
BOLD='\033[1m'
|
||||||
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
echo_error() {
|
||||||
|
printf "${BOLD}${RED}ERROR: ${NC}${RED}%s${NC}\n" "$1" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
echo_info() {
|
||||||
|
printf "${BOLD}${CYAN}INFO: ${NC}${CYAN}%s${NC}\n" "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
echo_warning() {
|
||||||
|
printf "${BOLD}${YELLOW}WARNING: ${NC}${YELLOW}%s${NC}\n" "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
echo_note() {
|
||||||
|
printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||||
|
command_exists() {
|
||||||
|
command -v "$@" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
run_checks() {
|
||||||
|
echo_info "Checking if unattended-upgrades is active..."
|
||||||
|
|
||||||
|
if command_exists unattended-upgrades; then
|
||||||
|
# if dpkg-query -W -f='${Status}' unattended-upgrades 2>/dev/null | grep -q "install ok installed"; then
|
||||||
|
echo_note "unattended-upgrades is already installed."
|
||||||
|
else
|
||||||
|
echo_warning "unattended-upgrades is not installed. Attempting to install..."
|
||||||
|
if command_exists apt-get; then
|
||||||
|
if apt-get update && apt-get install --assume-yes unattended-upgrades; then
|
||||||
|
echo_note "unattended-upgrades successfully installed."
|
||||||
|
else
|
||||||
|
echo_error "Failed to install unattended-upgrades. Exiting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo_error "apt is not available on this system. Exiting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enable unattended-upgrades
|
||||||
|
UNATTENDED_UPGRADES_FILE="/etc/apt/apt.conf.d/50unattended-upgrades"
|
||||||
|
if [ -f "$UNATTENDED_UPGRADES_FILE" ]; then
|
||||||
|
echo_info "Configuring unattended upgrades in $UNATTENDED_UPGRADES_FILE"
|
||||||
|
# Add or modify configurations as needed
|
||||||
|
# Example: $_sudo sed -i 's/old_value/new_value/' "$UNATTENDED_UPGRADES_FILE"
|
||||||
|
else
|
||||||
|
echo_error "Unattended upgrades file not found!"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
run_setup() {
|
||||||
|
if command_exists unattended-upgrades; then
|
||||||
|
systemctl enable --now unattended-upgrades || echo_error "Something went wrong! Could not setup the service/autostart"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main script
|
||||||
|
main() {
|
||||||
|
echo_info "Starting unattended-upgrades check script..."
|
||||||
|
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
|
echo_error "This script must be run as root. Please run with sudo."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
run_checks
|
||||||
|
|
||||||
|
run_setup && echo_note "Script completed successfully!"
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
|
@ -27,6 +27,20 @@ description = "Yet Another Yogurt - An AUR Helper Written in Go.\nTo know more a
|
||||||
script = "arch/yay-setup.sh"
|
script = "arch/yay-setup.sh"
|
||||||
task_list = "I"
|
task_list = "I"
|
||||||
|
|
||||||
|
[[data]]
|
||||||
|
name = "Debian"
|
||||||
|
|
||||||
|
[[data.preconditions]]
|
||||||
|
matches = true
|
||||||
|
data = "command_exists"
|
||||||
|
values = ["apt-get"]
|
||||||
|
|
||||||
|
[[data.entries]]
|
||||||
|
name = "Setup | Unattended-Upgrades"
|
||||||
|
description = "Setup unattended-upgrades for debian"
|
||||||
|
script = "debian/unattended-upgrades.sh"
|
||||||
|
task_list = "I"
|
||||||
|
|
||||||
[[data]]
|
[[data]]
|
||||||
name = "Fedora"
|
name = "Fedora"
|
||||||
|
|
||||||
|
@ -99,4 +113,4 @@ task_list = "RP"
|
||||||
name = "TTY Fonts"
|
name = "TTY Fonts"
|
||||||
description = "This Script will set the default TTY font to Terminus size 32 Bold"
|
description = "This Script will set the default TTY font to Terminus size 32 Bold"
|
||||||
script = "terminus-tty.sh"
|
script = "terminus-tty.sh"
|
||||||
task_list = "I PFM"
|
task_list = "I PFM"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue