Added older Nautilus scripts for RAW files
This commit is contained in:
parent
5230d1d602
commit
0a785b61cb
138
home/lucifer/.local/share/nautilus/scripts/04-RAW/01-testdisk
Executable file
138
home/lucifer/.local/share/nautilus/scripts/04-RAW/01-testdisk
Executable file
@ -0,0 +1,138 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
# DIRECTORY:
|
||||||
|
# /home/*/.local/share/nautilus/scripts/04-RAW/
|
||||||
|
# OR
|
||||||
|
# /home/*/.gnome2/nautilus-sctipts/04-RAW/ (deprecated)
|
||||||
|
#
|
||||||
|
# FILE:
|
||||||
|
# 01-testdisk
|
||||||
|
#
|
||||||
|
# USAGE:
|
||||||
|
# Right klick on a RAW image (.dd) and
|
||||||
|
# choose this nautilus script from the context menu.
|
||||||
|
#
|
||||||
|
# OPTIONS:
|
||||||
|
# none
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# Recovers partition in a writable RAW image (if present/possible).
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# REQUIREMENTS:
|
||||||
|
# bash, zenity, sudo and testdisk
|
||||||
|
#
|
||||||
|
# BUGS:
|
||||||
|
# ---
|
||||||
|
#
|
||||||
|
# NOTES:
|
||||||
|
# Tested on
|
||||||
|
# - Debian 8+
|
||||||
|
# - Arch Linux
|
||||||
|
#
|
||||||
|
# AUTHOR:
|
||||||
|
# Patrick Neumann, patrick@neumannsland.de
|
||||||
|
#
|
||||||
|
# COMPANY:
|
||||||
|
# (privately)
|
||||||
|
#
|
||||||
|
# VERSION:
|
||||||
|
# 0.9 (beta)
|
||||||
|
#
|
||||||
|
# LINK TO THE MOST CURRENT VERSIONS:
|
||||||
|
# https://
|
||||||
|
#
|
||||||
|
# CREATED:
|
||||||
|
# 24.03.2016
|
||||||
|
#
|
||||||
|
# COPYRIGHT (C):
|
||||||
|
# 2015-2020 - Patrick Neumann
|
||||||
|
#
|
||||||
|
# LICENSE:
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# WARRANTY:
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# TODO:
|
||||||
|
# - make a copy of the logfile (history)?
|
||||||
|
#
|
||||||
|
# HISTORY:
|
||||||
|
# 0.9 - Patrick Neumann - Initial (public) release
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Additional supported Distribution(s) (add before Library!).
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
SUPPORTED_OSR="arch"
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Check for library (casualscripter_nautilus-scripts_functions.sh).
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
readonly LIBRARY="${0%/*/*}/.casualscripter_nautilus-scripts_functions.sh"
|
||||||
|
if [ ! -f "${LIBRARY}" ] ; then
|
||||||
|
zenity --error \
|
||||||
|
--text \
|
||||||
|
"ERROR: casualscripter_nautilus-scripts_functions.sh MISSING!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "${LIBRARY}"
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Checks (see library "casualscripter_nautilus-scripts_functions.sh").
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
check_dep "${DATE_BIN}" "date"
|
||||||
|
check_dep "${RM_BIN}" "coreutils"
|
||||||
|
check_dep "${GTERMINAL_BIN}" "gnome-terminal"
|
||||||
|
check_dep "${SUDO_BIN}" "sudo"
|
||||||
|
check_dep "${TESTDISK_BIN}" "testdisk"
|
||||||
|
check_dep "${SLEEP_BIN}" "coreutils"
|
||||||
|
check_dep "${PGREP_BIN}" "procps"
|
||||||
|
check_dep "${MV_BIN}" "coreutils"
|
||||||
|
|
||||||
|
check_ext "${SOURCE}" "dd"
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Avoid unintended changes to the Image.
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
check_if_pwd_is_used_as_mountpoint
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# ... testdisk...
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
readonly TESTDISK_LOG="${DIRNAME}/testdisk-$( ${DATE_BIN} "+%Y%m%dT%H%M%S" ).log"
|
||||||
|
|
||||||
|
if [ -f "${TESTDISK_LOG}" ] ; then
|
||||||
|
${RM_BIN} "${TESTDISK_LOG}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "${DIRNAME}"
|
||||||
|
${GTERMINAL_BIN} --execute ${SUDO_BIN} ${TESTDISK_BIN} /log "${SOURCE}"
|
||||||
|
|
||||||
|
${SLEEP_BIN} 3
|
||||||
|
|
||||||
|
# We have to wait until multi_sigfind has finished...
|
||||||
|
while ${PGREP_BIN} --full "${TESTDISK_BIN}" > /dev/null 2>&1; do
|
||||||
|
${SLEEP_BIN} 1
|
||||||
|
done
|
||||||
|
|
||||||
|
${MV_BIN} "testdisk.log" "${TESTDISK_LOG}"
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Display content of the resultfile "testdisk.log".
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
display_resultfile "${TESTDISK_LOG}"
|
||||||
|
|
||||||
|
exit 0
|
173
home/lucifer/.local/share/nautilus/scripts/04-RAW/02-mount-partition
Executable file
173
home/lucifer/.local/share/nautilus/scripts/04-RAW/02-mount-partition
Executable file
@ -0,0 +1,173 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
# DIRECTORY:
|
||||||
|
# /home/*/.local/share/nautilus/scripts/04-RAW/
|
||||||
|
# OR
|
||||||
|
# /home/*/.gnome2/nautilus-sctipts/04-RAW/ (deprecated)
|
||||||
|
#
|
||||||
|
# FILE:
|
||||||
|
# 02-mount-partition
|
||||||
|
#
|
||||||
|
# USAGE:
|
||||||
|
# Right klick on a RAW image (.dd) and
|
||||||
|
# choose this nautilus script from the context menu.
|
||||||
|
#
|
||||||
|
# OPTIONS:
|
||||||
|
# none
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# Shows available partitions and mount one of them through a loop device.
|
||||||
|
#
|
||||||
|
# REQUIREMENTS:
|
||||||
|
# bash, zenity, gksu, coreutils, grep and mount
|
||||||
|
#
|
||||||
|
# BUGS:
|
||||||
|
# ---
|
||||||
|
#
|
||||||
|
# NOTES:
|
||||||
|
# Tested on
|
||||||
|
# - Debian 8+
|
||||||
|
# - Arch Linux
|
||||||
|
#
|
||||||
|
# AUTHOR:
|
||||||
|
# Patrick Neumann, patrick@neumannsland.de
|
||||||
|
#
|
||||||
|
# COMPANY:
|
||||||
|
# (privately)
|
||||||
|
#
|
||||||
|
# VERSION:
|
||||||
|
# 0.9 (beta)
|
||||||
|
#
|
||||||
|
# LINK TO THE MOST CURRENT VERSIONS:
|
||||||
|
# https://
|
||||||
|
#
|
||||||
|
# CREATED:
|
||||||
|
# 10.03.2016
|
||||||
|
#
|
||||||
|
# COPYRIGHT (C):
|
||||||
|
# 2015-2020 - Patrick Neumann
|
||||||
|
#
|
||||||
|
# LICENSE:
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# WARRANTY:
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# TODO:
|
||||||
|
# - Support for (Free)BSD (UFS, ZFS,...)
|
||||||
|
# - Support for slices in partitions (Solaris)
|
||||||
|
#
|
||||||
|
# HISTORY:
|
||||||
|
# 0.9 - Patrick Neumann - Initial (public) release
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Additional supported Distribution(s) (add before Library!).
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
SUPPORTED_OSR="arch"
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Check for library (casualscripter_nautilus-scripts_functions.sh).
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
readonly LIBRARY="${0%/*/*}/.casualscripter_nautilus-scripts_functions.sh"
|
||||||
|
if [ ! -f "${LIBRARY}" ] ; then
|
||||||
|
zenity --error \
|
||||||
|
--text \
|
||||||
|
"ERROR: casualscripter_nautilus-scripts_functions.sh MISSING!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "${LIBRARY}"
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Checks (see library "casualscripter_nautilus-scripts_functions.sh").
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
check_dep "${MKDIR_BIN}" "coreutils"
|
||||||
|
check_dep "${CUT_BIN}" "coreutils"
|
||||||
|
check_dep "${GREP_BIN}" "grep"
|
||||||
|
check_dep "${MOUNT_BIN}" "mount"
|
||||||
|
check_dep "${PKEXEC_BIN}" "polkit"
|
||||||
|
|
||||||
|
check_ext "${SOURCE}" "dd"
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Avoid unintended changes to the Image.
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
check_if_pwd_is_used_as_mountpoint
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Disable automount in gnome.
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
disable_gnome_automount
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Disable tracker (may interfere with later umount).
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
kill_all_tracker_processes
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Ask user for partition and set/configure offset, sizelimit, partition number
|
||||||
|
# and mountpoint.
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
readonly PARTITION="$( choose_partition "${SOURCE}" parted )"
|
||||||
|
OFFSET="${PARTITION#*:}"
|
||||||
|
readonly OFFSET="${OFFSET%%B:*}"
|
||||||
|
SIZELIMIT="${PARTITION#*:*:*:}"
|
||||||
|
readonly SIZELIMIT="${SIZELIMIT%%B:*}"
|
||||||
|
readonly PARTITION_NUMBER="${PARTITION%%:*}"
|
||||||
|
readonly MOUNTPOINT="${DIRNAME}/Partition_${PARTITION_NUMBER}"
|
||||||
|
|
||||||
|
if [ ! -d "${MOUNTPOINT}" ] ; then
|
||||||
|
${MKDIR_BIN} "${MOUNTPOINT}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Add option "force" for unclean unmounted hfs+ partitions.
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
if echo "${PARTITION}" \
|
||||||
|
| ${CUT_BIN} -d ":" -f 5 \
|
||||||
|
| ${GREP_BIN} --fixed-strings "hfs+" > /dev/null 2>&1 ; then
|
||||||
|
readonly EXTRAS=",force"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Add option "recover" (= force) for unclean unmounted ntfs partitions.
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
if echo "${PARTITION}" \
|
||||||
|
| ${CUT_BIN} -d ":" -f 5 \
|
||||||
|
| ${GREP_BIN} --fixed-strings "ntfs" > /dev/null 2>&1 ; then
|
||||||
|
readonly EXTRAS=",recover"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Mount source on mountpint with options.
|
||||||
|
# - recover for unclean unmounted ntfs partitions,
|
||||||
|
# - force for unclean unmounted hfs+ partitions,
|
||||||
|
# BUT: ext and xfs don't support it!
|
||||||
|
# - sizelimit is necessary for hfs+!
|
||||||
|
# - ufs (freebsd) need some more individual options! (unsupported!)
|
||||||
|
# - solaris makes some add. probs with partitions in slices! (unsupported!)
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
if ${PKEXEC_BIN} ${MOUNT_BIN} \
|
||||||
|
--options loop,rw,offset=${OFFSET},sizelimit=${SIZELIMIT}${EXTRAS} \
|
||||||
|
"${SOURCE}" \
|
||||||
|
"${MOUNTPOINT}" \
|
||||||
|
> /dev/null 2>&1
|
||||||
|
then
|
||||||
|
success "partition ${PARTITION_NUMBER} mounted"
|
||||||
|
else
|
||||||
|
error_exit "mounting partition ${PARTITION_NUMBER} failed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
139
home/lucifer/.local/share/nautilus/scripts/04-RAW/03-md5-and-sha1
Executable file
139
home/lucifer/.local/share/nautilus/scripts/04-RAW/03-md5-and-sha1
Executable file
@ -0,0 +1,139 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
# DIRECTORY:
|
||||||
|
# /home/*/.local/share/nautilus/scripts/04-RAW/
|
||||||
|
# OR
|
||||||
|
# /home/*/.gnome2/nautilus-sctipts/04-RAW/ (deprecated)
|
||||||
|
#
|
||||||
|
# FILE:
|
||||||
|
# 03-md5-and-sha1
|
||||||
|
#
|
||||||
|
# USAGE:
|
||||||
|
# Right klick on a RAW image (.dd) and
|
||||||
|
# choose this nautilus script from the context menu.
|
||||||
|
#
|
||||||
|
# OPTIONS:
|
||||||
|
# none
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# Calculates MD5 and SHA1 hash values from an image (or other file) in one pass.
|
||||||
|
#
|
||||||
|
# REQUIREMENTS:
|
||||||
|
# bash, zenity, coreutils and openssl
|
||||||
|
#
|
||||||
|
# BUGS:
|
||||||
|
# ---
|
||||||
|
#
|
||||||
|
# NOTES:
|
||||||
|
# Tested on
|
||||||
|
# - Debian 8+
|
||||||
|
# - Arch Linux
|
||||||
|
#
|
||||||
|
# AUTHOR:
|
||||||
|
# Patrick Neumann, patrick@neumannsland.de
|
||||||
|
#
|
||||||
|
# COMPANY:
|
||||||
|
# (privately)
|
||||||
|
#
|
||||||
|
# VERSION:
|
||||||
|
# 0.9 (beta)
|
||||||
|
#
|
||||||
|
# LINK TO THE MOST CURRENT VERSIONS:
|
||||||
|
# https://
|
||||||
|
#
|
||||||
|
# CREATED:
|
||||||
|
# 02.04.2016
|
||||||
|
#
|
||||||
|
# COPYRIGHT (C):
|
||||||
|
# 2015-2020 - Patrick Neumann
|
||||||
|
#
|
||||||
|
# LICENSE:
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# WARRANTY:
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# TODO:
|
||||||
|
# ---
|
||||||
|
#
|
||||||
|
# HISTORY:
|
||||||
|
# 0.9 - Patrick Neumann - Initial (public) release
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Additional supported Distribution(s) (add before Library!).
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
SUPPORTED_OSR="arch"
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Check for library (casualscripter_nautilus-scripts_functions.sh).
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
readonly LIBRARY="${0%/*/*}/.casualscripter_nautilus-scripts_functions.sh"
|
||||||
|
if [ ! -f "${LIBRARY}" ] ; then
|
||||||
|
zenity --error \
|
||||||
|
--text \
|
||||||
|
"ERROR: casualscripter_nautilus-scripts_functions.sh MISSING!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "${LIBRARY}"
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Checks (see library "casualscripter_nautilus-scripts_functions.sh").
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
check_dep "${DC3DD_BIN}" "dc3dd"
|
||||||
|
check_dep "${TEE_BIN}" "coreutils"
|
||||||
|
check_dep "${OPENSSL_BIN}" "openssl"
|
||||||
|
check_dep "${CAT_BIN}" "coreutils"
|
||||||
|
check_dep "${RM_BIN}" "coreutils"
|
||||||
|
check_dep "${SED_BIN}" "sed"
|
||||||
|
check_dep "${BASENAME_BIN}" "coreutils"
|
||||||
|
|
||||||
|
# If we do not want to calculate digests for every type of file...
|
||||||
|
#check_ext "${SOURCE}" "dd|DD|raw|RAW|img|IMG"
|
||||||
|
|
||||||
|
check_tmp
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Generate file for md5 and sha1 checksums, if necessary.
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
readonly MD5_SHA1="${TMP}/md5_and_sha1.txt"
|
||||||
|
|
||||||
|
if [ ! -f "${MD5_SHA1}" ] ; then
|
||||||
|
echo "MD5:" > "${MD5_SHA1}"
|
||||||
|
echo -e "\nSHA1:" > "/tmp/openssl_sha1.tmp"
|
||||||
|
${GTERMINAL_BIN} --hide-menubar -- \
|
||||||
|
${BASH_BIN} -c \
|
||||||
|
"${DC3DD_BIN} if='${SOURCE}' \
|
||||||
|
| ${TEE_BIN} >( ${OPENSSL_BIN} dgst -md5 -r >> '${MD5_SHA1}' ) \
|
||||||
|
>( ${OPENSSL_BIN} dgst -sha1 -r >> '/tmp/openssl_sha1.tmp' ) \
|
||||||
|
> /dev/null ; sleep .1"
|
||||||
|
|
||||||
|
${SLEEP_BIN} 3
|
||||||
|
|
||||||
|
while ${PGREP_BIN} --full "${DC3DD_BIN}" > /dev/null 2>&1; do
|
||||||
|
${SLEEP_BIN} 1
|
||||||
|
done
|
||||||
|
|
||||||
|
${CAT_BIN} "/tmp/openssl_sha1.tmp" >> "${MD5_SHA1}"
|
||||||
|
${RM_BIN} "/tmp/openssl_sha1.tmp"
|
||||||
|
${SED_BIN} --in-place "s/(stdin)/($( ${BASENAME_BIN} "${SOURCE}" ))/" "${MD5_SHA1}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Display content of the resultfile "md5_and_sha1.txt".
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
display_resultfile "${MD5_SHA1}"
|
||||||
|
|
||||||
|
exit 0
|
@ -0,0 +1,147 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
# DIRECTORY:
|
||||||
|
# /home/*/.local/share/nautilus/scripts/02_dd/
|
||||||
|
# OR
|
||||||
|
# /home/*/.gnome2/nautilus-sctipts/02_dd/ (deprecated)
|
||||||
|
#
|
||||||
|
# FILE:
|
||||||
|
# 01-xmount
|
||||||
|
#
|
||||||
|
# USAGE:
|
||||||
|
# Right klick on a RAW image (.dd) and
|
||||||
|
# choose this nautilus script from the context menu.
|
||||||
|
#
|
||||||
|
# OPTIONS:
|
||||||
|
# none
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# Mount EAW image as RAW, VDI oder VMDK image with read/write support.
|
||||||
|
#
|
||||||
|
# REQUIREMENTS:
|
||||||
|
# bash, zenity, coreutils, awk, grep, bc, libglib2.0-bin and xmount
|
||||||
|
#
|
||||||
|
# BUGS:
|
||||||
|
# ---
|
||||||
|
#
|
||||||
|
# NOTES:
|
||||||
|
# Tested on
|
||||||
|
# - Debian 8
|
||||||
|
# - Arch Linux
|
||||||
|
#
|
||||||
|
# AUTHOR:
|
||||||
|
# Patrick Neumann, patrick@neumannsland.de
|
||||||
|
#
|
||||||
|
# COMPANY:
|
||||||
|
# (privately)
|
||||||
|
#
|
||||||
|
# VERSION:
|
||||||
|
# 0.9 (beta)
|
||||||
|
#
|
||||||
|
# LINK TO THE MOST CURRENT VERSIONS:
|
||||||
|
# ...
|
||||||
|
#
|
||||||
|
# CREATED:
|
||||||
|
# 17.03.2016
|
||||||
|
#
|
||||||
|
# COPYRIGHT (C):
|
||||||
|
# 2015-2020 - Patrick Neumann
|
||||||
|
#
|
||||||
|
# LICENSE:
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# WARRANTY:
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# TODO:
|
||||||
|
# - ask to overwrite cache?
|
||||||
|
# - readonly support?
|
||||||
|
#
|
||||||
|
# HISTORY:
|
||||||
|
# 0.9 - Patrick Neumann - Initial (public) release
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Additional supported Distribution(s) (add before Library!).
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
SUPPORTED_OSR="arch"
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Check for library (casualscripter_nautilus-scripts_functions.sh).
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
readonly LIBRARY="${0%/*/*}/.casualscripter_nautilus-scripts_functions.sh"
|
||||||
|
if [ ! -f "${LIBRARY}" ] ; then
|
||||||
|
${ZENITY_BIN} --error \
|
||||||
|
--text \
|
||||||
|
"ERROR: casualscripter_nautilus-scripts_functions.sh MISSING!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "${LIBRARY}"
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Checks (see library "casualscripter_nautilus-scripts_functions.sh").
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
check_dep "${XMOUNT_BIN}" "xmount"
|
||||||
|
check_dep "${MKDIR_BIN}" "coreutils"
|
||||||
|
|
||||||
|
check_xmount_version
|
||||||
|
|
||||||
|
check_user_allow_other
|
||||||
|
|
||||||
|
check_ext "${SOURCE}" "dd|DD|raw|RAW|img|IMG"
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Only "real" RAW images are wanted!
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
check_if_pwd_is_not_used_as_mountpoint
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Disable automount in gnome.
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
disable_gnome_automount
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Disable tracker (may interfere with later umount).
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
kill_all_tracker_processes
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Ask user for output image format.
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
readonly OUTPUT_IMAGE_FORMAT="$( xmount_out_format )"
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# ... mountpoint...
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
readonly XMOUNTPOINT="${DIRNAME}/${OUTPUT_IMAGE_FORMAT}"
|
||||||
|
|
||||||
|
if [ ! -d "${XMOUNTPOINT}" ] ; then
|
||||||
|
${MKDIR_BIN} "${XMOUNTPOINT}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# xmount EWF with read and write support (cache).
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
if ${XMOUNT_BIN} --in raw "${SOURCE%??}"?? \
|
||||||
|
--out "${OUTPUT_IMAGE_FORMAT}" \
|
||||||
|
--cache xmount.cache \
|
||||||
|
"${XMOUNTPOINT}" \
|
||||||
|
> /dev/null 2>&1 ; then
|
||||||
|
success "RAW image was mounted as ${OUTPUT_IMAGE_FORMAT^^} image"
|
||||||
|
else
|
||||||
|
error_exit "mounting RAW image as ${OUTPUT_IMAGE_FORMAT^^} image failed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
@ -0,0 +1,116 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
# DIRECTORY:
|
||||||
|
# /home/*/.local/share/nautilus/scripts/02_dd/
|
||||||
|
# OR
|
||||||
|
# /home/*/.gnome2/nautilus-sctipts/02_dd/ (deprecated)
|
||||||
|
#
|
||||||
|
# FILE:
|
||||||
|
# 02-parted
|
||||||
|
#
|
||||||
|
# USAGE:
|
||||||
|
# Right klick on a RAW image (.dd) and
|
||||||
|
# choose this nautilus script from the context menu.
|
||||||
|
#
|
||||||
|
# OPTIONS:
|
||||||
|
# none
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# Shows/stores the partition layout off a block device or image.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# REQUIREMENTS:
|
||||||
|
# bash, zenity and parted
|
||||||
|
#
|
||||||
|
# BUGS:
|
||||||
|
# ---
|
||||||
|
#
|
||||||
|
# NOTES:
|
||||||
|
# Tested on
|
||||||
|
# - Debian 8
|
||||||
|
# - Arch Linux
|
||||||
|
#
|
||||||
|
# AUTHOR:
|
||||||
|
# Patrick Neumann, patrick@neumannsland.de
|
||||||
|
#
|
||||||
|
# COMPANY:
|
||||||
|
# (privately)
|
||||||
|
#
|
||||||
|
# VERSION:
|
||||||
|
# 0.9 (beta)
|
||||||
|
#
|
||||||
|
# LINK TO THE MOST CURRENT VERSIONS:
|
||||||
|
# ...
|
||||||
|
#
|
||||||
|
# CREATED:
|
||||||
|
# 07.02.2016
|
||||||
|
#
|
||||||
|
# COPYRIGHT (C):
|
||||||
|
# 2015-2020 - Patrick Neumann
|
||||||
|
#
|
||||||
|
# LICENSE:
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# WARRANTY:
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# TODO:
|
||||||
|
# ---
|
||||||
|
#
|
||||||
|
# HISTORY:
|
||||||
|
# 0.9 - Patrick Neumann - Initial (public) release
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Additional supported Distribution(s) (add before Library!).
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
SUPPORTED_OSR="arch"
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Check for library (casualscripter_nautilus-scripts_functions.sh).
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
readonly LIBRARY="${0%/*/*}/.casualscripter_nautilus-scripts_functions.sh"
|
||||||
|
if [ ! -f "${LIBRARY}" ] ; then
|
||||||
|
${ZENITY_BIN} --error \
|
||||||
|
--text \
|
||||||
|
"ERROR: casualscripter_nautilus-scripts_functions.sh MISSING!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "${LIBRARY}"
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Checks (see library "casualscripter_nautilus-scripts_functions.sh").
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
check_dep "${PARTED_BIN}" "parted"
|
||||||
|
|
||||||
|
check_ext "${SOURCE}" "dd|DD|raw|RAW|img|IMG"
|
||||||
|
|
||||||
|
check_tmp
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Generate parted info file, if necessary.
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
readonly PARTED="${TMP}/parted-$( ${BASENAME_BIN} "${SOURCE}" ).txt"
|
||||||
|
|
||||||
|
if [ ! -f "${PARTED}" ] ; then
|
||||||
|
${PARTED_BIN} -s "${SOURCE}" unit b print free > "${PARTED}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Display content of the resultfile "parted.txt".
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
display_resultfile "${PARTED}"
|
||||||
|
|
||||||
|
exit 0
|
Loading…
x
Reference in New Issue
Block a user