flashaosp: rewrite script