#!/bin/bash
## Generates the bundle

function copy_dir {
    rm -rf dwarf-compilation
    cp -r dwarf-compilation.base dwarf-compilation
}

function download_repo {
    echo -n "Downloading $1… "
    wget -q "https://git.tobast.fr/m2-internship/$1/archive/master.tar.gz"
    tar xzf master.tar.gz
    rm -f master.tar.gz
    echo "OK"
}

function download {
    cd dwarf-compilation
    download_repo "dwarf-assembly"
    download_repo "libunwind-eh_elf"
    cd ..
}

function package {
    tar czf dwarf-compilation.tar.gz dwarf-compilation
}

copy_dir
download
package
