Dvd : Add CD/DVD scripts.

This commit is contained in:
Dmitry Voronin 2024-02-22 20:23:59 +03:00
parent c28bd075c9
commit b405b37871
2 changed files with 65 additions and 1 deletions

View file

@ -0,0 +1,61 @@
# Burn specified files to DVD.
# Usage: dvd_burn <FILES>
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 <FILE.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 <FILES>
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 <FILE.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 <FILES.wav>
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
}

View file

@ -47,17 +47,20 @@ function nix_tmpshell() {
local IFS=$'\n' local IFS=$'\n'
local input=("${@}") local input=("${@}")
local pkgs=() local pkgs=()
local tag="${NIX_SHELL}"
if [[ "${input}" = "" ]]; then if [[ "${input}" = "" ]]; then
help nix_tmpshell help nix_tmpshell
return 2 return 2
fi fi
[[ "${tag}" = "" ]] && tag="${1}"
for pkg in ${input[@]}; do for pkg in ${input[@]}; do
pkgs+=("nixpkgs#${pkg}") pkgs+=("nixpkgs#${pkg}")
done done
NIX_SHELL="${1}" nix shell ${pkgs[@]} NIX_SHELL="${tag}" nix shell ${pkgs[@]}
} }
alias tmpshell="nix_tmpshell" alias tmpshell="nix_tmpshell"