pluto/fat32_cp.sh

21 lines
435 B
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
2021-06-08 00:00:33 +02:00
set -ex
IMAGE_PATH_DIR=$1
mkdir test/fat32/mnt
2021-06-08 00:00:33 +02:00
whoami
if [ "$(whoami)" = "root" ]; then
echo "Am root"
mount -o utf8=true $IMAGE_PATH_DIR test/fat32/mnt/
cp -r test/fat32/test_files/. test/fat32/mnt/
umount test/fat32/mnt/
else
echo "Not root"
sudo mount -o utf8=true $IMAGE_PATH_DIR test/fat32/mnt/
sudo cp -r test/fat32/test_files/. test/fat32/mnt/
sudo umount test/fat32/mnt/
fi
rm -rf test/fat32/mnt