最終更新 2 days ago

anduin's Avatar anduin revised this gist 2 days ago. Go to revision

1 file changed, 10 insertions

ubuntu_to_aos.sh

@@ -199,6 +199,16 @@ print_ok "Upgrading GNOME Shell extensions..."
199 199 sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/gnome-shell/extensions/ /usr/share/gnome-shell/extensions/
200 200 judge "Upgrade GNOME Shell extensions"
201 201
202 + print_ok "Upgrading icon and theme files..."
203 + sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/icons/ /usr/share/icons/
204 + sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/themes/ /usr/share/themes/
205 + judge "Upgrade icon and theme files"
206 +
207 + print_ok "Upgrading desktop backgrounds..."
208 + sudo rsync -Aax --update /mnt/anduinos_squashfs/usr/share/backgrounds/ /usr/share/backgrounds/
209 + sudo rsync -Aax --update /mnt/anduinos_squashfs/usr/share/gnome-background-properties/ /usr/share/gnome-background-properties/
210 + judge "Upgrade desktop backgrounds"
211 +
202 212 print_ok "Upgrading APT configuration files..."
203 213 sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/etc/apt/apt.conf.d/ /etc/apt/apt.conf.d/
204 214 judge "Upgrade APT configuration files"

anduin's Avatar anduin revised this gist 2 days ago. Go to revision

1 file changed, 4 insertions, 4 deletions

ubuntu_to_aos.sh

@@ -242,14 +242,14 @@ judge "Update system version information"
242 242 print_ok "Applying dconf settings patch..."
243 243 VERSION=$(grep -oP "VERSION_ID=\"\\K\\d+\\.\\d+" /etc/os-release)
244 244 PATCH_URL="https://gitlab.aiursoft.cn/anduin/anduinos/-/raw/$VERSION/src/mods/35-dconf-patch/dconf.ini?ref_type=heads"
245 -
246 245 COMMAND_TO_RUN="set -o pipefail; curl -sL '$PATCH_URL' | dconf load /org/gnome/"
247 -
248 - if [[ -n "$SUDO_USER" ]]; then
246 + if [[ -n "${SUDO_USER-}" ]]; then
247 + print_ok "Applying dconf patch for user: $SUDO_USER"
249 248 sudo -u "$SUDO_USER" DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u $SUDO_USER)/bus" \
250 249 bash -c "$COMMAND_TO_RUN"
251 250 else
252 - bash -c "$COMMAND_TO_RUN"
251 + print_warn "Running as root without sudo context. Skipping user dconf patch."
252 + true
253 253 fi
254 254 judge "Apply dconf settings patch"
255 255

anduin's Avatar anduin revised this gist 2 days ago. Go to revision

1 file changed, 4 insertions, 2 deletions

ubuntu_to_aos.sh

@@ -243,11 +243,13 @@ print_ok "Applying dconf settings patch..."
243 243 VERSION=$(grep -oP "VERSION_ID=\"\\K\\d+\\.\\d+" /etc/os-release)
244 244 PATCH_URL="https://gitlab.aiursoft.cn/anduin/anduinos/-/raw/$VERSION/src/mods/35-dconf-patch/dconf.ini?ref_type=heads"
245 245
246 + COMMAND_TO_RUN="set -o pipefail; curl -sL '$PATCH_URL' | dconf load /org/gnome/"
247 +
246 248 if [[ -n "$SUDO_USER" ]]; then
247 249 sudo -u "$SUDO_USER" DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u $SUDO_USER)/bus" \
248 - bash -c "curl -sL '$PATCH_URL' | dconf load /org/gnome/"
250 + bash -c "$COMMAND_TO_RUN"
249 251 else
250 - bash -c "curl -sL '$PATCH_URL' | dconf load /org/gnome/"
252 + bash -c "$COMMAND_TO_RUN"
251 253 fi
252 254 judge "Apply dconf settings patch"
253 255

anduin's Avatar anduin revised this gist 2 days ago. Go to revision

1 file changed, 5 deletions

ubuntu_to_aos.sh

@@ -5,11 +5,6 @@
5 5 set -e # exit on error
6 6 set -o pipefail # exit on pipeline error
7 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 8
14 9 #==========================
15 10 # Color

anduin's Avatar anduin revised this gist 2 days ago. Go to revision

1 file changed, 1 insertion, 1 deletion

ubuntu_to_aos.sh

@@ -233,7 +233,7 @@ sudo rsync -Aax /mnt/anduinos_squashfs/etc/systemd/user/default.target.wants/des
233 233 judge "Upgrade deskmon service"
234 234
235 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
236 + sudo rsync -Aax /mnt/anduinos_squashfs/usr/local/bin/do_anduinos_upgrade /usr/local/bin/do_anduinos_upgrade
237 237 sudo rsync -Aax /mnt/anduinos_squashfs/usr/bin/add-apt-repository /usr/bin/add-apt-repository
238 238 sudo rsync -Aax /mnt/anduinos_squashfs/etc/lsb-release /etc/lsb-release
239 239 sudo rsync -Aax /mnt/anduinos_squashfs/etc/issue /etc/issue

anduin's Avatar anduin revised this gist 2 days ago. Go to revision

1 file changed, 6 insertions, 5 deletions

ubuntu_to_aos.sh

@@ -5,7 +5,11 @@
5 5 set -e # exit on error
6 6 set -o pipefail # exit on pipeline error
7 7 set -u # treat unset variable as error
8 -
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)
9 13
10 14 #==========================
11 15 # Color
@@ -68,7 +72,7 @@ clean_up
68 72 print_ok "Checking system compatibility..."
69 73 codename=$(lsb_release -cs)
70 74 if [[ "$codename" != "questing" ]] then
71 - print_error "This upgrade script only supports AnduinOS Noble, Verne, and Turing."
75 + print_error "This upgrade script can only be run *from* AnduinOS Questing."
72 76 exit 1
73 77 fi
74 78 judge "System compatibility check"
@@ -223,12 +227,9 @@ sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/distro-info/
223 227 judge "Upgrade python-apt templates and distro info"
224 228
225 229 print_ok "Upgrading deskmon service..."
226 - systemctl --user stop deskmon.service || true
227 230 sudo rsync -Aax /mnt/anduinos_squashfs/usr/local/bin/deskmon /usr/local/bin/deskmon
228 231 sudo rsync -Aax /mnt/anduinos_squashfs/etc/systemd/user/deskmon.service /etc/systemd/user/deskmon.service
229 232 sudo rsync -Aax /mnt/anduinos_squashfs/etc/systemd/user/default.target.wants/deskmon.service /etc/systemd/user/default.target.wants/deskmon.service
230 - systemctl --user daemon-reload
231 - systemctl --user start deskmon.service
232 233 judge "Upgrade deskmon service"
233 234
234 235 print_ok "Updating system version information..."

anduin's Avatar anduin revised this gist 2 days ago. Go to revision

1 file changed, 1 insertion, 5 deletions

ubuntu_to_aos.sh

@@ -5,11 +5,7 @@
5 5 set -e # exit on error
6 6 set -o pipefail # exit on pipeline error
7 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)
8 +
13 9
14 10 #==========================
15 11 # Color

anduin's Avatar anduin revised this gist 2 days ago. Go to revision

1 file changed, 13 insertions, 11 deletions

ubuntu_to_aos.sh

@@ -140,12 +140,8 @@ sudo mount -o loop,ro "$ISO_FILE_PATH" /mnt/anduinos_iso
140 140 judge "Mount ISO"
141 141
142 142 print_ok "Verifying content in the ISO..."
143 - (
144 - cd /mnt/anduinos_iso && \
145 - sudo md5sum -c md5sum.txt && \
146 - print_ok "Verify content succeeded."
147 - )
148 - print_ok "Content integrity verified."
143 + (cd /mnt/anduinos_iso && sudo md5sum -c md5sum.txt)
144 + judge "ISO content integrity verification"
149 145
150 146 print_ok "Mounting the filesystem.squashfs..."
151 147 sudo mkdir -p /mnt/anduinos_squashfs
@@ -165,19 +161,18 @@ judge "Reset APT configuration files"
165 161 # Add Mozilla Team PPA
166 162 print_ok "Updating Mozilla Team PPA..."
167 163 sudo rm -f /etc/apt/sources.list.d/mozillateam*
168 - sudo cp /mnt/anduinos_squashfs/etc/apt/sources.list.d/mozillateam* /etc/apt/sources.list.d/
164 + sudo rsync -Aax /mnt/anduinos_squashfs/etc/apt/sources.list.d/mozillateam* /etc/apt/sources.list.d/
169 165 judge "Update Mozilla Team PPA"
170 166
171 167 # Install missing package.
172 168 print_ok "Installing missing packages from the new release..."
173 169 MANIFEST_FILE="/mnt/anduinos_iso/casper/filesystem.manifest-desktop"
174 - PACKAGE_LIST=$(cut -d' ' -f1 "$MANIFEST_FILE" \
170 + cut -d' ' -f1 "$MANIFEST_FILE" \
175 171 | grep -v '^linux-' \
176 172 | grep -v '^lib' \
177 173 | grep -v '^plymouth-' \
178 174 | grep -v '^software-properties-' \
179 - | xargs)
180 - sudo apt install -y $PACKAGE_LIST
175 + | xargs sudo apt install -y # <-- 让 xargs 自己调用 apt
181 176 judge "Install missing packages"
182 177
183 178 # Remove obsolete packages.
@@ -254,7 +249,14 @@ judge "Update system version information"
254 249
255 250 print_ok "Applying dconf settings patch..."
256 251 VERSION=$(grep -oP "VERSION_ID=\"\\K\\d+\\.\\d+" /etc/os-release)
257 - curl -sL https://gitlab.aiursoft.cn/anduin/anduinos/-/raw/$VERSION/src/mods/35-dconf-patch/dconf.ini?ref_type=heads | dconf load /org/gnome/
252 + PATCH_URL="https://gitlab.aiursoft.cn/anduin/anduinos/-/raw/$VERSION/src/mods/35-dconf-patch/dconf.ini?ref_type=heads"
253 +
254 + if [[ -n "$SUDO_USER" ]]; then
255 + sudo -u "$SUDO_USER" DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u $SUDO_USER)/bus" \
256 + bash -c "curl -sL '$PATCH_URL' | dconf load /org/gnome/"
257 + else
258 + bash -c "curl -sL '$PATCH_URL' | dconf load /org/gnome/"
259 + fi
258 260 judge "Apply dconf settings patch"
259 261
260 262 print_ok "Upgrade completed! Please reboot your system to apply all changes."

anduin's Avatar anduin revised this gist 2 days ago. Go to revision

1 file changed, 19 insertions, 18 deletions

ubuntu_to_aos.sh

@@ -162,6 +162,12 @@ print_ok "Resetting APT configuration files..."
162 162 sudo rm /etc/apt/preferences.d/* >/dev/null 2>&1 || true
163 163 judge "Reset APT configuration files"
164 164
165 + # Add Mozilla Team PPA
166 + print_ok "Updating Mozilla Team PPA..."
167 + sudo rm -f /etc/apt/sources.list.d/mozillateam*
168 + sudo cp /mnt/anduinos_squashfs/etc/apt/sources.list.d/mozillateam* /etc/apt/sources.list.d/
169 + judge "Update Mozilla Team PPA"
170 +
165 171 # Install missing package.
166 172 print_ok "Installing missing packages from the new release..."
167 173 MANIFEST_FILE="/mnt/anduinos_iso/casper/filesystem.manifest-desktop"
@@ -174,6 +180,7 @@ PACKAGE_LIST=$(cut -d' ' -f1 "$MANIFEST_FILE" \
174 180 sudo apt install -y $PACKAGE_LIST
175 181 judge "Install missing packages"
176 182
183 + # Remove obsolete packages.
177 184 print_ok "Removing obsolete packages..."
178 185 sudo apt autoremove -y \
179 186 distro-info \
@@ -224,31 +231,25 @@ sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/python-apt/te
224 231 sudo rsync -Aax --update --delete /mnt/anduinos_squashfs/usr/share/distro-info/ /usr/share/distro-info/
225 232 judge "Upgrade python-apt templates and distro info"
226 233
227 -
228 234 print_ok "Upgrading deskmon service..."
229 235 systemctl --user stop deskmon.service || true
230 - sudo cp /mnt/anduinos_squashfs/usr/local/bin/deskmon /usr/local/bin/deskmon
231 - sudo cp /mnt/anduinos_squashfs/etc/systemd/user/deskmon.service /etc/systemd/user/deskmon.service
232 - sudo cp /mnt/anduinos_squashfs/etc/systemd/user/default.target.wants/deskmon.service /etc/systemd/user/default.target.wants/deskmon.service
236 + sudo rsync -Aax /mnt/anduinos_squashfs/usr/local/bin/deskmon /usr/local/bin/deskmon
237 + sudo rsync -Aax /mnt/anduinos_squashfs/etc/systemd/user/deskmon.service /etc/systemd/user/deskmon.service
238 + sudo rsync -Aax /mnt/anduinos_squashfs/etc/systemd/user/default.target.wants/deskmon.service /etc/systemd/user/default.target.wants/deskmon.service
233 239 systemctl --user daemon-reload
234 240 systemctl --user start deskmon.service
235 241 judge "Upgrade deskmon service"
236 242
237 - print_ok "Updating Mozilla Team PPA..."
238 - sudo rm -f /etc/apt/sources.list.d/mozillateam*
239 - sudo cp /mnt/anduinos_squashfs/etc/apt/sources.list.d/mozillateam* /etc/apt/sources.list.d/
240 - judge "Update Mozilla Team PPA"
241 -
242 243 print_ok "Updating system version information..."
243 - sudo cp /mnt/anduinos_squashfs/usr/bin/do_anduinos_upgrade /usr/local/bin/do_anduinos_upgrade
244 - sudo cp /mnt/anduinos_squashfs/usr/bin/add-apt-repository /usr/bin/add-apt-repository
245 - sudo cp /mnt/anduinos_squashfs/etc/lsb-release /etc/lsb-release
246 - sudo cp /mnt/anduinos_squashfs/etc/issue /etc/issue
247 - sudo cp /mnt/anduinos_squashfs/etc/issue.net /etc/issue
248 - sudo cp /mnt/anduinos_squashfs/etc/os-release /etc/os-release
249 - sudo cp /mnt/anduinos_squashfs/usr/lib/os-release /usr/lib/os-release
250 - sudo cp /mnt/anduinos_squashfs/etc/legal /etc/legal
251 - sudo cp /mnt/anduinos_squashfs/etc/sysctl.d/20-apparmor-donotrestrict.conf /etc/sysctl.d/20-apparmor-donotrestrict.conf
244 + sudo rsync -Aax /mnt/anduinos_squashfs/usr/bin/do_anduinos_upgrade /usr/local/bin/do_anduinos_upgrade
245 + sudo rsync -Aax /mnt/anduinos_squashfs/usr/bin/add-apt-repository /usr/bin/add-apt-repository
246 + sudo rsync -Aax /mnt/anduinos_squashfs/etc/lsb-release /etc/lsb-release
247 + sudo rsync -Aax /mnt/anduinos_squashfs/etc/issue /etc/issue
248 + sudo rsync -Aax /mnt/anduinos_squashfs/etc/issue.net /etc/issue.net
249 + sudo rsync -Aax /mnt/anduinos_squashfs/etc/os-release /etc/os-release
250 + sudo rsync -Aax /mnt/anduinos_squashfs/usr/lib/os-release /usr/lib/os-release
251 + sudo rsync -Aax /mnt/anduinos_squashfs/etc/legal /etc/legal
252 + sudo rsync -Aax /mnt/anduinos_squashfs/etc/sysctl.d/20-apparmor-donotrestrict.conf /etc/sysctl.d/20-apparmor-donotrestrict.conf
252 253 judge "Update system version information"
253 254
254 255 print_ok "Applying dconf settings patch..."

anduin's Avatar anduin revised this gist 2 days ago. Go to revision

1 file changed, 1 insertion, 1 deletion

ubuntu_to_aos.sh

@@ -190,7 +190,7 @@ sudo apt autoremove -y \
190 190 update-notifier \
191 191 ubuntu-release-upgrader-core \
192 192 ubuntu-advantage-desktop-daemon \
193 - kgx \
193 + kgx
194 194 judge "Remove obsolete packages"
195 195
196 196 print_ok "Upgrading installed packages..."
Newer Older