do_anduinos_distupgrade.sh
· 9.1 KiB · Bash
Eredeti
#!/bin/bash
#=================================================
# AnduinOS Upgrade Script
#=================================================
# This script upgrades AnduinOS from 1.3.7 (plucky)
# to 1.4.0 (questing).
#
# Run this script as root.
# or user with privileges.
#
# Example:
# ./do_anduinos_distupgrade.sh
#=================================================
set -e
set -o pipefail
set -u
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}"
BACKUP_DIR="/tmp/anduinos_upgrade_backup_$(date +%Y%m%d_%H%M%S)"
PPA_BACKUP_DIR="$BACKUP_DIR/ppa"
UBUNTU_SOURCE_BACKUP="$BACKUP_DIR/ubuntu_sources"
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}"
}
function judge() {
if [[ 0 -eq $? ]]; then
print_ok "$1 succeeded"
sleep 0.2
else
print_error "$1 failed"
exit 1
fi
}
function update_system() {
print_ok "Running apt update and upgrade..."
apt update
judge "apt update"
apt upgrade -y
judge "apt upgrade"
}
function backup_ubuntu_sources() {
print_ok "Backing up Ubuntu official sources..."
mkdir -p "$UBUNTU_SOURCE_BACKUP"
# Backup ubuntu.sources if exists
if [ -f "/etc/apt/sources.list.d/ubuntu.sources" ]; then
cp /etc/apt/sources.list.d/ubuntu.sources "$UBUNTU_SOURCE_BACKUP/"
print_ok "Backed up ubuntu.sources"
fi
# Backup sources.list if it exists and is not empty
if [ -f "/etc/apt/sources.list" ] && [ -s "/etc/apt/sources.list" ]; then
cp /etc/apt/sources.list "$UBUNTU_SOURCE_BACKUP/"
print_ok "Backed up sources.list"
fi
judge "Backup Ubuntu sources"
}
function backup_and_remove_ppa() {
print_ok "Backing up and temporarily removing PPA sources..."
mkdir -p "$PPA_BACKUP_DIR"
# Move all files in /etc/apt/sources.list.d/ except ubuntu.sources
if [ -d "/etc/apt/sources.list.d" ]; then
for file in /etc/apt/sources.list.d/*; do
if [ -f "$file" ] && [ "$(basename "$file")" != "ubuntu.sources" ]; then
mv "$file" "$PPA_BACKUP_DIR/"
print_ok "Moved $(basename "$file") to backup"
fi
done
fi
print_ok "PPA sources moved to: $PPA_BACKUP_DIR"
judge "Backup and remove PPA sources"
}
function detect_apt_format() {
print_ok "Detecting APT source format..."
if [ -f "/etc/apt/sources.list.d/ubuntu.sources" ]; then
print_ok "Detected new DEB822 format (ubuntu.sources)"
return 0
elif [ -f "/etc/apt/sources.list" ] && [ -s "/etc/apt/sources.list" ]; then
print_ok "Detected old format (sources.list)"
return 1
else
print_error "Cannot detect APT source format"
exit 1
fi
}
function convert_old_to_new_format() {
print_ok "Converting old format to new DEB822 format..."
if [ ! -f "/etc/apt/sources.list" ] || [ ! -s "/etc/apt/sources.list" ]; then
print_error "/etc/apt/sources.list not found or empty"
exit 1
fi
# Backup the old sources.list
cp /etc/apt/sources.list /etc/apt/sources.list.backup
# Extract mirror URLs from existing sources.list
# Try to detect main archive mirror
MIRROR_URL=$(grep -E "^deb " /etc/apt/sources.list | grep -v "security" | head -1 | awk '{print $2}')
if [ -z "$MIRROR_URL" ]; then
MIRROR_URL="http://archive.ubuntu.com/ubuntu/"
fi
# Try to detect security mirror
SECURITY_URL=$(grep -E "^deb " /etc/apt/sources.list | grep "security" | head -1 | awk '{print $2}')
if [ -z "$SECURITY_URL" ]; then
SECURITY_URL="http://security.ubuntu.com/ubuntu/"
fi
print_ok "Detected mirror URL: $MIRROR_URL"
print_ok "Detected security URL: $SECURITY_URL"
# Create new ubuntu.sources file using detected mirrors
bash -c "cat > /etc/apt/sources.list.d/ubuntu.sources" <<EOF
Types: deb
URIs: ${MIRROR_URL}
Suites: plucky plucky-updates plucky-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Types: deb
URIs: ${SECURITY_URL}
Suites: plucky-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
EOF
# Clear the old sources.list
bash -c 'echo "# This file is deprecated. See /etc/apt/sources.list.d/ubuntu.sources" > /etc/apt/sources.list'
judge "Convert to new format"
}
function replace_plucky_with_questing() {
print_ok "Replacing plucky with questing in ubuntu.sources..."
if [ ! -f "/etc/apt/sources.list.d/ubuntu.sources" ]; then
print_error "/etc/apt/sources.list.d/ubuntu.sources not found"
exit 1
fi
sed -i 's/plucky/questing/g' /etc/apt/sources.list.d/ubuntu.sources
judge "Replace plucky with questing"
print_ok "Running apt update with questing repositories..."
apt update
judge "apt update with questing"
}
function install_coreutils_uutils() {
print_ok "Installing coreutils-from-uutils..."
apt install -y coreutils-from-uutils
judge "Install coreutils-from-uutils"
}
function run_dist_upgrade() {
print_ok "Running apt dist-upgrade in non-interactive mode..."
# Set environment for non-interactive mode
export DEBIAN_FRONTEND=noninteractive
# Configure dpkg to keep local versions by default
bash -c 'cat > /etc/apt/apt.conf.d/99-local-versions <<EOF
Dpkg::Options {
"--force-confdef";
"--force-confold";
}
EOF'
# Run dist-upgrade
bash -c 'DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none \
apt-get -y dist-upgrade \
-o Dpkg::Options::="--force-confdef" \
-o Dpkg::Options::="--force-confold"'
judge "apt dist-upgrade"
# Remove temporary configuration
rm -f /etc/apt/apt.conf.d/99-local-versions
unset DEBIAN_FRONTEND
}
function update_release_files() {
print_ok "Updating release information files..."
# Update /etc/os-release
if [ -f "/etc/os-release" ]; then
print_ok "Updating /etc/os-release..."
sed -i 's/UBUNTU_CODENAME=plucky/UBUNTU_CODENAME=questing/g' /etc/os-release
sed -i 's/VERSION_CODENAME=plucky/VERSION_CODENAME=questing/g' /etc/os-release
sed -i 's/VERSION_ID="1\.3\.7"/VERSION_ID="1.4.0"/g' /etc/os-release
sed -i 's/VERSION="1\.3\.7 (plucky)"/VERSION="1.4.0 (questing)"/g' /etc/os-release
sed -i 's/PRETTY_NAME="AnduinOS 1\.3\.7"/PRETTY_NAME="AnduinOS 1.4.0"/g' /etc/os-release
sed -i 's/PRETTY_NAME="AnduinOS 1\.3\.7"/PRETTY_NAME="AnduinOS 1.4.0"/g' /etc/os-release
judge "Update /etc/os-release"
fi
# Update /etc/lsb-release
if [ -f "/etc/lsb-release" ]; then
print_ok "Updating /etc/lsb-release..."
sed -i 's/DISTRIB_RELEASE=1\.3\.7/DISTRIB_RELEASE=1.4.0/g' /etc/lsb-release
sed -i 's/DISTRIB_CODENAME=plucky/DISTRIB_CODENAME=questing/g' /etc/lsb-release
sed -i 's/DISTRIB_DESCRIPTION="AnduinOS 1\.3\.7"/DISTRIB_DESCRIPTION="AnduinOS 1.4.0"/g' /etc/lsb-release
judge "Update /etc/lsb-release"
fi
print_ok "Release files updated successfully"
}
function restore_ppa_sources() {
print_ok "Restoring PPA sources..."
if [ -d "$PPA_BACKUP_DIR" ]; then
ppa_count=$(ls -1 "$PPA_BACKUP_DIR" 2>/dev/null | wc -l)
if [ "$ppa_count" -gt 0 ]; then
for file in "$PPA_BACKUP_DIR"/*; do
if [ -f "$file" ]; then
mv "$file" /etc/apt/sources.list.d/
print_ok "Restored $(basename "$file")"
fi
done
print_ok "Running apt update with restored PPAs..."
apt update
judge "Restore PPA sources and update"
else
print_ok "No PPA sources to restore"
fi
else
print_warn "PPA backup directory not found, skipping restore"
fi
}
function main() {
print_ok "Starting AnduinOS upgrade process..."
echo -e "${Yellow}WARNING: This script will upgrade your system from 1.3.7 (plucky) to 1.4.0 (questing).${Font}"
echo -e "${Yellow}Please ensure you have backed up important data before proceeding.${Font}"
read -p "Do you want to continue? (y/N): " confirm
if [[ "$confirm" != "y" && "$confirm" != "Y" ]]; then
print_error "Upgrade process aborted by user."
exit 1
fi
# Check if running as root
if [[ "$(id -u)" -ne 0 ]]; then
print_error "This script must not be run as root. Please run as a normal user with privileges."
exit 1
fi
# Step 1: Update current system
update_system
# Step 2: Backup Ubuntu official sources
backup_ubuntu_sources
# Step 3: Backup and remove PPA sources
backup_and_remove_ppa
# Step 4: Detect and convert APT format if needed
if ! detect_apt_format; then
convert_old_to_new_format
fi
# Step 5: Replace plucky with questing
replace_plucky_with_questing
# Step 6: Install coreutils-from-uutils
install_coreutils_uutils
# Step 7: Run dist-upgrade
run_dist_upgrade
# Step 8: Update release files
update_release_files
# Step 9: Restore PPA sources
restore_ppa_sources
print_ok "Upgrade completed successfully!"
print_ok "Your system has been upgraded to AnduinOS 1.4.0 (questing)"
print_ok "Backup files are stored in: $BACKUP_DIR"
print_warn "Please reboot your system to complete the upgrade."
}
main
| 1 | #!/bin/bash |
| 2 | |
| 3 | #================================================= |
| 4 | # AnduinOS Upgrade Script |
| 5 | #================================================= |
| 6 | # This script upgrades AnduinOS from 1.3.7 (plucky) |
| 7 | # to 1.4.0 (questing). |
| 8 | # |
| 9 | # Run this script as root. |
| 10 | # or user with privileges. |
| 11 | # |
| 12 | # Example: |
| 13 | # ./do_anduinos_distupgrade.sh |
| 14 | #================================================= |
| 15 | |
| 16 | set -e |
| 17 | set -o pipefail |
| 18 | set -u |
| 19 | |
| 20 | Green="\033[32m" |
| 21 | Red="\033[31m" |
| 22 | Yellow="\033[33m" |
| 23 | Blue="\033[36m" |
| 24 | Font="\033[0m" |
| 25 | GreenBG="\033[42;37m" |
| 26 | RedBG="\033[41;37m" |
| 27 | OK="${Green}[ OK ]${Font}" |
| 28 | ERROR="${Red}[FAILED]${Font}" |
| 29 | WARNING="${Yellow}[ WARN ]${Font}" |
| 30 | |
| 31 | BACKUP_DIR="/tmp/anduinos_upgrade_backup_$(date +%Y%m%d_%H%M%S)" |
| 32 | PPA_BACKUP_DIR="$BACKUP_DIR/ppa" |
| 33 | UBUNTU_SOURCE_BACKUP="$BACKUP_DIR/ubuntu_sources" |
| 34 | |
| 35 | function print_ok() { |
| 36 | echo -e "${OK} ${Blue} $1 ${Font}" |
| 37 | } |
| 38 | |
| 39 | function print_error() { |
| 40 | echo -e "${ERROR} ${Red} $1 ${Font}" |
| 41 | } |
| 42 | |
| 43 | function print_warn() { |
| 44 | echo -e "${WARNING} ${Yellow} $1 ${Font}" |
| 45 | } |
| 46 | |
| 47 | function judge() { |
| 48 | if [[ 0 -eq $? ]]; then |
| 49 | print_ok "$1 succeeded" |
| 50 | sleep 0.2 |
| 51 | else |
| 52 | print_error "$1 failed" |
| 53 | exit 1 |
| 54 | fi |
| 55 | } |
| 56 | |
| 57 | function update_system() { |
| 58 | print_ok "Running apt update and upgrade..." |
| 59 | apt update |
| 60 | judge "apt update" |
| 61 | apt upgrade -y |
| 62 | judge "apt upgrade" |
| 63 | } |
| 64 | |
| 65 | function backup_ubuntu_sources() { |
| 66 | print_ok "Backing up Ubuntu official sources..." |
| 67 | |
| 68 | mkdir -p "$UBUNTU_SOURCE_BACKUP" |
| 69 | |
| 70 | # Backup ubuntu.sources if exists |
| 71 | if [ -f "/etc/apt/sources.list.d/ubuntu.sources" ]; then |
| 72 | cp /etc/apt/sources.list.d/ubuntu.sources "$UBUNTU_SOURCE_BACKUP/" |
| 73 | print_ok "Backed up ubuntu.sources" |
| 74 | fi |
| 75 | |
| 76 | # Backup sources.list if it exists and is not empty |
| 77 | if [ -f "/etc/apt/sources.list" ] && [ -s "/etc/apt/sources.list" ]; then |
| 78 | cp /etc/apt/sources.list "$UBUNTU_SOURCE_BACKUP/" |
| 79 | print_ok "Backed up sources.list" |
| 80 | fi |
| 81 | |
| 82 | judge "Backup Ubuntu sources" |
| 83 | } |
| 84 | |
| 85 | function backup_and_remove_ppa() { |
| 86 | print_ok "Backing up and temporarily removing PPA sources..." |
| 87 | |
| 88 | mkdir -p "$PPA_BACKUP_DIR" |
| 89 | |
| 90 | # Move all files in /etc/apt/sources.list.d/ except ubuntu.sources |
| 91 | if [ -d "/etc/apt/sources.list.d" ]; then |
| 92 | for file in /etc/apt/sources.list.d/*; do |
| 93 | if [ -f "$file" ] && [ "$(basename "$file")" != "ubuntu.sources" ]; then |
| 94 | mv "$file" "$PPA_BACKUP_DIR/" |
| 95 | print_ok "Moved $(basename "$file") to backup" |
| 96 | fi |
| 97 | done |
| 98 | fi |
| 99 | |
| 100 | print_ok "PPA sources moved to: $PPA_BACKUP_DIR" |
| 101 | judge "Backup and remove PPA sources" |
| 102 | } |
| 103 | |
| 104 | function detect_apt_format() { |
| 105 | print_ok "Detecting APT source format..." |
| 106 | |
| 107 | if [ -f "/etc/apt/sources.list.d/ubuntu.sources" ]; then |
| 108 | print_ok "Detected new DEB822 format (ubuntu.sources)" |
| 109 | return 0 |
| 110 | elif [ -f "/etc/apt/sources.list" ] && [ -s "/etc/apt/sources.list" ]; then |
| 111 | print_ok "Detected old format (sources.list)" |
| 112 | return 1 |
| 113 | else |
| 114 | print_error "Cannot detect APT source format" |
| 115 | exit 1 |
| 116 | fi |
| 117 | } |
| 118 | |
| 119 | function convert_old_to_new_format() { |
| 120 | print_ok "Converting old format to new DEB822 format..." |
| 121 | |
| 122 | if [ ! -f "/etc/apt/sources.list" ] || [ ! -s "/etc/apt/sources.list" ]; then |
| 123 | print_error "/etc/apt/sources.list not found or empty" |
| 124 | exit 1 |
| 125 | fi |
| 126 | |
| 127 | # Backup the old sources.list |
| 128 | cp /etc/apt/sources.list /etc/apt/sources.list.backup |
| 129 | |
| 130 | # Extract mirror URLs from existing sources.list |
| 131 | # Try to detect main archive mirror |
| 132 | MIRROR_URL=$(grep -E "^deb " /etc/apt/sources.list | grep -v "security" | head -1 | awk '{print $2}') |
| 133 | if [ -z "$MIRROR_URL" ]; then |
| 134 | MIRROR_URL="http://archive.ubuntu.com/ubuntu/" |
| 135 | fi |
| 136 | |
| 137 | # Try to detect security mirror |
| 138 | SECURITY_URL=$(grep -E "^deb " /etc/apt/sources.list | grep "security" | head -1 | awk '{print $2}') |
| 139 | if [ -z "$SECURITY_URL" ]; then |
| 140 | SECURITY_URL="http://security.ubuntu.com/ubuntu/" |
| 141 | fi |
| 142 | |
| 143 | print_ok "Detected mirror URL: $MIRROR_URL" |
| 144 | print_ok "Detected security URL: $SECURITY_URL" |
| 145 | |
| 146 | # Create new ubuntu.sources file using detected mirrors |
| 147 | bash -c "cat > /etc/apt/sources.list.d/ubuntu.sources" <<EOF |
| 148 | Types: deb |
| 149 | URIs: ${MIRROR_URL} |
| 150 | Suites: plucky plucky-updates plucky-backports |
| 151 | Components: main restricted universe multiverse |
| 152 | Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg |
| 153 | |
| 154 | Types: deb |
| 155 | URIs: ${SECURITY_URL} |
| 156 | Suites: plucky-security |
| 157 | Components: main restricted universe multiverse |
| 158 | Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg |
| 159 | EOF |
| 160 | |
| 161 | # Clear the old sources.list |
| 162 | bash -c 'echo "# This file is deprecated. See /etc/apt/sources.list.d/ubuntu.sources" > /etc/apt/sources.list' |
| 163 | |
| 164 | judge "Convert to new format" |
| 165 | } |
| 166 | |
| 167 | function replace_plucky_with_questing() { |
| 168 | print_ok "Replacing plucky with questing in ubuntu.sources..." |
| 169 | |
| 170 | if [ ! -f "/etc/apt/sources.list.d/ubuntu.sources" ]; then |
| 171 | print_error "/etc/apt/sources.list.d/ubuntu.sources not found" |
| 172 | exit 1 |
| 173 | fi |
| 174 | |
| 175 | sed -i 's/plucky/questing/g' /etc/apt/sources.list.d/ubuntu.sources |
| 176 | judge "Replace plucky with questing" |
| 177 | |
| 178 | print_ok "Running apt update with questing repositories..." |
| 179 | apt update |
| 180 | judge "apt update with questing" |
| 181 | } |
| 182 | |
| 183 | function install_coreutils_uutils() { |
| 184 | print_ok "Installing coreutils-from-uutils..." |
| 185 | |
| 186 | apt install -y coreutils-from-uutils |
| 187 | judge "Install coreutils-from-uutils" |
| 188 | } |
| 189 | |
| 190 | function run_dist_upgrade() { |
| 191 | print_ok "Running apt dist-upgrade in non-interactive mode..." |
| 192 | |
| 193 | # Set environment for non-interactive mode |
| 194 | export DEBIAN_FRONTEND=noninteractive |
| 195 | |
| 196 | # Configure dpkg to keep local versions by default |
| 197 | bash -c 'cat > /etc/apt/apt.conf.d/99-local-versions <<EOF |
| 198 | Dpkg::Options { |
| 199 | "--force-confdef"; |
| 200 | "--force-confold"; |
| 201 | } |
| 202 | EOF' |
| 203 | |
| 204 | # Run dist-upgrade |
| 205 | bash -c 'DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none \ |
| 206 | apt-get -y dist-upgrade \ |
| 207 | -o Dpkg::Options::="--force-confdef" \ |
| 208 | -o Dpkg::Options::="--force-confold"' |
| 209 | |
| 210 | judge "apt dist-upgrade" |
| 211 | |
| 212 | # Remove temporary configuration |
| 213 | rm -f /etc/apt/apt.conf.d/99-local-versions |
| 214 | |
| 215 | unset DEBIAN_FRONTEND |
| 216 | } |
| 217 | |
| 218 | function update_release_files() { |
| 219 | print_ok "Updating release information files..." |
| 220 | |
| 221 | # Update /etc/os-release |
| 222 | if [ -f "/etc/os-release" ]; then |
| 223 | print_ok "Updating /etc/os-release..." |
| 224 | sed -i 's/UBUNTU_CODENAME=plucky/UBUNTU_CODENAME=questing/g' /etc/os-release |
| 225 | sed -i 's/VERSION_CODENAME=plucky/VERSION_CODENAME=questing/g' /etc/os-release |
| 226 | sed -i 's/VERSION_ID="1\.3\.7"/VERSION_ID="1.4.0"/g' /etc/os-release |
| 227 | sed -i 's/VERSION="1\.3\.7 (plucky)"/VERSION="1.4.0 (questing)"/g' /etc/os-release |
| 228 | sed -i 's/PRETTY_NAME="AnduinOS 1\.3\.7"/PRETTY_NAME="AnduinOS 1.4.0"/g' /etc/os-release |
| 229 | sed -i 's/PRETTY_NAME="AnduinOS 1\.3\.7"/PRETTY_NAME="AnduinOS 1.4.0"/g' /etc/os-release |
| 230 | judge "Update /etc/os-release" |
| 231 | fi |
| 232 | |
| 233 | # Update /etc/lsb-release |
| 234 | if [ -f "/etc/lsb-release" ]; then |
| 235 | print_ok "Updating /etc/lsb-release..." |
| 236 | sed -i 's/DISTRIB_RELEASE=1\.3\.7/DISTRIB_RELEASE=1.4.0/g' /etc/lsb-release |
| 237 | sed -i 's/DISTRIB_CODENAME=plucky/DISTRIB_CODENAME=questing/g' /etc/lsb-release |
| 238 | sed -i 's/DISTRIB_DESCRIPTION="AnduinOS 1\.3\.7"/DISTRIB_DESCRIPTION="AnduinOS 1.4.0"/g' /etc/lsb-release |
| 239 | judge "Update /etc/lsb-release" |
| 240 | fi |
| 241 | |
| 242 | print_ok "Release files updated successfully" |
| 243 | } |
| 244 | |
| 245 | function restore_ppa_sources() { |
| 246 | print_ok "Restoring PPA sources..." |
| 247 | |
| 248 | if [ -d "$PPA_BACKUP_DIR" ]; then |
| 249 | ppa_count=$(ls -1 "$PPA_BACKUP_DIR" 2>/dev/null | wc -l) |
| 250 | |
| 251 | if [ "$ppa_count" -gt 0 ]; then |
| 252 | for file in "$PPA_BACKUP_DIR"/*; do |
| 253 | if [ -f "$file" ]; then |
| 254 | mv "$file" /etc/apt/sources.list.d/ |
| 255 | print_ok "Restored $(basename "$file")" |
| 256 | fi |
| 257 | done |
| 258 | |
| 259 | print_ok "Running apt update with restored PPAs..." |
| 260 | apt update |
| 261 | judge "Restore PPA sources and update" |
| 262 | else |
| 263 | print_ok "No PPA sources to restore" |
| 264 | fi |
| 265 | else |
| 266 | print_warn "PPA backup directory not found, skipping restore" |
| 267 | fi |
| 268 | } |
| 269 | |
| 270 | function main() { |
| 271 | print_ok "Starting AnduinOS upgrade process..." |
| 272 | |
| 273 | echo -e "${Yellow}WARNING: This script will upgrade your system from 1.3.7 (plucky) to 1.4.0 (questing).${Font}" |
| 274 | echo -e "${Yellow}Please ensure you have backed up important data before proceeding.${Font}" |
| 275 | read -p "Do you want to continue? (y/N): " confirm |
| 276 | if [[ "$confirm" != "y" && "$confirm" != "Y" ]]; then |
| 277 | print_error "Upgrade process aborted by user." |
| 278 | exit 1 |
| 279 | fi |
| 280 | |
| 281 | # Check if running as root |
| 282 | if [[ "$(id -u)" -ne 0 ]]; then |
| 283 | print_error "This script must not be run as root. Please run as a normal user with privileges." |
| 284 | exit 1 |
| 285 | fi |
| 286 | |
| 287 | # Step 1: Update current system |
| 288 | update_system |
| 289 | |
| 290 | # Step 2: Backup Ubuntu official sources |
| 291 | backup_ubuntu_sources |
| 292 | |
| 293 | # Step 3: Backup and remove PPA sources |
| 294 | backup_and_remove_ppa |
| 295 | |
| 296 | # Step 4: Detect and convert APT format if needed |
| 297 | if ! detect_apt_format; then |
| 298 | convert_old_to_new_format |
| 299 | fi |
| 300 | |
| 301 | # Step 5: Replace plucky with questing |
| 302 | replace_plucky_with_questing |
| 303 | |
| 304 | # Step 6: Install coreutils-from-uutils |
| 305 | install_coreutils_uutils |
| 306 | |
| 307 | # Step 7: Run dist-upgrade |
| 308 | run_dist_upgrade |
| 309 | |
| 310 | # Step 8: Update release files |
| 311 | update_release_files |
| 312 | |
| 313 | # Step 9: Restore PPA sources |
| 314 | restore_ppa_sources |
| 315 | |
| 316 | print_ok "Upgrade completed successfully!" |
| 317 | print_ok "Your system has been upgraded to AnduinOS 1.4.0 (questing)" |
| 318 | print_ok "Backup files are stored in: $BACKUP_DIR" |
| 319 | print_warn "Please reboot your system to complete the upgrade." |
| 320 | } |
| 321 | |
| 322 | main |