Skip to content

Commit

Permalink
update pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
UriHerrera committed Jun 13, 2023
1 parent b1122cf commit b3a173e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
nuts (0.1.1) nitrux; urgency=medium

* Move working directories variables to conf file.
* Add backup delete functionality.

-- Uri Herrera <uri_herrera@nxos.org> Tue, 13 Jun 2023 02:20:00 -0500

nuts (0.1.0) nitrux; urgency=medium

* Revise ISO check.
Expand Down
13 changes: 10 additions & 3 deletions etc/nuts.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Default values for nuts
# nuts.conf 2023 (c) Nitrux Latinoamericana S.C.

# Define working directories.
# Defualt path is /home/.nuts
#
NUTS_DIR_DLS=/home/.nuts/downloads
NUTS_DIR_ISO=/home/.nuts/iso
NUTS_DIR_SQS=/home/.nuts/squashfs
NUTS_DIR_BAK=/home/.nuts/backup

# Define whether to use a date or not for backup file.
# Default value is: $(date +%Y.%m.%d-%H.%M)
# Replace the value with anything else if using a date is not wanted.
Expand All @@ -9,10 +17,9 @@ DATE_BACKUP_FILE=$(date +%Y.%m.%d-%H.%M)

# Define number of backups to keep when running update.
# Each backup is approximately 3.1 GiB.
# Default is -1 which means keep (1) file.
#
# FIXME: This option is non-functional yet.
#
KEEP_STORED_BACKUPS=2
BACKUPS_TO_KEEP=-1

# Define nuts log file name and path.
#
Expand Down
15 changes: 9 additions & 6 deletions usr/bin/nuts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ fi

dl_file () { axel -o /tmp -n 10 "$@"; }
overlay_ch () { $ROOT overlayroot-chroot; }
bak_del () { find "$NUTS_DIR_BAK" -maxdepth 1 -type f | head -n "$BACKUPS_TO_KEEP" | xargs --no-run-if-empty rm; }


# -- Use a log file.
Expand Down Expand Up @@ -202,11 +203,6 @@ case "$1" in
# -- First create the directories for nuts.
# -- Create working directories in /home since this partition will likely have more space than the root partition, as set in our custom partition layout and the instructions on the website.

NUTS_DIR_DLS="/home/.nuts/downloads"
NUTS_DIR_ISO="/home/.nuts/iso"
NUTS_DIR_SQS="/home/.nuts/squashfs"
NUTS_DIR_BAK="/home/.nuts/backup"

if [ ! -d "$NUTS_DIR_DLS" ] && [ ! -d "$NUTS_DIR_ISO" ] && [ ! -d "$NUTS_DIR_SQS" ] && [ ! -d "$NUTS_DIR_BAK" ]; then
puts-info "Creating working directories, continuing..."
$ROOT mkdir -p /home/.nuts/{iso,squashfs,backup}
Expand Down Expand Up @@ -261,7 +257,14 @@ case "$1" in

# -- This process begins as a step before doing an update.
# -- Backup files are only generated when updating; the user can't ask the utility to create them on demand.
# -- Older backups are kept just in case; however, the user can choose how many to keep by editing nuts.conf, This functionality is not implemented yet, though.

# -- Run the backup cleaner.
# -- Only keep the amount of backups defined in nuts.conf.

$ROOT bak_del


# -- Create the backup.
# -- We assume that the /home partition is on an internal storage device (SATA or NVME), but one can never know, so run sync to flush the write cache.

puts-info "Creating backup of ${CURRENT_DIST^n}, continuing..."
Expand Down

0 comments on commit b3a173e

Please sign in to comment.