mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
modified script a bit and moved it
This commit is contained in:
parent
ddb6c5a65a
commit
d3948ae87d
49
setupAutopsyConfigDirectory.sh → unix/launch_script_bootable.sh
Normal file → Executable file
49
setupAutopsyConfigDirectory.sh → unix/launch_script_bootable.sh
Normal file → Executable file
@ -1,5 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This script is to be used by the maintainers of bootable Linux systems so that
|
||||||
|
# Autopsy can launch and use an external USB device for user configuration. This
|
||||||
|
# will ensure that the user does not have to reconfigure Autopsy each time.
|
||||||
|
#
|
||||||
|
# The basic idea of the script is to let the user pick which external readwrite
|
||||||
|
# device to use, ensure that an Autopsy folder exists, and launch Autopsy so that
|
||||||
|
# it uses that folder for configuration.
|
||||||
|
#
|
||||||
|
# To use this script, maintainers should:
|
||||||
|
# - Update AUTOPSY_BIN to path where the autopsy script / folder are
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AUTOPSY_BIN=/usr/share/autopsy-4.7.0/bin/autopsy
|
||||||
|
|
||||||
infoLog () {
|
infoLog () {
|
||||||
echo "INFO: "$1
|
echo "INFO: "$1
|
||||||
}
|
}
|
||||||
@ -8,9 +23,12 @@ errorLog () {
|
|||||||
echo "ERROR: "$1
|
echo "ERROR: "$1
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
Autopsybin=/usr/bin/autopsy4
|
|
||||||
[ -x "$Autopsybin" ] && infoLog "Autopsy found" || errorLog "Antopsy binaries not found exiting....."
|
|
||||||
|
|
||||||
|
# Verify we can find the script
|
||||||
|
[ -x "$AUTOPSY_BIN" ] && infoLog "Autopsy found" || errorLog "Autopsy binaries not found at $AUTOPSY_BIN. Exiting....."
|
||||||
|
|
||||||
|
|
||||||
|
# Create folders on external drive
|
||||||
createConfigDirectories () {
|
createConfigDirectories () {
|
||||||
if [ ! -d "$1" ]; then
|
if [ ! -d "$1" ]; then
|
||||||
mkdir $1 && infoLog "$1 successfully created" || errorLog "error while creating $1"
|
mkdir $1 && infoLog "$1 successfully created" || errorLog "error while creating $1"
|
||||||
@ -26,13 +44,22 @@ createConfigDirectories () {
|
|||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
options_length=0
|
options_length=0
|
||||||
|
# Display list of mounted devices, prompt user, and store
|
||||||
|
# results in global variables
|
||||||
showAndReadOptions () {
|
showAndReadOptions () {
|
||||||
echo "Select a mounted disk to create config directory"
|
echo "Select a mounted disk to create config directory"
|
||||||
|
# Maintainers: Adjust these grep statements based on where your
|
||||||
|
# platform mounts media.
|
||||||
mnt=( $(mount | grep "media" | grep "rw" | awk '{print $3}') )
|
mnt=( $(mount | grep "media" | grep "rw" | awk '{print $3}') )
|
||||||
|
|
||||||
|
# Add option to user to not use mounted media
|
||||||
length=${#mnt[@]}
|
length=${#mnt[@]}
|
||||||
mnt[length]="No action"
|
mnt[length]="Do not store on mounted disk"
|
||||||
options_length=$(( $length + 1 ))
|
options_length=$(( $length + 1 ))
|
||||||
|
|
||||||
x=1
|
x=1
|
||||||
for word in "${mnt[@]}"
|
for word in "${mnt[@]}"
|
||||||
do
|
do
|
||||||
@ -41,11 +68,15 @@ showAndReadOptions (){
|
|||||||
done
|
done
|
||||||
read option
|
read option
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Show mounted drives and loop until it is valid
|
||||||
showAndReadOptions
|
showAndReadOptions
|
||||||
if [ "$option" -lt "1" ] || [ "$option" -gt "$options_length" ]; then
|
if [ "$option" -lt "1" ] || [ "$option" -gt "$options_length" ]; then
|
||||||
infoLog "Please choose a valid option"
|
infoLog "Please choose a valid option"
|
||||||
showAndReadOptions
|
showAndReadOptions
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$option" != "$options_length" ]; then
|
if [ "$option" != "$options_length" ]; then
|
||||||
index=$(( $option - 1 ))
|
index=$(( $option - 1 ))
|
||||||
echo "Autopsy configurations will be stored in" "${mnt[$index]}"". Are you sure? (y/n)"
|
echo "Autopsy configurations will be stored in" "${mnt[$index]}"". Are you sure? (y/n)"
|
||||||
@ -53,14 +84,16 @@ if [ "$option" != "$options_length" ]; then
|
|||||||
if [ "$affirmation" == "y" ] || [ "$affirmation" == "Y" ]; then
|
if [ "$affirmation" == "y" ] || [ "$affirmation" == "Y" ]; then
|
||||||
[ -d "${mnt[$index]}" ] && selectedMount=${mnt[$index]} || errorLog "Mount point not found"
|
[ -d "${mnt[$index]}" ] && selectedMount=${mnt[$index]} || errorLog "Mount point not found"
|
||||||
[ -w "$selectedMount" ] && autopsyConfigDir="${mnt[$index]}/AutopsyConfig" || errorLog "Mount point $selectedMount does not have write permission"
|
[ -w "$selectedMount" ] && autopsyConfigDir="${mnt[$index]}/AutopsyConfig" || errorLog "Mount point $selectedMount does not have write permission"
|
||||||
cacheDirectory="$autopsyConfigDir/cachedir"
|
|
||||||
|
# Make the directories on the media
|
||||||
userDirectory="$autopsyConfigDir/userdir"
|
userDirectory="$autopsyConfigDir/userdir"
|
||||||
configDirectory="$autopsyConfigDir/configdata"
|
createConfigDirectories $autopsyConfigDir $userDirectory
|
||||||
createConfigDirectories $autopsyConfigDir $cacheDirectory $userDirectory $configDirectory
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
sh $Autopsybin --userdir $userDirectory --cachedir $cacheDirectory -J-Djava.io.tmpdir=$configDirectory
|
sh $AUTOPSY_BIN --userdir $userDirectory
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
sh $Autopsybin
|
sh $AUTOPSY_BIN
|
||||||
fi
|
fi
|
Loading…
x
Reference in New Issue
Block a user