From b405b37871755f5fc22f5792020e91f9d5adf5ab Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Thu, 22 Feb 2024 20:23:59 +0300 Subject: [PATCH] Dvd : Add CD/DVD scripts. --- .config/bash/module/Dvd.sh | 61 ++++++++++++++++++++++++++++++++++++++ .config/bash/module/Nix.sh | 5 +++- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 .config/bash/module/Dvd.sh diff --git a/.config/bash/module/Dvd.sh b/.config/bash/module/Dvd.sh new file mode 100644 index 0000000..d5d5db8 --- /dev/null +++ b/.config/bash/module/Dvd.sh @@ -0,0 +1,61 @@ +# Burn specified files to DVD. +# Usage: dvd_burn +function dvd_burn() { + if [[ "${*}" = "" ]]; then + help dvd_burn + return 2 + fi + + growisofs -use-the-force-luke=tty -Z /dev/sr0 -J -r -speed=8 -dvd-compat -pad -graft-points "${*}" +} + +# Burn specified iso file to DVD. +# Usage: dvd_burn_iso +function dvd_burn_iso() { + local iso="${1}" + if [[ "${iso}" = "" ]]; then + help dvd_burn_iso + return 2 + fi + + growisofs -dvd-compat -speed=8 -use-the-force-luke=tty -Z /dev/sr0="${iso}" +} + +# Burn specified files to CD. +# Usage: cd_burn +function cd_burn() { + if [[ "${*}" = "" ]]; then + help cd_burn + return 2 + fi + + mkisofs -J -r -pad -graft-points "${*}" | cdrecord dev=1,1,0 speed=8 - +} + +# Burn specified iso file to CD. +# Usage: cd_burn_iso +function cd_burn_iso() { + local iso="${1}" + if [[ "${iso}" = "" ]]; then + help cd_burn_iso + return 2 + fi + + wodim speed=8 -tao dev=/dev/sr0 "${iso}" +} + +# Burn specified audio files to CD. +# Usage: cd_burn_audio +function cd_burn_audio() { + if [[ "${*}" = "" ]]; then + help cd_burn_audio + return 2 + fi + + cdrecord -v dev=/dev/sr0 speed=8 -audio -pad "${*}" +} + +# Spawn Nix shell with required tools. +function dvd_shell() { + NIX_SHELL="dvd" tmpshell dvdplusrwtools cdrkit +} diff --git a/.config/bash/module/Nix.sh b/.config/bash/module/Nix.sh index 7e85c05..8a8f863 100644 --- a/.config/bash/module/Nix.sh +++ b/.config/bash/module/Nix.sh @@ -47,17 +47,20 @@ function nix_tmpshell() { local IFS=$'\n' local input=("${@}") local pkgs=() + local tag="${NIX_SHELL}" if [[ "${input}" = "" ]]; then help nix_tmpshell return 2 fi + [[ "${tag}" = "" ]] && tag="${1}" + for pkg in ${input[@]}; do pkgs+=("nixpkgs#${pkg}") done - NIX_SHELL="${1}" nix shell ${pkgs[@]} + NIX_SHELL="${tag}" nix shell ${pkgs[@]} } alias tmpshell="nix_tmpshell"