update README for 43.05
[rofl0r-df-mayday.git] / utils / clean.sh
blob8810efc9ed3ddb8077040d5c0975747d94c8f3fa
1 #!/usr/bin/env bash
2 # parameter: directory with DF or DFG
3 # purpose: rip off everything unneeded for diffing.
4 DFDIR=$1
5 ROOTDIR="/"
6 DOTDIR="."
7 if [[ -z "$DFDIR" ]]
8 then
9 echo "supply a valid path as first parameter!"
10 elif [[ "$DFDIR" == "$ROOTDIR" ]]
11 then
12 echo "omg. you REALLY shouldnt apply this on your root dir."
13 elif [[ "$DFDIR" == "$DOTDIR" ]]
14 then
15 echo "you have to cd out of the distrib dir. just cd .. and call again"
16 elif [[ ! -e "$DFDIR/data/init" ]]
17 then
18 echo "your target doesnt look like a DF dir. exitting."
19 else
20 MDTMP=/tmp/mdtmp
21 mkdir $MDTMP
22 mv $DFDIR/data/init $MDTMP/init
23 mv $DFDIR/raw/objects $MDTMP/objects
24 rm -rf $DFDIR
25 mkdir $DFDIR
26 mkdir $DFDIR/data
27 mv $MDTMP/init $DFDIR/data/
28 mkdir $DFDIR/raw
29 mv $MDTMP/objects $DFDIR/raw/
30 rm -rf $MDTMP