From 4158d8673e625e6f29169c36d57cf4426f0ffb2e Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Wed, 21 Feb 2024 15:39:50 +0300 Subject: [PATCH] Archive : Add touch function. --- .config/bash/module/Archive.sh | 16 ++++++++++++++++ .doc/Bash.md | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.config/bash/module/Archive.sh b/.config/bash/module/Archive.sh index 1d59fb3..4dd8628 100644 --- a/.config/bash/module/Archive.sh +++ b/.config/bash/module/Archive.sh @@ -248,6 +248,22 @@ function unarchive() { _iterate_targets process ${targets[@]} } +# Change archive's filesystem time to match creation date. +# Usage: archive_touch [FILES] +function archive_touch() { + local IFS=$'\n' + local targets=(${@}) + [[ "${targets}" = "" ]] && targets=$(_ls_archive) + + process() { + local data=($(_archive_parse "${target}")) + local date=${data[1]} + touch -t ${date} -- ${target} + } + + _iterate_targets process ${targets[@]} +} + # Parse archive file name to get: name, date, hash and format. # Usage: _archive_parse function _archive_parse() { diff --git a/.doc/Bash.md b/.doc/Bash.md index 339d6eb..2f231be 100644 --- a/.doc/Bash.md +++ b/.doc/Bash.md @@ -29,6 +29,7 @@ Command|Description `archive_xz [FILES]`|Recompress previously created archive_fast with better compression. `archive_name [ARCHIVE] [NAME]`|Rename archives. If no name specified, it simplifies archive's name. If no archives specified, apply to all archives. `unarchive [FILES]`|Extract previously created archive with checksum validation. +`archive_touch [FILES]`|Change archive's filesystem time to match creation date. ## Battery. @@ -43,7 +44,7 @@ Command|Description ---|--- `bootstrap_editorconfig`| Install Editorconfig file (with tabs) in current directory. `bootstrap_editorconfig_space [AMOUNT]`|Install Editorconfig file (with specified spaces, 8 by default) in current directory. -`bootstrap_flatpak`| Setup all the flatpak apps on the machine. +`bootstrap_nixos [HOST]`|Install nixos to specified drive. To be run from Live ISO. ## Cd. @@ -211,6 +212,7 @@ Command|Description `gu [EMAIL]`|Specify git user as Dmitry Voronin with provided email. `gg `|Get my git repo. `gdc `|See diff for a specific commit. +`gv`| Get version number based on commit count. ## Group. @@ -271,6 +273,7 @@ Command|Description `nix_prune`| Free up root space. `nix_shell [NAME]`|Spawn shell with specified nix environment. Uses flake.nix in current dir by default. `nix_tmpshell `|Spawn nix-shell with specified packages. +`nix_live`| Build live image. ## Notify.