Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add rsync cifs #20

Merged
merged 6 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.17.0]

### Added

- RSync
- rsync-copy-dir-cifs

### Changed

- RSync
- rsync-clone-dir-send-root -> rsync-clone-dir-local
- rsync-clone-dir-send-user -> rsync-copy-dir-local

### Removed

- RSync
- rsync-clone-dir-list-delta

## [0.16.0]

### Added
Expand Down
5 changes: 2 additions & 3 deletions src/aws-eks/aws-eks-addons-show
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#######################################
# AWS / EKS / AddOns / Show
#
# Version: 1.1.0
# Version: 1.1.1
#
#######################################
# Copyright [2024] [serdigital64@gmail.com]
Expand Down Expand Up @@ -43,7 +43,7 @@ function aws_eks_addons_list() {
list-addons \
$BL64_AWS_SET_FORMAT_JSON \
--cluster-name "$cluster_name" |
"$S64_CORE_PATH_JQ" \
bl64_xsv_run_jq \
-r '.addons[]'
}

Expand All @@ -63,7 +63,6 @@ function aws_eks_addons_show() {
function initialize() {
bl64_dbg_app_show_function
bl64_check_parameter 'CLUSTER_NAME' &&
bl64_check_command_search_path "$S64_CORE_PATH_JQ" &&
s64_aws_lib_setup
}

Expand Down
9 changes: 6 additions & 3 deletions src/core/aws-lib
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#######################################
# AWS / Lib
#
# Version: 2.0.0
# Version: 2.1.0
#
#######################################
# Copyright [2024] [serdigital64@gmail.com]
Expand All @@ -26,7 +26,8 @@
#

# shellcheck disable=SC2015,SC2154 source-path=SCRIPTDIR/../../lib/bl64
source "${S64_CORE_PATH_BL64}/bashlib64-module-bsh.bash" ||
source "${S64_CORE_PATH_BL64}/bashlib64-module-xsv.bash" ||
source "${S64_CORE_PATH_BL64}/bashlib64-module-bsh.bash" ||
source "${S64_CORE_PATH_BL64}/bashlib64-module-fmt.bash" &&
source "${S64_CORE_PATH_BL64}/bashlib64-module-txt.bash" &&
source "${S64_CORE_PATH_BL64}/bashlib64-module-fs.bash" &&
Expand Down Expand Up @@ -57,7 +58,9 @@ source "${S64_CORE_PATH_BL64}/bashlib64-module-bsh.bash" ||
#

function s64_aws_lib_setup() {
bl64_aws_setup &&
bl64_dbg_app_show_function
bl64_xsv_setup &&
bl64_aws_setup &&
s64_aws_lib_access_check
}

Expand Down
36 changes: 23 additions & 13 deletions src/core/core-lib
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#######################################
# Core / Lib
#
# Version: 1.2.0
# Version: 2.0.0
#
#######################################
# Copyright [2024] [serdigital64@gmail.com]
Expand All @@ -27,16 +27,26 @@

# shellcheck disable=SC2034
{
# Default SysOp64 install path
declare S64_CORE_PATH_ROOT="${S64_CORE_PATH_ROOT:-/opt/sysop64}"
# Default BL64 install path
declare S64_CORE_PATH_BL64="${S64_CORE_PATH_BL64:-/opt/bl64}"

# Default debut level
declare S64_CORE_SET_DEBUG="${S64_CORE_SET_DEBUG:-NONE}"
# Default verbose level
declare S64_CORE_SET_VERBOSE="${S64_CORE_SET_VERBOSE:-ALL}"

# Default JQuery tool path
declare S64_CORE_PATH_JQ="${S64_CORE_PATH_JQ:-/usr/bin/jq}"
# Default SysOp64 install path
declare S64_CORE_PATH_ROOT="${S64_CORE_PATH_ROOT:-/opt/sysop64}"

# Default BL64 install path
declare S64_CORE_PATH_BL64="${S64_CORE_PATH_BL64:-/opt/bl64}"

# Default log repository
declare S64_CORE_PATH_LOGS="${S64_CORE_PATH_LOGS:-${HOME}/logs-sysop64}"

# Default debut level
declare S64_CORE_SET_DEBUG="${S64_CORE_SET_DEBUG:-NONE}"

# Default verbose level
declare S64_CORE_SET_VERBOSE="${S64_CORE_SET_VERBOSE:-ALL}"
}

#
# Functions
#

function s64_core_lib_setup_logging() {
:
}
26 changes: 13 additions & 13 deletions src/core/rsync-lib
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#######################################
# RSync / Lib
#
# Version: 2.0.0
# Version: 2.1.0
#
#######################################
# Copyright [2024] [serdigital64@gmail.com]
Expand All @@ -26,7 +26,12 @@
#

# shellcheck disable=SC2015,SC2154 source-path=SCRIPTDIR/../../lib/bl64
source "${S64_CORE_PATH_BL64}/bashlib64-module-ui.bash" &&
source "${S64_CORE_PATH_BL64}/bashlib64-module-log.bash" &&
source "${S64_CORE_PATH_BL64}/bashlib64-module-fs.bash" &&
source "${S64_CORE_PATH_BL64}/bashlib64-module-txt.bash" &&
source "${S64_CORE_PATH_BL64}/bashlib64-module-xsv.bash" &&
source "${S64_CORE_PATH_BL64}/bashlib64-module-fmt.bash" &&
source "${S64_CORE_PATH_BL64}/bashlib64-module-ui.bash" &&
source "${S64_CORE_PATH_BL64}/bashlib64-module-bsh.bash" ||
{ echo 'Error: unable to load bashlib64' && exit 1; }

Expand All @@ -37,20 +42,15 @@ source "${S64_CORE_PATH_BL64}/bashlib64-module-ui.bash" &&
# shellcheck disable=SC2034
{
declare S64_RSYNC_PATH_CLI="${S64_RSYNC_PATH_CLI:-}"

declare S64_RSYNC_OPTIONS_COMMON=''
S64_RSYNC_OPTIONS_COMMON+=' --one-file-system'
S64_RSYNC_OPTIONS_COMMON+=' --human-readable'
S64_RSYNC_OPTIONS_COMMON+=' --progress'
S64_RSYNC_OPTIONS_COMMON+=' --stats'
S64_RSYNC_OPTIONS_COMMON+=' --recursive'
S64_RSYNC_OPTIONS_COMMON+=' --checksum'
S64_RSYNC_OPTIONS_COMMON+=' --links'
S64_RSYNC_OPTIONS_COMMON+=' --delete'
S64_RSYNC_OPTIONS_COMMON+=' --mkpath'
S64_RSYNC_OPTIONS_COMMON+=' --verbose'
S64_RSYNC_OPTIONS_COMMON+=' --perms'
S64_RSYNC_OPTIONS_COMMON+=' --checksum'
S64_RSYNC_OPTIONS_COMMON+=' --compress'

declare S64_RSYNC_OPTIONS_LOCAL=''
S64_RSYNC_OPTIONS_LOCAL+=' --links'
S64_RSYNC_OPTIONS_LOCAL+=' --perms'
}

#
Expand All @@ -68,7 +68,7 @@ function s64_rsync_lib_setup() {

function s64_rsync_lib_run_rsync() {
bl64_dbg_app_show_function "$@"
local verbose_flag='--verbose'
local verbose_flag='--human-readable --verbose --stats'
bl64_msg_app_verbose_enabled || verbose_flag=' '
bl64_dbg_app_trace_start
# shellcheck disable=SC2086
Expand Down
5 changes: 3 additions & 2 deletions src/linux-fs/linux-fs-cifs-mount
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#######################################
# Linux / FS / CIFS / Mount
#
# Version: 1.0.1
# Version: 1.0.2
#
#######################################
# Copyright [2024] [serdigital64@gmail.com]
Expand Down Expand Up @@ -40,7 +40,8 @@ function initialize() {
bl64_check_privilege_root &&
bl64_check_parameter 'CIFS_SERVER_IP' &&
bl64_check_parameter 'CIFS_SHARE_NAME' &&
bl64_check_parameter 'MOUNT_PATH'
bl64_check_parameter 'MOUNT_PATH' &&
bl64_check_directory "$MOUNT_PATH" &&
s64_linux_lib_setup
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
# template-one: 2.0.0
#######################################
# RSync / Clone / Dir / Send / Root
# RSync / Clone / Dir / Local
#
# Version: 1.0.1
# Version: 1.0.2
#
#######################################
# Copyright [2024] [serdigital64@gmail.com]
Expand Down Expand Up @@ -38,10 +38,10 @@ source "${S64_CORE_PATH_BL64}/bashlib64-core.bash" || { echo 'Error: unable to l
function initialize() {
bl64_dbg_app_show_function
bl64_check_privilege_root &&
s64_rsync_lib_setup &&
bl64_check_parameter 'RSYNC_CLONE_FROM' &&
bl64_check_parameter 'RSYNC_CLONE_TO' &&
bl64_check_directory "$RSYNC_CLONE_FROM"
bl64_check_directory "$RSYNC_CLONE_FROM" &&
s64_rsync_lib_setup
}

#
Expand All @@ -53,10 +53,14 @@ declare RSYNC_CLONE_TO="${2:-}"

bl64_dbg_set_level "$S64_CORE_SET_DEBUG" && bl64_msg_set_level "$S64_CORE_SET_VERBOSE" && initialize || exit $?
bl64_msg_show_batch_start "$BL64_SCRIPT_ID"
bl64_msg_show_info 'Copy files from Linux path to Linux path. Operation is privileged, source file ownership is kept.'
# shellcheck disable=SC2086
bl64_ui_ask_confirmation "Warning: destination content will be replaced (${RSYNC_CLONE_FROM} -> ${RSYNC_CLONE_TO})" &&
s64_rsync_lib_run_rsync \
$S64_RSYNC_OPTIONS_COMMON \
$S64_RSYNC_OPTIONS_LOCAL \
--recursive \
--delete \
--owner \
--group \
--times \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
# template-one: 2.0.0
#######################################
# RSync / Clone / Dir / Send / User
# RSync / Copy / Dir / CIFS
#
# Version: 1.0.1
# Version: 1.0.0
#
#######################################
# Copyright [2024] [serdigital64@gmail.com]
Expand Down Expand Up @@ -52,10 +52,20 @@ declare RSYNC_CLONE_TO="${2:-}"

bl64_dbg_set_level "$S64_CORE_SET_DEBUG" && bl64_msg_set_level "$S64_CORE_SET_VERBOSE" && initialize || exit $?
bl64_msg_show_batch_start "$BL64_SCRIPT_ID"
bl64_msg_show_info 'Copy files from Linux path to CIFS path. The operation will try to adapt linux files attributes and names to CIFS equivalents.'
# shellcheck disable=SC2086
bl64_ui_ask_confirmation "Warning: destination content will be replaced (${RSYNC_CLONE_FROM} -> ${RSYNC_CLONE_TO})" &&
s64_rsync_lib_run_rsync \
$S64_RSYNC_OPTIONS_COMMON \
--recursive \
--delete \
--no-links \
--no-perms \
--no-acls \
--no-owner \
--no-group \
--no-devices \
--numeric-ids \
"$RSYNC_CLONE_FROM" \
"$RSYNC_CLONE_TO"
bl64_msg_show_batch_finish $? "$BL64_SCRIPT_ID"
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
# template-one: 2.0.0
#######################################
# RSync / Clone / Dir / List / Delta
# RSync / Copy / Dir / Local
#
# Version: 1.0.1
# Version: 1.0.2
#
#######################################
# Copyright [2024] [serdigital64@gmail.com]
Expand Down Expand Up @@ -37,10 +37,10 @@ source "${S64_CORE_PATH_BL64}/bashlib64-core.bash" || { echo 'Error: unable to l

function initialize() {
bl64_dbg_app_show_function
s64_rsync_lib_setup &&
bl64_check_parameter 'RSYNC_CLONE_FROM' &&
bl64_check_parameter 'RSYNC_CLONE_FROM' &&
bl64_check_parameter 'RSYNC_CLONE_TO' &&
bl64_check_directory "$RSYNC_CLONE_FROM"
bl64_check_directory "$RSYNC_CLONE_FROM" &&
s64_rsync_lib_setup
}

#
Expand All @@ -52,11 +52,14 @@ declare RSYNC_CLONE_TO="${2:-}"

bl64_dbg_set_level "$S64_CORE_SET_DEBUG" && bl64_msg_set_level "$S64_CORE_SET_VERBOSE" && initialize || exit $?
bl64_msg_show_batch_start "$BL64_SCRIPT_ID"
bl64_msg_show_task "Show delta between source and destination (${RSYNC_CLONE_FROM} -> ${RSYNC_CLONE_TO})"
bl64_msg_show_info 'Copy files from Linux path to Linux path. Operation is non-privileged, source file ownership is not kept.'
# shellcheck disable=SC2086
s64_rsync_lib_run_rsync \
$S64_RSYNC_OPTIONS_COMMON \
--dry-run \
"$RSYNC_CLONE_FROM" \
"$RSYNC_CLONE_TO"
bl64_ui_ask_confirmation "Warning: destination content will be replaced (${RSYNC_CLONE_FROM} -> ${RSYNC_CLONE_TO})" &&
s64_rsync_lib_run_rsync \
$S64_RSYNC_OPTIONS_COMMON \
$S64_RSYNC_OPTIONS_LOCAL \
--recursive \
--delete \
"$RSYNC_CLONE_FROM" \
"$RSYNC_CLONE_TO"
bl64_msg_show_batch_finish $? "$BL64_SCRIPT_ID"
Loading