Project not found: openSUSE:ALP:Experimental:Slowroll:Staging

File update-ubuntu of Package kimi-utils-ubuntu

#!/usr/bin/bash
# -*- sh; sh-shell: bash; -*-

set -euo pipefail

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

if [ "$EUID" -ne 0 ]; then
    echo "Please run as root"
    echo "or use sudo before command:"
    echo "sudo update-ubuntu"
    exit
fi

journalctl --rotate
journalctl --vacuum-time=2d
logger -t uppdatera Rensat logfiler
echo "[OK] Logfiles older than 2 days were deleted."
> /var/spool/mail/root
logger -t uppdatera Rensat root mail
echo "[OK] root mails were deleted."

source /etc/os-release

# Helper: clean up files matching a glob pattern (reports then removes)
clean_matches() {
    local pattern="$1"
    shopt -s nullglob
    local matches=( $pattern )
    shopt -u nullglob

    if [[ ${#matches[@]} -eq 0 ]]; then
        echo "No files matching '$pattern' were found."
        return 0
    fi

    echo "Cleaning up"
    echo
    echo "Found ${#matches[@]} file(s):"
    for f in "${matches[@]}"; do
        echo "  $f"
    done
    echo
    for f in "${matches[@]}"; do
        rm -v -- "$f"
    done
    echo
}

if [ "$NAME" == "Ubuntu" ]; then
    URL="https://download.opensuse.org/repositories/home:kimi:utils/xUbuntu_$VERSION_ID/Release.key"
    DEST="/etc/apt/trusted.gpg.d/home_kimi.gpg"
    echo "$NAME $VERSION_ID detected."
    echo
    /usr/local/bin/fix-home-kimi-source-and-key
    /usr/local/bin/list-apt-key-days-to-expiry
    # Clean trailing-tilde files in three directories
    clean_matches "/etc/apt/trusted.gpg.d/*~"
    clean_matches "/etc/apt/keyrings/*~"
    clean_matches "/usr/share/keyrings/*~"
fi

logger -t uppdatera Uppdaterar
apt-get autoclean && apt-get clean && echo "*** Check and update expired gpg-key(s)! ***" && apt-get update && apt-get -y upgrade --allow-downgrades && apt-get -y dist-upgrade --allow-downgrades && keep3kernels && apt-get -y autoremove && apt --fix-broken install && apt-get clean
logger -t uppdatera Uppdatering slutförd
echo "[OK] Updated system and cleaned cache."

flag=$(cat /etc/default/grub | grep GRUB_TIMEOUT_STYLE=hidden || true)
if [ ! -z "$flag" ]; then
    /usr/local/bin/fix-grub
fi

if [ -d /home/mamma/Hämtningar ]; then
    mkdir -p /home/mamma/Hämtningar/_bifoga_filer
    chown -R mamma:mamma /home/mamma/Hämtningar/_bifoga_filer
fi

# Fix for firejail signal-desktop
if [ -f /opt/Signal/chrome-sandbox ]; then
    chmod 4755 /opt/Signal/chrome-sandbox
fi

exit 0
openSUSE Build Service is sponsored by