Would have to be some sort of shell script to do so. Your best bet would be to take a look at some of the other shell scripts already written from some of the ROM developers to get an idea on how to do it.
Not sure if there is a way to write the script so that it gains root 8and* performs the commands, as I haven't delved into it, but if you wrote 2 scripts, one that did all the work, and another that gains root access and calls the first, it *should8 theoretically work.