summaryrefslogtreecommitdiff
path: root/trunk/reprap/miscellaneous/LiveCD-scripts/expand-iso.sh
blob: c930f745fb7de60418df94ef9458424079e8464f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash

# This is designed to be run from the same folder you have the iso you want to expand in.

echo "The current .iso files are:"
echo

ls -w 1  *.iso

echo
echo -n "Do you want to continue?"
echo

while [ "y" != "$answer" ] && [ "n" != "$answer" ];

do
        echo 'Enter y for "Yes" or  n for "No" '
        read answer
done


if [ "$answer" == "n" ]
then
    echo "Ending Script"
   exit 0

else

mkdir cd
mkdir mnt
mkdir squash
mkdir source


echo -n "What iso file did you want to expand? "
read FILE_NAME

echo "Mounting iso"
sudo mount $FILE_NAME mnt -o loop

echo "Copying mounted iso filesystem to cd folder"
echo "This will take a few minutes"
rsync -a mnt/ cd/

echo "Mounting squashed filesystem within iso"
sudo mount -t squashfs -o loop mnt/casper/filesystem.squashfs squash

echo "Copying squashed filesystem to source folder"
echo "This will take quite a long while"
sudo cp -a squash/* source/

echo "Finishing up"
sudo umount squash
sudo umount mnt

fi