Compare commits

..

10 commits

Author SHA1 Message Date
377acbd817
−readme 2024-11-29 21:04:02 +01:00
c3240b8b15
−cs 2024-11-29 20:23:01 +01:00
2f686e3512
lint/shellcheck 2024-11-29 19:58:38 +01:00
a56aa8124f
gnome 2024-11-29 19:58:07 +01:00
dda61e2594
rescue/hetzner 2024-11-29 19:55:33 +01:00
4d64db0b70
rescue/ovh 2024-11-29 19:53:27 +01:00
a0d487f473
rescue/common 2024-11-29 19:51:23 +01:00
dc66287ed1
alias/overlay 2024-11-29 19:45:58 +01:00
ecff8f16bc
sc/ifs 2024-11-29 19:43:06 +01:00
de22cafbd0
main 2024-11-29 19:41:07 +01:00
10 changed files with 75 additions and 251 deletions

82
cs
View file

@ -1,82 +0,0 @@
#! /usr/bin/env bash
FILE="$(realpath "${BASH_SOURCE[0]}")"
NAME="$(basename "${FILE}")"
ACTION_OPEN='open'
ACTION_CLOSE='close'
CONTAINERS_DIRECTORY="/data/home/user/crypt"
CONTAINERS_MAP_DIRECTORY='/dev/mapper'
CONTAINERS_MOUNT_DIRECTORY='/media'
function main {
local action="${1}"
local pass_phrase
local container
local container_name
local container_file
local container_map_file
local container_mount_directory
case "${action}" in
"${ACTION_OPEN}"|"${ACTION_CLOSE}")
shift
if [ "${1}" ]; then
if [ "${action}" == "${ACTION_OPEN}" ]; then
echo -n 'PassPhrase: '
read -r -s pass_phrase
echo
fi
for container in "${@}"; do
echo
case "${container}" in
'p') container_name='private' ;;
's') container_name='sensitive' ;;
'w') container_name='work' ;;
*) container_name="${container}" ;;
esac
container_file="${CONTAINERS_DIRECTORY}/${container_name}"
if [ -f "${container_file}" ]; then
container_map_file="${CONTAINERS_MAP_DIRECTORY}/${container_name}"
container_mount_directory="${CONTAINERS_MOUNT_DIRECTORY}/${container_name}"
case "${action}" in
"${ACTION_OPEN}")
echo "${container_file} → ${container_map_file}"
echo "${pass_phrase}" \
| cryptsetup luksOpen "${container_file}" "${container_name}"
if [ ${?} -eq 0 ]; then
mkdir --parents "${container_mount_directory}"
echo "${container_map_file} → ${container_mount_directory}"
mount "${container_map_file}" "${container_mount_directory}"
fi
;;
"${ACTION_CLOSE}")
echo "${container_map_file} ← ${container_mount_directory}"
if umount "${container_map_file}"; then
rmdir --ignore-fail-on-non-empty "${container_mount_directory}"
echo "${container_file} ← ${container_map_file}"
cryptsetup luksClose "${container_name}"
fi
;;
esac
else
echo 'This path does not point to a file!'
fi
done
else
echo 'No container name provided!'
fi
;;
*)
echo 'Usage:'
echo "${NAME} [${ACTION_OPEN}|${ACTION_CLOSE}] [p] [s] [w]"
echo
echo 'p = private'
echo 's = sensitive'
echo 'w = work'
;;
esac
}
main "${@}"

82
cs.old
View file

@ -1,82 +0,0 @@
#! /usr/bin/env bash
FILE="$(realpath "${BASH_SOURCE[0]}")"
NAME="$(basename "${FILE}")"
ACTION_OPEN='open'
ACTION_CLOSE='close'
CONTAINERS_DIRECTORY="/data/home/user/crypt"
CONTAINERS_MAP_DIRECTORY='/dev/mapper'
CONTAINERS_MOUNT_DIRECTORY='/media'
function main {
local action="${1}"
local pass_phrase
local container
local container_name
local container_file
local container_map_file
local container_mount_directory
case "${action}" in
"${ACTION_OPEN}"|"${ACTION_CLOSE}")
shift
if [ "${1}" ]; then
if [ "${action}" == "${ACTION_OPEN}" ]; then
echo -n 'PassPhrase: '
read -r -s pass_phrase
echo
fi
for container in "${@}"; do
echo
case "${container}" in
'p') container_name='private' ;;
's') container_name='sensitive' ;;
'w') container_name='work' ;;
*) container_name="${container}" ;;
esac
container_file="${CONTAINERS_DIRECTORY}/${container_name}"
if [ -f "${container_file}" ]; then
container_map_file="${CONTAINERS_MAP_DIRECTORY}/${container_name}"
container_mount_directory="${CONTAINERS_MOUNT_DIRECTORY}/${container_name}"
case "${action}" in
"${ACTION_OPEN}")
echo "${container_file} → ${container_map_file}"
echo "${pass_phrase}" \
| cryptsetup luksOpen "${container_file}" "${container_name}"
if [ ${?} -eq 0 ]; then
mkdir --parents "${container_mount_directory}"
echo "${container_map_file} → ${container_mount_directory}"
mount "${container_map_file}" "${container_mount_directory}"
fi
;;
"${ACTION_CLOSE}")
echo "${container_map_file} ← ${container_mount_directory}"
if umount "${container_map_file}"; then
rmdir --ignore-fail-on-non-empty "${container_mount_directory}"
echo "${container_file} ← ${container_map_file}"
cryptsetup luksClose "${container_name}"
fi
;;
esac
else
echo 'This path does not point to a file!'
fi
done
else
echo 'No container name provided!'
fi
;;
*)
echo 'Usage:'
echo "${NAME} [${ACTION_OPEN}|${ACTION_CLOSE}] [p] [s] [w]"
echo
echo 'p = private'
echo 's = sensitive'
echo 'w = work'
;;
esac
}
main "${@}"

View file

@ -1,12 +0,0 @@
# SH
## Tasks
* [ ] git switch signing commits & tags
* [ ] shellcheck & shfmt
* [ ] python tools
* [ ] log
* [ ] hetzner
* [ ] apt
* [ ] apt-file search | grep
* [ ] ffmpeg

View file

@ -3,7 +3,7 @@ a__overlay_bind_mount() {
local directory local directory
for directory in "dev" "dev/pts" "proc" "sys"; do for directory in "dev" "dev/pts" "proc" "sys"; do
if ! mount --bind "/${directory}" "overlay/mount/${directory}"; then if ! mount --bind "/${directory}" "overlay/mount/${directory}"; then
sh_log_error "Unable to bind mount directory: ${directory}" rwx_log_error "Unable to bind mount directory: ${directory}"
return 1 return 1
fi fi
done done
@ -14,7 +14,7 @@ a__overlay_bind_unmount() {
local directory local directory
for directory in "sys" "proc" "dev/pts" "dev"; do for directory in "sys" "proc" "dev/pts" "dev"; do
if ! umount --lazy "overlay/mount/${directory}"; then if ! umount --lazy "overlay/mount/${directory}"; then
sh_log_error "Unable to bind unmount directory: ${directory}" rwx_log_error "Unable to bind unmount directory: ${directory}"
return 1 return 1
fi fi
done done
@ -47,36 +47,36 @@ orm() { a__overlay_root_mount "${@}"; }
a__overlay_root_mount() { a__overlay_root_mount() {
local root="${1}" local root="${1}"
if [ -z "${root}" ]; then if [ -z "${root}" ]; then
sh_log_error "No root target directory" rwx_log_error "No root target directory"
return 1 return 1
fi fi
root="$(realpath "${root}")" root="$(realpath "${root}")"
if ! mkdir "overlay"; then if ! mkdir "overlay"; then
sh_log_error "Unable to make overlay directory" rwx_log_error "Unable to make overlay directory"
return 2 return 2
fi fi
( (
if ! cd "overlay"; then if ! cd "overlay"; then
sh_log_error "Unable to move into overlay directory" rwx_log_error "Unable to move into overlay directory"
return 3 return 3
fi fi
local directory local directory
for directory in "lower" "upper" "work" "mount"; do for directory in "lower" "upper" "work" "mount"; do
if ! mkdir --parents "${directory}"; then if ! mkdir --parents "${directory}"; then
sh_log_error "Unable to make directory: ${directory}" rwx_log_error "Unable to make directory: ${directory}"
return 4 return 4
fi fi
done done
local file="${root}/filesystem.squashfs" local file="${root}/filesystem.squashfs"
if ! mount "${file}" "lower"; then if ! mount "${file}" "lower"; then
sh_log_error "Unable to lower mount: ${file}" rwx_log_error "Unable to lower mount: ${file}"
return 5 return 5
fi fi
if ! mount \ if ! mount \
-o "lowerdir=lower,upperdir=upper,workdir=work" \ -o "lowerdir=lower,upperdir=upper,workdir=work" \
-t "overlay" \ -t "overlay" \
"overlay" "mount"; then "overlay" "mount"; then
sh_log_error "Unable to overlay mount" rwx_log_error "Unable to overlay mount"
return 6 return 6
fi fi
) )
@ -106,35 +106,35 @@ oru() { a__overlay_root_unmount "${@}"; }
a__overlay_root_unmount() { a__overlay_root_unmount() {
( (
if ! cd "overlay"; then if ! cd "overlay"; then
sh_log_error "Unable to move into overlay directory" rwx_log_error "Unable to move into overlay directory"
return 1 return 1
fi fi
if ! umount "mount"; then if ! umount "mount"; then
sh_log_error "Unable to unmount mount directory" rwx_log_error "Unable to unmount mount directory"
return 2 return 2
fi fi
if ! rmdir "mount"; then if ! rmdir "mount"; then
sh_log_error "Unable to remove mount directory" rwx_log_error "Unable to remove mount directory"
return 3 return 3
fi fi
local directory local directory
for directory in "upper" "work"; do for directory in "upper" "work"; do
if ! rm --force --recursive "${directory}"; then if ! rm --force --recursive "${directory}"; then
sh_log_error "Unable to remove directory: ${directory}" rwx_log_error "Unable to remove directory: ${directory}"
return 4 return 4
fi fi
done done
if ! umount "lower"; then if ! umount "lower"; then
sh_log_error "Unable to unmount lower directory" rwx_log_error "Unable to unmount lower directory"
return 5 return 5
fi fi
if ! rmdir "lower"; then if ! rmdir "lower"; then
sh_log_error "Unable to remove lower directory" rwx_log_error "Unable to remove lower directory"
return 6 return 6
fi fi
) )
if ! rmdir "overlay"; then if ! rmdir "overlay"; then
sh_log_error "Unable to remove overlay directory" rwx_log_error "Unable to remove overlay directory"
return 7 return 7
fi fi
} }

View file

@ -14,11 +14,11 @@ rwx_gnome_workspaces_primary() {
local var="${group}/${name}" local var="${group}/${name}"
# get # get
bool="$(gsettings get "${group}" "${name}")" bool="$(gsettings get "${group}" "${name}")"
sh_log_debug "${var}: ${bool}" rwx_log_debug "${var}: ${bool}"
# not # not
bool="$(sh_not "${bool}")" bool="$(rwx_not "${bool}")"
sh_log_debug "bool: ${bool}" rwx_log_debug "bool: ${bool}"
# set # set
gsettings set "${group}" "${name}" "${bool}" gsettings set "${group}" "${name}" "${bool}"
sh_log_info "${var}: ${bool}" rwx_log_info "${var}: ${bool}"
} }

View file

@ -2,13 +2,13 @@ rwx_shellcheck_check() {
local root="${1}" local root="${1}"
local file module modules path local file module modules path
file="$(mktemp)" file="$(mktemp)"
modules="$(sh_find_sh "${root}")" modules="$(rwx_find_sh "${root}")"
_sh_ifs_new rwx_ifs_set
for module in ${modules}; do for module in ${modules}; do
path="${root}/${module}" path="${root}/${module}"
echo ". \"${path}\"" >>"${file}" echo ". \"${path}\"" >>"${file}"
done done
_sh_ifs_pop rwx_ifs_unset
shellcheck \ shellcheck \
--check-sourced \ --check-sourced \
--enable "all" \ --enable "all" \

View file

@ -2,19 +2,19 @@
# │ constants │ # │ constants │
# ╰───────────╯ # ╰───────────╯
SH_MAIN_NAME="main.sh" RWX_MAIN_FILE_NAME="main.sh"
SH_NAME="sh" RWX_NAME="sh"
SH_ROOT="/etc/${SH_NAME}" RWX_ROOT_SYSTEM="/etc/${RWX_NAME}"
SH_MAIN="${SH_ROOT}/${SH_MAIN_NAME}" RWX_MAIN="${RWX_ROOT_SYSTEM}/${RWX_MAIN_FILE_NAME}"
# ╭───────────╮ # ╭───────────╮
# │ variables │ # │ variables │
# ╰───────────╯ # ╰───────────╯
SH_SHELL="$(cat "/proc/${$}/comm")" RWX_SHELL="$(cat "/proc/${$}/comm")"
SH_USER="${HOME}/${SH_NAME}" RWX_ROOT_USER="${HOME}/${RWX_NAME}"
# ╭──────────╮ # ╭──────────╮
# │ internal │ # │ internal │
@ -102,7 +102,7 @@ rwx_main_source() {
[ -d "${path}" ] || [ -d "${path}" ] ||
return 1 return 1
local cmd count module modules local cmd count module modules
modules="$(rwx_find_sh "${path}" "${SH_MAIN_NAME}")" modules="$(rwx_find_sh "${path}" "${RWX_MAIN_FILE_NAME}")"
rwx_ifs_set rwx_ifs_set
count=0 count=0
_rwx_main_log "" \ _rwx_main_log "" \
@ -130,20 +130,20 @@ rwx_main_source() {
# run initial steps # run initial steps
rwx_main() { rwx_main() {
# system root # system root
if ! rwx_main_source "${SH_ROOT}"; then if ! rwx_main_source "${RWX_ROOT_SYSTEM}"; then
_rwx_main_log "Not a directory: ${SH_ROOT}" _rwx_main_log "Not a directory: ${RWX_ROOT_SYSTEM}"
return 1 return 1
fi fi
# user root # user root
rwx_main_source "${SH_USER}" rwx_main_source "${RWX_ROOT_USER}"
# run interactive extras # run interactive extras
if rwx_shell_interactive; then if rwx_shell_interactive; then
# check format # check format
rwx_log rwx_log
rwx_shfmt_check "${SH_ROOT}" rwx_shfmt_check "${RWX_ROOT_SYSTEM}"
# check syntax # check syntax
rwx_log rwx_log
rwx_shellcheck_check "${SH_ROOT}" rwx_shellcheck_check "${RWX_ROOT_SYSTEM}"
# help # help
rwx_log rwx_log
rwx_help rwx_help

View file

@ -1,9 +1,9 @@
rwx_rescue_configure() { rwx_rescue_configure() {
local hostname="${1}" local hostname="${1}"
# apt / conf # apt / conf
sh_apt_conf_write rwx_apt_conf_write
# apt / sources # apt / sources
sh_apt_sources_write rwx_apt_sources_write
# bash / rc # bash / rc
main_link_bashrc main_link_bashrc
mv "${HOME}/.bashrc" "${HOME}/.bashrc.old" mv "${HOME}/.bashrc" "${HOME}/.bashrc.old"
@ -17,26 +17,26 @@ fr_FR.UTF-8 UTF-8
# generate locales # generate locales
locale-gen locale-gen
# update catalog # update catalog
sh_apt_update rwx_apt_update
# disable frontend # disable frontend
sh_debian_frontend_disable rwx_debian_frontend_disable
# install backports # install backports
sh_apt_install_backports "tmux" rwx_apt_install_backports "tmux"
# install packages # install packages
sh_apt_install_release "apt-file" "mosh" "screen" "byobu" rwx_apt_install_release "apt-file" "mosh" "screen" "byobu"
# update catalog # update catalog
sh_apt_update rwx_apt_update
} }
rwx_rescue_install() { rwx_rescue_install() {
# update catalog # update catalog
sh_apt_update rwx_apt_update
# disable frontend # disable frontend
sh_debian_frontend_disable rwx_debian_frontend_disable
# upgrade packages # upgrade packages
sh_apt_upgrade rwx_apt_upgrade
# install packages # install packages
sh_apt_install_release \ rwx_apt_install_release \
"man-db" \ "man-db" \
"dmidecode" "efibootmgr" "lshw" "pciutils" "usbutils" \ "dmidecode" "efibootmgr" "lshw" "pciutils" "usbutils" \
"parted" "mdadm" "cryptsetup-bin" "lvm2" \ "parted" "mdadm" "cryptsetup-bin" "lvm2" \
@ -45,7 +45,7 @@ rwx_rescue_install() {
"exa" "lf" "ncdu" "nnn" "ranger" "tree" \ "exa" "lf" "ncdu" "nnn" "ranger" "tree" \
"file" "htop" "iotop" "ipcalc" "libdigest-sha3-perl" "lsof" "file" "htop" "iotop" "ipcalc" "libdigest-sha3-perl" "lsof"
# install backports # install backports
sh_apt_install_backports \ rwx_apt_install_backports \
"grub-pc-bin" \ "grub-pc-bin" \
\ \
"grub-efi-amd64-bin" "grub-efi-amd64-bin"
@ -84,7 +84,7 @@ rwx_rescue_upload() {
} }
rwx_rescue_wipe_1_zero() { rwx_rescue_wipe_1_zero() {
sh_fs_wipe "/dev/mapper/crypt" "512M" rwx_fs_wipe "/dev/mapper/crypt" "512M"
} }
rwx_rescue_wipe_3_close() { rwx_rescue_wipe_3_close() {

View file

@ -7,9 +7,9 @@ rwx_rescue_wipe_0_init_hetzner_8_8() {
local number local number
local passphrase local passphrase
# read passphrase # read passphrase
passphrase="$(sh_read_passphrase)" passphrase="$(rwx_read_passphrase)"
# warn # warn
sh_warn_wipe "${@}" rwx_warn_wipe "${@}"
# #
number=0 number=0
for device in "${@}"; do for device in "${@}"; do
@ -34,7 +34,7 @@ rwx_rescue_wipe_0_init_hetzner_8_8() {
echo echo
echo "#${number}: ${device}4" echo "#${number}: ${device}4"
# wipe bios # wipe bios
sh_fs_wipe "${device}4" rwx_fs_wipe "${device}4"
done done
# #
number=0 number=0
@ -43,8 +43,8 @@ rwx_rescue_wipe_0_init_hetzner_8_8() {
echo echo
echo "#${number}: ${device}3" echo "#${number}: ${device}3"
# format esp # format esp
sh_fs_wipe "${device}3" "1M" rwx_fs_wipe "${device}3" "1M"
sh_fs_make_fat "${device}3" "esp-${number}" "0000000${number}" rwx_fs_make_fat "${device}3" "esp-${number}" "0000000${number}"
# mount esp # mount esp
mkdir --parents "/media/esp/${number}" mkdir --parents "/media/esp/${number}"
mount "${device}3" "/media/esp/${number}" mount "${device}3" "/media/esp/${number}"
@ -56,17 +56,17 @@ rwx_rescue_wipe_0_init_hetzner_8_8() {
echo echo
echo "#${number}: ${device}2" echo "#${number}: ${device}2"
# wipe boot # wipe boot
sh_fs_wipe "${device}2" "1G" 1 rwx_fs_wipe "${device}2" "1G" 1
done done
# #
members="" members=""
for device in "${@}"; do for device in "${@}"; do
members="${members} ${device}2" members="${members} ${device}2"
done done
sh_fs_raid_create \ rwx_fs_raid_create \
"boot" "00000000:00000000:00000000:00000002" ${members} "boot" "00000000:00000000:00000000:00000002" ${members}
# #
sh_fs_make_btrfs "/dev/md/boot" "boot" \ rwx_fs_make_btrfs "/dev/md/boot" "boot" \
"00000000-0000-0000-0000-00000000000b" "00000000-0000-0000-0000-00000000000b"
# mount boot # mount boot
mkdir --parents "/media/boot" mkdir --parents "/media/boot"
@ -80,17 +80,17 @@ rwx_rescue_wipe_0_init_hetzner_8_8() {
echo echo
echo "#${number}: ${device}1" echo "#${number}: ${device}1"
# wipe crypt head # wipe crypt head
sh_fs_wipe "${device}1" "1G" 1 rwx_fs_wipe "${device}1" "1G" 1
done done
# #
members="" members=""
for device in "${@}"; do for device in "${@}"; do
members="${members} ${device}1" members="${members} ${device}1"
done done
sh_fs_raid_create \ rwx_fs_raid_create \
"crypt" "00000000:00000000:00000000:00000001" ${members} "crypt" "00000000:00000000:00000000:00000001" ${members}
# encrypt # encrypt
sh_fs_luks_format "${passphrase}" "/dev/md/crypt" rwx_fs_luks_format "${passphrase}" "/dev/md/crypt"
# open # open
echo "${passphrase}" | echo "${passphrase}" |
cryptsetup luksOpen "/dev/md/crypt" "crypt" cryptsetup luksOpen "/dev/md/crypt" "crypt"
@ -103,16 +103,16 @@ rwx_rescue_wipe_2_make_hetzner_8_8() {
# close # close
cryptsetup luksClose "crypt" cryptsetup luksClose "crypt"
# read passphrase # read passphrase
passphrase="$(sh_read_passphrase)" passphrase="$(rwx_read_passphrase)"
# encrypt # encrypt
sh_fs_luks_format "${passphrase}" "/dev/md/crypt" rwx_fs_luks_format "${passphrase}" "/dev/md/crypt"
# open # open
echo "${passphrase}" | echo "${passphrase}" |
cryptsetup luksOpen "/dev/md/crypt" "crypt" cryptsetup luksOpen "/dev/md/crypt" "crypt"
# passphrase # passphrase
unset passphrase unset passphrase
# format crypt # format crypt
sh_fs_make_btrfs "/dev/mapper/crypt" "crypt" \ rwx_fs_make_btrfs "/dev/mapper/crypt" "crypt" \
"00000000-0000-0000-0000-00000000000c" "00000000-0000-0000-0000-00000000000c"
# mount crypt # mount crypt
mkdir --parents "/media/crypt" mkdir --parents "/media/crypt"
@ -120,6 +120,6 @@ rwx_rescue_wipe_2_make_hetzner_8_8() {
--options "autodefrag,compress-force=zstd" \ --options "autodefrag,compress-force=zstd" \
"/dev/mapper/crypt" "/media/crypt" "/dev/mapper/crypt" "/media/crypt"
# make swap file # make swap file
sh_fs_make_btrfs_swap "/media/crypt/swap" "64g" \ rwx_fs_make_btrfs_swap "/media/crypt/swap" "64g" \
"00000000-0000-0000-0000-000000000005" "00000000-0000-0000-0000-000000000005"
} }

View file

@ -2,9 +2,9 @@ rwx_rescue_wipe_0_init_ovh_vle2() {
local device="/dev/sdb" local device="/dev/sdb"
local passphrase local passphrase
# read passphrase # read passphrase
passphrase="$(sh_read_passphrase)" passphrase="$(rwx_read_passphrase)"
# warn # warn
sh_warn_wipe "${device}" rwx_warn_wipe "${device}"
# #
parted --script "${device}" \ parted --script "${device}" \
mktable gpt \ mktable gpt \
@ -16,27 +16,27 @@ rwx_rescue_wipe_0_init_ovh_vle2() {
mkpart bios 1 2 \ mkpart bios 1 2 \
set 4 bios_grub on set 4 bios_grub on
# bios / wipe # bios / wipe
sh_fs_wipe "${device}4" rwx_fs_wipe "${device}4"
# esp / wipe # esp / wipe
sh_fs_wipe "${device}3" "1M" rwx_fs_wipe "${device}3" "1M"
# esp / format # esp / format
sh_fs_make_fat "${device}3" "esp" "00000001" rwx_fs_make_fat "${device}3" "esp" "00000001"
# esp / mount # esp / mount
mkdir --parents "/media/esp" mkdir --parents "/media/esp"
mount "${device}3" "/media/esp" mount "${device}3" "/media/esp"
# boot / wipe # boot / wipe
sh_fs_wipe "${device}2" "1G" 1 rwx_fs_wipe "${device}2" "1G" 1
# boot / format # boot / format
sh_fs_make_btrfs "${device}2" "boot" \ rwx_fs_make_btrfs "${device}2" "boot" \
"00000000-0000-0000-0000-00000000000b" "00000000-0000-0000-0000-00000000000b"
# boot / mount # boot / mount
mkdir --parents "/media/boot" mkdir --parents "/media/boot"
mount --options "autodefrag,compress-force=zstd" \ mount --options "autodefrag,compress-force=zstd" \
"${device}2" "/media/boot" "${device}2" "/media/boot"
# crypt / wipe # crypt / wipe
sh_fs_wipe "${device}1" "1G" 1 rwx_fs_wipe "${device}1" "1G" 1
# crypt / encrypt # crypt / encrypt
sh_fs_luks_format "${passphrase}" "${device}1" rwx_fs_luks_format "${passphrase}" "${device}1"
# crypt / open # crypt / open
echo "${passphrase}" | echo "${passphrase}" |
cryptsetup luksOpen "${device}1" "crypt" cryptsetup luksOpen "${device}1" "crypt"
@ -50,22 +50,22 @@ rwx_rescue_wipe_2_make_ovh_vle2() {
# crypt / close # crypt / close
cryptsetup luksClose "crypt" cryptsetup luksClose "crypt"
# read passphrase # read passphrase
passphrase="$(sh_read_passphrase)" passphrase="$(rwx_read_passphrase)"
# crypt / encrypt # crypt / encrypt
sh_fs_luks_format "${passphrase}" "${device}1" rwx_fs_luks_format "${passphrase}" "${device}1"
# crypt / open # crypt / open
echo "${passphrase}" | echo "${passphrase}" |
cryptsetup luksOpen "${device}1" "crypt" cryptsetup luksOpen "${device}1" "crypt"
# passphrase # passphrase
unset passphrase unset passphrase
# crypt / format # crypt / format
sh_fs_make_btrfs "/dev/mapper/crypt" "crypt" \ rwx_fs_make_btrfs "/dev/mapper/crypt" "crypt" \
"00000000-0000-0000-0000-00000000000c" "00000000-0000-0000-0000-00000000000c"
# crypt / mount # crypt / mount
mkdir --parents "/media/crypt" mkdir --parents "/media/crypt"
mount --options "autodefrag,compress-force=zstd" \ mount --options "autodefrag,compress-force=zstd" \
"/dev/mapper/crypt" "/media/crypt" "/dev/mapper/crypt" "/media/crypt"
# crypt / swap # crypt / swap
sh_fs_make_btrfs_swap "/media/crypt/swap" "4g" \ rwx_fs_make_btrfs_swap "/media/crypt/swap" "4g" \
"00000000-0000-0000-0000-000000000005" "00000000-0000-0000-0000-000000000005"
} }