/usr/sbin/ocs-tune-conf-for-s3-swift is in clonezilla 3.27.16-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #!/bin/bash
# License: GPL
# Author: Steven Shiau <steven _at_ nchc org tw>
# Description: Program to assign a friendly AWS S3/Swift setting for uploading Clonezilla image:
# It will modify the following parameters in /etc/drbl/drbl-ocs.conf. This will only be done in DRBL/Clonezilla live env.
# ===============
# VOL_LIMIT_DEFAULT="1000000"
# VOL_LIMIT_IN_INTERACTIVE="4096"
# split_suf_len="2"
# ===============
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
. /etc/drbl/drbl-ocs.conf
. $DRBL_SCRIPT_PATH/sbin/ocs-functions
# Settings:
############
### MAIN ###
############
# If it's not in DRBL/Clonezilla live env, exit.
if ! is_drbl_clonezilla_live_env; then
exit 1
fi
# For Clonezilla live, /tmp/ is tmpfs, which is on memory space. We use it to make sure the available RAM space.
free_dsk_space="$(LC_ALL=C df -BM /tmp/ | tail -n 1 | awk -F" " '{print $4}')"
# We set the cache size as that of davfs2 (i.e. 20% from drbl-ocs.conf) of the system. Unit: MiByte
s3_split_vol_size="$(LC_ALL=C printf "%.0f" "$(echo "${free_dsk_space%M} * ${ratio_davfs2_cache_2_free_disk}" | bc -l)")"
[ -z "$s3_split_vol_size" ] && s3_split_vol_size="$davfs2_cache_size_def"
# The s3_split_vol_size is actually applied to VOL_LIMIT_DEFAULT and VOL_LIMIT_IN_INTERACTIVE, too, so that single file won't be over size.
# volume size in drbl-ocs.conf has to be adjusted, too.
echo "Preparing the AWS S3/Swift friendly environment..."
perl -pi -e "s/^VOL_LIMIT_DEFAULT=.*/VOL_LIMIT_DEFAULT=$s3_split_vol_size # Modified by prep-ocsroot for s3fs or swift/" /etc/drbl/drbl-ocs.conf
perl -pi -e "s/^VOL_LIMIT_IN_INTERACTIVE=.*/VOL_LIMIT_IN_INTERACTIVE=$s3_split_vol_size # Modified by prep-ocsroot for s3fs or swift/" /etc/drbl/drbl-ocs.conf
# Change split suffixes of length to 3 so that the total size for single image file could be large enough.
perl -pi -e "s/^split_suf_len=.*/split_suf_len=$davfs2_split_suf_len_def # Modified by prep-ocsroot for s3fs or swift/" /etc/drbl/drbl-ocs.conf
|