Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 5a4edf6
Author: UriHerrera <[email protected]>
Date:   Tue Jan 16 11:40:37 2024 -0600

    use main to dl var data

commit a03c524
Author: UriHerrera <[email protected]>
Date:   Tue Jan 16 11:39:29 2024 -0600

    add spinner to crr

    - and silence update-
  • Loading branch information
UriHerrera committed Jan 16, 2024
1 parent 1150d87 commit f16b404
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 12 deletions.
8 changes: 8 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
nuts (2.1.1) nitrux; urgency=medium

* Fix URL of var data.
* Use spinner in nuts-crr
* Silence update-grub.

-- Uri Herrera <[email protected]> Tue, 16 Jan 2023 11:47:00 -0500

nuts (2.1.0) nitrux; urgency=medium

* Refactor nuts-cru (update component).
Expand Down
4 changes: 2 additions & 2 deletions tmp/nuts-ccu
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,12 @@ puts_success "System AppImages and static binaries have been updated, continuing

# -- Link kernel image to newer kernel.

#<!> -- Remove code since we're not including the kernel in the archive, and we expect users to use Kernel Boot to use other kenels. -- <!>
#<!> -- Remove code since we're not including the kernel in the archive, and we expect users to use Kernel Boot to add other kenels. -- <!>


# -- Update GRUB.

if update-grub; then
if update-grub > /dev/null 2>&1; then
puts_success "Success! GRUB menu was updated, continuing..."
else
puts_error "Failed to update GRUB menu, quitting."
Expand Down
34 changes: 25 additions & 9 deletions tmp/nuts-crr
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,22 @@ unmount_on_failure() {
exit 1
}

spinner() {
local pid=$!
local delay=0.1
local spinstr='|/-\'
local elapsed=0

while ps a | awk '{print $1}' | grep -q "$pid"; do
local temp=${spinstr#?}
printf " [%c] Elapsed time: %s seconds" "$spinstr" "$elapsed"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
elapsed=$(echo "$elapsed + $delay" | bc)
printf "\r"
done
printf "\n"
}

# -- Variables.

Expand Down Expand Up @@ -262,19 +278,14 @@ fi

puts_info "Restoring backup of ${CURRENT_DIST^}, continuing..."

dl_file "https://raw.githubusercontent.com/Nitrux/nuts/$NUTS_BRANCH/tmp/rsync-exclude.list"
dl_file "https://raw.githubusercontent.com/Nitrux/nuts/$NUTS_BRANCH/tmp/rsync-exclude.list" > /dev/null 2>&1

SOURCE_DIR="$NUTS_DIR_SQS"
DESTINATION_DIR="/"
EXCLUDES_FILE="/tmp/rsync-exclude.list"

RSYNC_COMMAND="stdbuf -oL rsync -aHAXh --info=progress2 --progress --exclude-from=$EXCLUDES_FILE $SOURCE_DIR/ $DESTINATION_DIR"
eval "$RSYNC_COMMAND" | {
while IFS= read -r line; do
echo -ne "\rProgress: $line\033[K"
done
echo -e "\n"
}
rsync -aHAXh --exclude-from="$EXCLUDES_FILE" "$SOURCE_DIR/" "$DESTINATION_DIR" > /dev/null 2>&1 &
spinner

sync

Expand All @@ -290,7 +301,12 @@ puts_success "Success! ${TARGET_DIST^} update rolled back."

# -- Update GRUB.

update-grub
if update-grub > /dev/null 2>&1; then
puts_success "Success! GRUB menu was updated, continuing..."
else
puts_error "Failed to update GRUB menu, quitting."
exit 1
fi


# -- Unmount directories after restore and before exiting chroot.
Expand Down
2 changes: 1 addition & 1 deletion tmp/nuts-cru
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ puts_info "Updating ${CURRENT_DIST^}, continuing..."
APPIMAGE_URL="https://github.com/UriHerrera/storage/raw/master/AppImages/dpkg-1.19.7-x86_64.AppImage"
AIFILE_DL_PATH="/tmp/dpkg-1.19.7-x86_64.AppImage"
AIPKG_MANAGER="/tmp/pkgman"
VAR_DATA_URL="https://raw.githubusercontent.com/Nitrux/storage/development/Other/var-lib-dpkg-3-2-0.tar.xz"
VAR_DATA_URL="https://raw.githubusercontent.com/Nitrux/storage/main/Other/var-lib-dpkg-3-2-0.tar.xz"
TARFILE_DL_PATH="/tmp/var-lib-dpkg-3-2-0.tar.xz"

if dl_file "$APPIMAGE_URL" > "$AIFILE_DL_PATH" && \
Expand Down

0 comments on commit f16b404

Please sign in to comment.