(CommandList children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(DQ (-e))} {(-o)} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(DQ (--empty))} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (C {(rm)} {(-f)} {(hdd.img)}) (C {(truncate)} {(-s)} {(20M)} {(hdd.img)}) (C {(echo)} {(DQ ("Created new hard disk image file 'hdd.img' with 20MB size."))}) ] spids: [-1 38] ) (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(DQ (-f))} {(-o)} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(DQ (--folder))} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(id)} {(-u)})]) left_token: <Left_CommandSub "$("> spids: [107 111] ) ) } {(Lit_Other "=")} {(DQ (0))} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} {(DQ ("Using option '-f' (or '--folder') requires root permissions."))}) (C {(exit)} {(1)}) ] spids: [-1 124] ) ] spids: [-1 139] ) (C {(rm)} {(-f)} {(hdd.img)}) (C {(truncate)} {(-s)} {(20M)} {(hdd.img)}) (C {(echo)} {(DQ ("Created new hard disk image file 'hdd.img' with 20MB size."))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOOP_DEVICE) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(losetup)} {(-f)})]) left_token: <Left_CommandSub "$("> spids: [170 174] ) } spids: [169] ) ] spids: [169] ) (C {(losetup)} {($ VSub_Name "$LOOP_DEVICE")} {(hdd.img)}) (C {(echo)} {(DQ ("Attached hard disk image file to loop device."))}) (C {(mkfs.ext2)} {($ VSub_Name "$LOOP_DEVICE")}) (C {(echo)} {(DQ ("Hard disk image file has been formatted with Ext2 filesystem."))}) (C {(mkdir)} {(folder)}) (C {(mount)} {(hdd.img)} {(folder)}) (C {(echo)} {(DQ ("Mounted hard disk image file to temporary folder."))}) (C {(mkdir)} {(-p)} {(folder/minimal/rootfs)}) (C {(mkdir)} {(-p)} {(folder/minimal/work)}) (C {(echo)} {(DQ ("Overlay structure has been created."))}) (SimpleCommand words: [{(echo)} {(DQ ("This file is on external hard disk."))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(folder/minimal/rootfs/overlay.txt)} spids: [257] ) ] ) (C {(echo)} {(DQ ("Created sample text file."))}) (C {(umount)} {(folder)}) (C {(rm)} {(-rf)} {(folder)}) (C {(echo)} {(DQ ("Unmounted hard disk image file."))}) (C {(losetup)} {(-d)} {($ VSub_Name "$LOOP_DEVICE")}) (C {(echo)} {(DQ ("Detached hard disk image file from loop device."))}) (C {(chown)} { (CommandSubPart command_list: (CommandList children:[(C {(logname)})]) left_token: <Left_CommandSub "$("> spids: [310 312] ) } {(hdd.img)} ) (C {(echo)} {(DQ ("Applied original ownership to hard disk image file."))}) ] spids: [67 97] ) (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(DQ (-s))} {(-o)} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(DQ (--sparse))} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(id)} {(-u)})]) left_token: <Left_CommandSub "$("> spids: [363 367] ) ) } {(Lit_Other "=")} {(DQ (0))} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} {(DQ ("Using option '-s' (or '--sparse') requires root permissions."))}) (C {(exit)} {(1)}) ] spids: [-1 380] ) ] spids: [-1 395] ) (C {(rm)} {(-f)} {(hdd.img)}) (C {(truncate)} {(-s)} {(20M)} {(hdd.img)}) (C {(echo)} {(DQ ("Created new hard disk image file 'hdd.img' with 20MB size."))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOOP_DEVICE_HDD) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(losetup)} {(-f)})]) left_token: <Left_CommandSub "$("> spids: [426 430] ) } spids: [425] ) ] spids: [425] ) (C {(losetup)} {($ VSub_Name "$LOOP_DEVICE_HDD")} {(hdd.img)}) (C {(echo)} {(DQ ("Attached hard disk image file to loop device."))}) (C {(mkfs.vfat)} {($ VSub_Name "$LOOP_DEVICE_HDD")}) (C {(echo)} {(DQ ("Hard disk image file has been formatted with FAT filesystem."))}) (C {(mkdir)} {(sparse)}) (C {(mount)} {(hdd.img)} {(sparse)}) (C {(echo)} {(DQ ("Mounted hard disk image file to temporary folder."))}) (C {(rm)} {(-f)} {(sparse/minimal.img)}) (C {(truncate)} {(-s)} {(1M)} {(sparse/minimal.img)}) (C {(echo)} {(DQ ("Created new overlay image file with 1MB size."))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOOP_DEVICE_OVL) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(losetup)} {(-f)})]) left_token: <Left_CommandSub "$("> spids: [509 513] ) } spids: [508] ) ] spids: [508] ) (C {(losetup)} {($ VSub_Name "$LOOP_DEVICE_OVL")} {(sparse/minimal.img)}) (C {(echo)} {(DQ ("Attached overlay image file to loop device."))}) (C {(mkfs.ext2)} {($ VSub_Name "$LOOP_DEVICE_OVL")}) (C {(echo)} {(DQ ("Overlay image file has been formatted with Ext2 filesystem."))}) (C {(mkdir)} {(ovl)}) (C {(mount)} {(sparse/minimal.img)} {(ovl)}) (C {(echo)} {(DQ ("Mounted overlay image file to temporary folder."))}) (C {(mkdir)} {(-p)} {(ovl/rootfs)}) (C {(mkdir)} {(-p)} {(ovl/work)}) (C {(echo)} {(DQ ("Overlay structure has been created."))}) (C {(echo)} {(DQ ("Create sample text file."))}) (SimpleCommand words: [{(echo)} {(DQ ("This file is on external hard disk."))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(ovl/rootfs/overlay.txt)} spids: [601] ) ] ) (C {(chown)} {(-R)} {(root) (Lit_Other ":") (root)} {(ovl)}) (C {(echo)} {(DQ ("Applied root ownership to overlay content."))}) (C {(umount)} {(ovl)}) (C {(sleep)} {(1)}) (C {(rm)} {(-rf)} {(ovl)}) (C {(echo)} {(DQ ("Unmounted overlay image file."))}) (C {(losetup)} {(-d)} {($ VSub_Name "$LOOP_DEVICE_OVL")}) (C {(sleep)} {(1)}) (C {(echo)} {(DQ ("Overlay image file has been detached from loop device."))}) (C {(umount)} {(sparse)}) (C {(sleep)} {(1)}) (C {(rm)} {(-rf)} {(sparse)}) (C {(echo)} {(DQ ("Unmounted hard disk image file."))}) (C {(losetup)} {(-d)} {($ VSub_Name "$LOOP_DEVICE_HDD")}) (C {(sleep)} {(1)}) (C {(echo)} {(DQ ("Hard disk image file has been detached from loop device."))}) (C {(chown)} { (CommandSubPart command_list: (CommandList children:[(C {(logname)})]) left_token: <Left_CommandSub "$("> spids: [721 723] ) } {(hdd.img)} ) (C {(echo)} {(DQ ("Applied original ownership to hard disk image file."))}) ] spids: [323 353] ) (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(DQ (-h))} {(-o)} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(DQ (--help))} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ (" Usage: ") ($ VSub_Number "$0") (" [OPTION]\n") ( " This utility generates 20MB sparse file 'hdd.img' which can be used as QEMU\n" ) (" disk image where all filesystem changes from the live session are persisted.\n") (" \n") ( " -e, --empty Create empty sparse image file which is not formatted.\n" ) (" -f, --folder Create sparse image file formatted with Ext2 filesystem which\n") (" contains compatible overlay folder structure.\n") (" -h, --help Prints this help information.\n") ( " -s, --sparse Create sparse image file formatted with FAT filesystem which\n" ) (" contains sparse image file 'minimal.img' (1MB) formatted with\n") ( " Ext2 filesystem which contains the actual overlay structure.\n" ) ) } do_expansion: True here_end: CEOF was_filled: True spids: [769] ) ] ) ] spids: [734 764] ) (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(DQ )} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [(C {(echo)} {(DQ ("No option specified. Use '-h' or '--help' for more info."))})] spids: [787 804] ) ] else_action: [ (C {(echo)} { (DQ ("Option '") ($ VSub_Number "$1") ("' is not recognized. Use '-h' or '--help' for more info.") ) } ) ] spids: [813 824] ) ] )