ubuntu_to_aos.sh
                        
                             · 9.4 KiB · Bash
                        
                    
                    
                      
                        Sin formato
                      
                    
                      
                    
                        
                          
                        
                    
                    
                
                
                
            #!/bin/bash
#==========================
# Set up the environment
#==========================
set -e                  # exit on error
set -o pipefail         # exit on pipeline error
set -u                  # treat unset variable as error
export DEBIAN_FRONTEND=noninteractive
export LATEST_VERSION="1.1.10"
export CODE_NAME="noble"
export OS_ID="AnduinOS"
export CURRENT_VERSION=$(cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d "=" -f 2)
#==========================
# Color
#==========================
Green="\033[32m"
Red="\033[31m"
Yellow="\033[33m"
Blue="\033[36m"
Font="\033[0m"
GreenBG="\033[42;37m"
RedBG="\033[41;37m"
OK="${Green}[  OK  ]${Font}"
ERROR="${Red}[FAILED]${Font}"
WARNING="${Yellow}[ WARN ]${Font}"
#==========================
# Print Colorful Text
#==========================
function print_ok() {
  echo -e "${OK} ${Blue} $1 ${Font}"
}
function print_error() {
  echo -e "${ERROR} ${Red} $1 ${Font}"
}
function print_warn() {
  echo -e "${WARNING} ${Yellow} $1 ${Font}"
}
#==========================
# Judge function
#==========================
function judge() {
  if [[ 0 -eq $? ]]; then
    print_ok "$1 succeeded"
    sleep 0.2
  else
    print_error "$1 failed"
    exit 1
  fi
}
#==========================
# Clean up function
#==========================
function clean_up() {
  # Clean up
  print_ok "Cleaning up old files..."
  sudo umount /mnt/anduinos_squashfs >/dev/null 2>&1 || true
  sudo umount /mnt/anduinos_iso >/dev/null 2>&1 || true
  sudo rm -rf /mnt/anduinos_squashfs >/dev/null 2>&1 || true
  sudo rm -rf /mnt/anduinos_iso >/dev/null 2>&1 || true
  sudo rm /tmp/AnduinOS-1.4.0* >/dev/null 2>&1 || true
  judge "Cleanup"
}
clean_up
print_ok "Checking system compatibility..."
codename=$(lsb_release -cs)
if [[ "$codename" != "questing" ]] then
    print_error "This upgrade script can only be run *from* AnduinOS Questing."
    exit 1
fi
judge "System compatibility check"
print_ok "Installing required packages (aria2, curl, lsb-release)..."
sudo apt install -y aria2 curl lsb-release
judge "Install required packages"
# $LANG maybe en_US.UTF-8, so we use only the `en_US` part
CURRENT_LANG=${LANG%%.*}
DOWNLOAD_URL="https://download.anduinos.com/1.4/1.4.0/AnduinOS-1.4.0-${CURRENT_LANG}.torrent"
HASH_URL="https://download.anduinos.com/1.4/1.4.0/AnduinOS-1.4.0-${CURRENT_LANG}.sha256"
print_ok "Current system language detected: ${CURRENT_LANG}"
print_ok "Attempting to download with URL: ${DOWNLOAD_URL}"
# If download URL is not reachable, fallback to en_US
if ! curl --head --silent --fail "$DOWNLOAD_URL" >/dev/null; then
    print_warn "Language pack for ${CURRENT_LANG} not found, falling back to en_US"
    DOWNLOAD_URL="https://download.anduinos.com/1.4/1.4.0/AnduinOS-1.4.0-en_US.torrent"
    HASH_URL="https://download.anduinos.com/1.4/1.4.0/AnduinOS-1.4.0-en_US.sha256"
fi
# Ensure download URL is reachable
if ! curl --head --silent --fail "$DOWNLOAD_URL" >/dev/null; then
    print_error "Download URL is not reachable. Please check your network connection."
    exit 1
fi
print_ok "Downloading AnduinOS 1.4.0 torrent, please wait..."
curl -o /tmp/AnduinOS-1.4.0.torrent "$DOWNLOAD_URL"
curl -o /tmp/AnduinOS-1.4.0.sha256 "$HASH_URL"
judge "Download AnduinOS 1.4.0 torrent"
print_ok "Starting download via aria2..."
aria2c --allow-overwrite=true --seed-ratio=0.0 --seed-time=0 -x 16 -s 16 -k 1M -d /tmp /tmp/AnduinOS-1.4.0.torrent
judge "Download AnduinOS 1.4.0 ISO"
ISO_FILE_PATH=$(ls /tmp/AnduinOS-1.4.0*.iso | head -n 1)
print_ok "Ensure downloaded ISO file exists..."
if [[ -f "$ISO_FILE_PATH" ]]; then
    print_ok "Downloaded ISO file found: $ISO_FILE_PATH"
else
    print_error "Downloaded ISO file not found."
    exit 1
fi
SHA256_FILE_PATH="/tmp/AnduinOS-1.4.0.sha256"
print_ok "Verifying download integrity..."
ACTUAL_SHA256=$(sha256sum "$ISO_FILE_PATH" | awk '{print $1}')
EXPECTED_SHA256=$(grep 'SHA256:' "$SHA256_FILE_PATH" | awk '{print $2}')
if [[ "$ACTUAL_SHA256" == "$EXPECTED_SHA256" ]]; then
    print_ok "SHA256 checksum verification passed."
else
    print_ok "Expected SHA256: $EXPECTED_SHA256"
    print_ok "Actual SHA256:   $ACTUAL_SHA256"
    print_error "SHA256 checksum verification failed. The downloaded file may be corrupted."
    exit 1
fi
print_ok "Mounting the ISO..."
sudo mkdir -p /mnt/anduinos_iso
sudo mount -o loop,ro "$ISO_FILE_PATH" /mnt/anduinos_iso
judge "Mount ISO"
print_ok "Verifying content in the ISO..."
(cd /mnt/anduinos_iso && sudo md5sum -c md5sum.txt)
judge "ISO content integrity verification"
print_ok "Mounting the filesystem.squashfs..."
sudo mkdir -p /mnt/anduinos_squashfs
sudo mount -o loop,ro /mnt/anduinos_iso/casper/filesystem.squashfs /mnt/anduinos_squashfs
judge "Mount filesystem.squashfs"
print_ok "Updating package mirrors..."
curl -s https://gitlab.aiursoft.cn/anduin/init-server/-/raw/master/mirror.sh?ref_type=heads | bash
sudo apt update
judge "Update package mirrors"
# Reset apt settings
print_ok "Resetting APT configuration files..."
sudo rm /etc/apt/preferences.d/* >/dev/null 2>&1 || true
judge "Reset APT configuration files"
# Add Mozilla Team PPA
print_ok "Updating Mozilla Team PPA..."
sudo rm -f /etc/apt/sources.list.d/mozillateam*
sudo rsync -Aax /mnt/anduinos_squashfs/etc/apt/sources.list.d/mozillateam* /etc/apt/sources.list.d/
judge "Update Mozilla Team PPA"
# Install missing package.
print_ok "Installing missing packages from the new release..."
MANIFEST_FILE="/mnt/anduinos_iso/casper/filesystem.manifest-desktop"
cut -d' ' -f1 "$MANIFEST_FILE" \
  | grep -v '^linux-' \
  | grep -v '^lib' \
  | grep -v '^plymouth-' \
  | grep -v '^software-properties-' \
  | xargs sudo apt install -y  # <-- 让 xargs 自己调用 apt
judge "Install missing packages"
# Remove obsolete packages.
print_ok "Removing obsolete packages..."
sudo apt autoremove -y \
  distro-info \
  software-properties-gtk \
  ubuntu-advantage-tools \
  ubuntu-pro-client \
  ubuntu-pro-client-l10n \
  ubuntu-release-upgrader-gtk \
  ubuntu-report \
  ubuntu-settings \
  update-notifier-common \
  update-manager \
  update-manager-core \
  update-notifier \
  ubuntu-release-upgrader-core \
  ubuntu-advantage-desktop-daemon \
  kgx
judge "Remove obsolete packages"
print_ok "Upgrading installed packages..."
sudo apt upgrade -y
sudo apt autoremove --purge -y
judge "System package cleanup"
print_ok "Upgrading GNOME Shell extensions..."
sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/gnome-shell/extensions/ /usr/share/gnome-shell/extensions/
judge "Upgrade GNOME Shell extensions"
print_ok "Upgrading APT configuration files..."
sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/etc/apt/apt.conf.d/ /etc/apt/apt.conf.d/
judge "Upgrade APT configuration files"
print_ok "Upgrading APT preferences files..."
sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/etc/apt/preferences.d/ /etc/apt/preferences.d/
judge "Upgrade APT preferences files"
print_ok "Upgrading session files..."
sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/gnome-session/sessions/ /usr/share/gnome-session/sessions/
sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/wayland-sessions/ /usr/share/wayland-sessions/
judge "Upgrade session files"
print_ok "Upgrading pixmaps..."
sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/pixmaps/ /usr/share/pixmaps/
judge "Upgrade pixmaps"
print_ok "Upgrading python-apt templates and distro info..."
sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/python-apt/templates/ /usr/share/python-apt/templates/
sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/distro-info/ /usr/share/distro-info/
judge "Upgrade python-apt templates and distro info"
print_ok "Upgrading deskmon service..."
sudo rsync -Aax /mnt/anduinos_squashfs/usr/local/bin/deskmon /usr/local/bin/deskmon
sudo rsync -Aax /mnt/anduinos_squashfs/etc/systemd/user/deskmon.service /etc/systemd/user/deskmon.service
sudo rsync -Aax /mnt/anduinos_squashfs/etc/systemd/user/default.target.wants/deskmon.service /etc/systemd/user/default.target.wants/deskmon.service
judge "Upgrade deskmon service"
print_ok "Updating system version information..."
sudo rsync -Aax /mnt/anduinos_squashfs/usr/bin/do_anduinos_upgrade /usr/local/bin/do_anduinos_upgrade
sudo rsync -Aax /mnt/anduinos_squashfs/usr/bin/add-apt-repository /usr/bin/add-apt-repository
sudo rsync -Aax /mnt/anduinos_squashfs/etc/lsb-release /etc/lsb-release
sudo rsync -Aax /mnt/anduinos_squashfs/etc/issue /etc/issue
sudo rsync -Aax /mnt/anduinos_squashfs/etc/issue.net /etc/issue.net
sudo rsync -Aax /mnt/anduinos_squashfs/etc/os-release /etc/os-release
sudo rsync -Aax /mnt/anduinos_squashfs/usr/lib/os-release /usr/lib/os-release
sudo rsync -Aax /mnt/anduinos_squashfs/etc/legal /etc/legal
sudo rsync -Aax /mnt/anduinos_squashfs/etc/sysctl.d/20-apparmor-donotrestrict.conf /etc/sysctl.d/20-apparmor-donotrestrict.conf
judge "Update system version information"
print_ok "Applying dconf settings patch..."
VERSION=$(grep -oP "VERSION_ID=\"\\K\\d+\\.\\d+" /etc/os-release)
PATCH_URL="https://gitlab.aiursoft.cn/anduin/anduinos/-/raw/$VERSION/src/mods/35-dconf-patch/dconf.ini?ref_type=heads"
if [[ -n "$SUDO_USER" ]]; then
    sudo -u "$SUDO_USER" DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u $SUDO_USER)/bus" \
    bash -c "curl -sL '$PATCH_URL' | dconf load /org/gnome/"
else
    bash -c "curl -sL '$PATCH_URL' | dconf load /org/gnome/"
fi
judge "Apply dconf settings patch"
print_ok "Upgrade completed! Please reboot your system to apply all changes."
print_ok "Starting cleanup..."
clean_up
                | 1 | #!/bin/bash | 
| 2 | #========================== | 
| 3 | # Set up the environment | 
| 4 | #========================== | 
| 5 | set -e # exit on error | 
| 6 | set -o pipefail # exit on pipeline error | 
| 7 | set -u # treat unset variable as error | 
| 8 | export DEBIAN_FRONTEND=noninteractive | 
| 9 | export LATEST_VERSION="1.1.10" | 
| 10 | export CODE_NAME="noble" | 
| 11 | export OS_ID="AnduinOS" | 
| 12 | export CURRENT_VERSION=$(cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d "=" -f 2) | 
| 13 | |
| 14 | #========================== | 
| 15 | # Color | 
| 16 | #========================== | 
| 17 | Green="\033[32m" | 
| 18 | Red="\033[31m" | 
| 19 | Yellow="\033[33m" | 
| 20 | Blue="\033[36m" | 
| 21 | Font="\033[0m" | 
| 22 | GreenBG="\033[42;37m" | 
| 23 | RedBG="\033[41;37m" | 
| 24 | OK="${Green}[ OK ]${Font}" | 
| 25 | ERROR="${Red}[FAILED]${Font}" | 
| 26 | WARNING="${Yellow}[ WARN ]${Font}" | 
| 27 | |
| 28 | #========================== | 
| 29 | # Print Colorful Text | 
| 30 | #========================== | 
| 31 | function print_ok() { | 
| 32 | echo -e "${OK} ${Blue} $1 ${Font}" | 
| 33 | } | 
| 34 | |
| 35 | function print_error() { | 
| 36 | echo -e "${ERROR} ${Red} $1 ${Font}" | 
| 37 | } | 
| 38 | |
| 39 | function print_warn() { | 
| 40 | echo -e "${WARNING} ${Yellow} $1 ${Font}" | 
| 41 | } | 
| 42 | |
| 43 | #========================== | 
| 44 | # Judge function | 
| 45 | #========================== | 
| 46 | function judge() { | 
| 47 | if [[ 0 -eq $? ]]; then | 
| 48 | print_ok "$1 succeeded" | 
| 49 | sleep 0.2 | 
| 50 | else | 
| 51 | print_error "$1 failed" | 
| 52 | exit 1 | 
| 53 | fi | 
| 54 | } | 
| 55 | #========================== | 
| 56 | |
| 57 | # Clean up function | 
| 58 | #========================== | 
| 59 | function clean_up() { | 
| 60 | # Clean up | 
| 61 | print_ok "Cleaning up old files..." | 
| 62 | sudo umount /mnt/anduinos_squashfs >/dev/null 2>&1 || true | 
| 63 | sudo umount /mnt/anduinos_iso >/dev/null 2>&1 || true | 
| 64 | sudo rm -rf /mnt/anduinos_squashfs >/dev/null 2>&1 || true | 
| 65 | sudo rm -rf /mnt/anduinos_iso >/dev/null 2>&1 || true | 
| 66 | sudo rm /tmp/AnduinOS-1.4.0* >/dev/null 2>&1 || true | 
| 67 | judge "Cleanup" | 
| 68 | } | 
| 69 | |
| 70 | clean_up | 
| 71 | |
| 72 | print_ok "Checking system compatibility..." | 
| 73 | codename=$(lsb_release -cs) | 
| 74 | if [[ "$codename" != "questing" ]] then | 
| 75 | print_error "This upgrade script can only be run *from* AnduinOS Questing." | 
| 76 | exit 1 | 
| 77 | fi | 
| 78 | judge "System compatibility check" | 
| 79 | |
| 80 | print_ok "Installing required packages (aria2, curl, lsb-release)..." | 
| 81 | sudo apt install -y aria2 curl lsb-release | 
| 82 | judge "Install required packages" | 
| 83 | |
| 84 | # $LANG maybe en_US.UTF-8, so we use only the `en_US` part | 
| 85 | CURRENT_LANG=${LANG%%.*} | 
| 86 | DOWNLOAD_URL="https://download.anduinos.com/1.4/1.4.0/AnduinOS-1.4.0-${CURRENT_LANG}.torrent" | 
| 87 | HASH_URL="https://download.anduinos.com/1.4/1.4.0/AnduinOS-1.4.0-${CURRENT_LANG}.sha256" | 
| 88 | |
| 89 | print_ok "Current system language detected: ${CURRENT_LANG}" | 
| 90 | print_ok "Attempting to download with URL: ${DOWNLOAD_URL}" | 
| 91 | |
| 92 | # If download URL is not reachable, fallback to en_US | 
| 93 | if ! curl --head --silent --fail "$DOWNLOAD_URL" >/dev/null; then | 
| 94 | print_warn "Language pack for ${CURRENT_LANG} not found, falling back to en_US" | 
| 95 | DOWNLOAD_URL="https://download.anduinos.com/1.4/1.4.0/AnduinOS-1.4.0-en_US.torrent" | 
| 96 | HASH_URL="https://download.anduinos.com/1.4/1.4.0/AnduinOS-1.4.0-en_US.sha256" | 
| 97 | fi | 
| 98 | |
| 99 | # Ensure download URL is reachable | 
| 100 | if ! curl --head --silent --fail "$DOWNLOAD_URL" >/dev/null; then | 
| 101 | print_error "Download URL is not reachable. Please check your network connection." | 
| 102 | exit 1 | 
| 103 | fi | 
| 104 | |
| 105 | print_ok "Downloading AnduinOS 1.4.0 torrent, please wait..." | 
| 106 | curl -o /tmp/AnduinOS-1.4.0.torrent "$DOWNLOAD_URL" | 
| 107 | curl -o /tmp/AnduinOS-1.4.0.sha256 "$HASH_URL" | 
| 108 | judge "Download AnduinOS 1.4.0 torrent" | 
| 109 | |
| 110 | print_ok "Starting download via aria2..." | 
| 111 | aria2c --allow-overwrite=true --seed-ratio=0.0 --seed-time=0 -x 16 -s 16 -k 1M -d /tmp /tmp/AnduinOS-1.4.0.torrent | 
| 112 | judge "Download AnduinOS 1.4.0 ISO" | 
| 113 | |
| 114 | ISO_FILE_PATH=$(ls /tmp/AnduinOS-1.4.0*.iso | head -n 1) | 
| 115 | print_ok "Ensure downloaded ISO file exists..." | 
| 116 | if [[ -f "$ISO_FILE_PATH" ]]; then | 
| 117 | print_ok "Downloaded ISO file found: $ISO_FILE_PATH" | 
| 118 | else | 
| 119 | print_error "Downloaded ISO file not found." | 
| 120 | exit 1 | 
| 121 | fi | 
| 122 | |
| 123 | SHA256_FILE_PATH="/tmp/AnduinOS-1.4.0.sha256" | 
| 124 | |
| 125 | print_ok "Verifying download integrity..." | 
| 126 | ACTUAL_SHA256=$(sha256sum "$ISO_FILE_PATH" | awk '{print $1}') | 
| 127 | EXPECTED_SHA256=$(grep 'SHA256:' "$SHA256_FILE_PATH" | awk '{print $2}') | 
| 128 | if [[ "$ACTUAL_SHA256" == "$EXPECTED_SHA256" ]]; then | 
| 129 | print_ok "SHA256 checksum verification passed." | 
| 130 | else | 
| 131 | print_ok "Expected SHA256: $EXPECTED_SHA256" | 
| 132 | print_ok "Actual SHA256: $ACTUAL_SHA256" | 
| 133 | print_error "SHA256 checksum verification failed. The downloaded file may be corrupted." | 
| 134 | exit 1 | 
| 135 | fi | 
| 136 | |
| 137 | print_ok "Mounting the ISO..." | 
| 138 | sudo mkdir -p /mnt/anduinos_iso | 
| 139 | sudo mount -o loop,ro "$ISO_FILE_PATH" /mnt/anduinos_iso | 
| 140 | judge "Mount ISO" | 
| 141 | |
| 142 | print_ok "Verifying content in the ISO..." | 
| 143 | (cd /mnt/anduinos_iso && sudo md5sum -c md5sum.txt) | 
| 144 | judge "ISO content integrity verification" | 
| 145 | |
| 146 | print_ok "Mounting the filesystem.squashfs..." | 
| 147 | sudo mkdir -p /mnt/anduinos_squashfs | 
| 148 | sudo mount -o loop,ro /mnt/anduinos_iso/casper/filesystem.squashfs /mnt/anduinos_squashfs | 
| 149 | judge "Mount filesystem.squashfs" | 
| 150 | |
| 151 | print_ok "Updating package mirrors..." | 
| 152 | curl -s https://gitlab.aiursoft.cn/anduin/init-server/-/raw/master/mirror.sh?ref_type=heads | bash | 
| 153 | sudo apt update | 
| 154 | judge "Update package mirrors" | 
| 155 | |
| 156 | # Reset apt settings | 
| 157 | print_ok "Resetting APT configuration files..." | 
| 158 | sudo rm /etc/apt/preferences.d/* >/dev/null 2>&1 || true | 
| 159 | judge "Reset APT configuration files" | 
| 160 | |
| 161 | # Add Mozilla Team PPA | 
| 162 | print_ok "Updating Mozilla Team PPA..." | 
| 163 | sudo rm -f /etc/apt/sources.list.d/mozillateam* | 
| 164 | sudo rsync -Aax /mnt/anduinos_squashfs/etc/apt/sources.list.d/mozillateam* /etc/apt/sources.list.d/ | 
| 165 | judge "Update Mozilla Team PPA" | 
| 166 | |
| 167 | # Install missing package. | 
| 168 | print_ok "Installing missing packages from the new release..." | 
| 169 | MANIFEST_FILE="/mnt/anduinos_iso/casper/filesystem.manifest-desktop" | 
| 170 | cut -d' ' -f1 "$MANIFEST_FILE" \ | 
| 171 | | grep -v '^linux-' \ | 
| 172 | | grep -v '^lib' \ | 
| 173 | | grep -v '^plymouth-' \ | 
| 174 | | grep -v '^software-properties-' \ | 
| 175 | | xargs sudo apt install -y # <-- 让 xargs 自己调用 apt | 
| 176 | judge "Install missing packages" | 
| 177 | |
| 178 | # Remove obsolete packages. | 
| 179 | print_ok "Removing obsolete packages..." | 
| 180 | sudo apt autoremove -y \ | 
| 181 | distro-info \ | 
| 182 | software-properties-gtk \ | 
| 183 | ubuntu-advantage-tools \ | 
| 184 | ubuntu-pro-client \ | 
| 185 | ubuntu-pro-client-l10n \ | 
| 186 | ubuntu-release-upgrader-gtk \ | 
| 187 | ubuntu-report \ | 
| 188 | ubuntu-settings \ | 
| 189 | update-notifier-common \ | 
| 190 | update-manager \ | 
| 191 | update-manager-core \ | 
| 192 | update-notifier \ | 
| 193 | ubuntu-release-upgrader-core \ | 
| 194 | ubuntu-advantage-desktop-daemon \ | 
| 195 | kgx | 
| 196 | judge "Remove obsolete packages" | 
| 197 | |
| 198 | print_ok "Upgrading installed packages..." | 
| 199 | sudo apt upgrade -y | 
| 200 | sudo apt autoremove --purge -y | 
| 201 | judge "System package cleanup" | 
| 202 | |
| 203 | print_ok "Upgrading GNOME Shell extensions..." | 
| 204 | sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/gnome-shell/extensions/ /usr/share/gnome-shell/extensions/ | 
| 205 | judge "Upgrade GNOME Shell extensions" | 
| 206 | |
| 207 | print_ok "Upgrading APT configuration files..." | 
| 208 | sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/etc/apt/apt.conf.d/ /etc/apt/apt.conf.d/ | 
| 209 | judge "Upgrade APT configuration files" | 
| 210 | |
| 211 | print_ok "Upgrading APT preferences files..." | 
| 212 | sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/etc/apt/preferences.d/ /etc/apt/preferences.d/ | 
| 213 | judge "Upgrade APT preferences files" | 
| 214 | |
| 215 | print_ok "Upgrading session files..." | 
| 216 | sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/gnome-session/sessions/ /usr/share/gnome-session/sessions/ | 
| 217 | sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/wayland-sessions/ /usr/share/wayland-sessions/ | 
| 218 | judge "Upgrade session files" | 
| 219 | |
| 220 | print_ok "Upgrading pixmaps..." | 
| 221 | sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/pixmaps/ /usr/share/pixmaps/ | 
| 222 | judge "Upgrade pixmaps" | 
| 223 | |
| 224 | print_ok "Upgrading python-apt templates and distro info..." | 
| 225 | sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/python-apt/templates/ /usr/share/python-apt/templates/ | 
| 226 | sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/distro-info/ /usr/share/distro-info/ | 
| 227 | judge "Upgrade python-apt templates and distro info" | 
| 228 | |
| 229 | print_ok "Upgrading deskmon service..." | 
| 230 | sudo rsync -Aax /mnt/anduinos_squashfs/usr/local/bin/deskmon /usr/local/bin/deskmon | 
| 231 | sudo rsync -Aax /mnt/anduinos_squashfs/etc/systemd/user/deskmon.service /etc/systemd/user/deskmon.service | 
| 232 | sudo rsync -Aax /mnt/anduinos_squashfs/etc/systemd/user/default.target.wants/deskmon.service /etc/systemd/user/default.target.wants/deskmon.service | 
| 233 | judge "Upgrade deskmon service" | 
| 234 | |
| 235 | print_ok "Updating system version information..." | 
| 236 | sudo rsync -Aax /mnt/anduinos_squashfs/usr/bin/do_anduinos_upgrade /usr/local/bin/do_anduinos_upgrade | 
| 237 | sudo rsync -Aax /mnt/anduinos_squashfs/usr/bin/add-apt-repository /usr/bin/add-apt-repository | 
| 238 | sudo rsync -Aax /mnt/anduinos_squashfs/etc/lsb-release /etc/lsb-release | 
| 239 | sudo rsync -Aax /mnt/anduinos_squashfs/etc/issue /etc/issue | 
| 240 | sudo rsync -Aax /mnt/anduinos_squashfs/etc/issue.net /etc/issue.net | 
| 241 | sudo rsync -Aax /mnt/anduinos_squashfs/etc/os-release /etc/os-release | 
| 242 | sudo rsync -Aax /mnt/anduinos_squashfs/usr/lib/os-release /usr/lib/os-release | 
| 243 | sudo rsync -Aax /mnt/anduinos_squashfs/etc/legal /etc/legal | 
| 244 | sudo rsync -Aax /mnt/anduinos_squashfs/etc/sysctl.d/20-apparmor-donotrestrict.conf /etc/sysctl.d/20-apparmor-donotrestrict.conf | 
| 245 | judge "Update system version information" | 
| 246 | |
| 247 | print_ok "Applying dconf settings patch..." | 
| 248 | VERSION=$(grep -oP "VERSION_ID=\"\\K\\d+\\.\\d+" /etc/os-release) | 
| 249 | PATCH_URL="https://gitlab.aiursoft.cn/anduin/anduinos/-/raw/$VERSION/src/mods/35-dconf-patch/dconf.ini?ref_type=heads" | 
| 250 | |
| 251 | if [[ -n "$SUDO_USER" ]]; then | 
| 252 | sudo -u "$SUDO_USER" DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u $SUDO_USER)/bus" \ | 
| 253 | bash -c "curl -sL '$PATCH_URL' | dconf load /org/gnome/" | 
| 254 | else | 
| 255 | bash -c "curl -sL '$PATCH_URL' | dconf load /org/gnome/" | 
| 256 | fi | 
| 257 | judge "Apply dconf settings patch" | 
| 258 | |
| 259 | print_ok "Upgrade completed! Please reboot your system to apply all changes." | 
| 260 | |
| 261 | print_ok "Starting cleanup..." | 
| 262 | clean_up | 
| 263 |