(command.CommandList children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:24) command_list: (command.CommandList children:[(C {(id)} {(-u)})]) ) } {(-ne)} {(0)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:35) ) ] action: [ (C {(echo)} {(DQ ('###########################################################################'))} ) (C {(echo)} {(DQ ('Installer must be run as root.'))}) (C {(echo)} {(DQ ("Try 'sudo bash ") ($ Id.VSub_Number '$0') ("'"))}) (C {(echo)} {(DQ ('###########################################################################'))} ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:70) arg_word: {(1)} ) ] spids: [20 37] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(-f)} {(/etc/fs_read_only_config)} {(Id.Lit_RBracket ']')}) terminator: (Token id:Id.Op_Semi val:';' span_id:86) ) ] action: [ (C {(echo)} {(DQ (---------------------------------------------------------------------------))} ) (C {(echo)} {(DQ ('Preparing os for read only mode was done before. Nothing to do.'))}) (C {(echo)} {(DQ (---------------------------------------------------------------------------))} ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:112) arg_word: {(0)} ) ] spids: [77 88] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:INSTALL_HALT) op: assign_op.Equal rhs: {(0)} spids: [127] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SYS_TYPES) op: assign_op.Equal rhs: { (sh_array_literal left: (Token id:Id.Op_LParen val:'(' span_id:131) words: [ {(Pi) (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\ ' span_id:133) ) (3) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\ ' span_id:135)) (/) (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\ ' span_id:137) ) (Pi) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\ ' span_id:139)) (Zero) (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\ ' span_id:141) ) (W) } {(All) (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\ ' span_id:145) ) (other) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\ ' span_id:147)) (models) } ] ) } spids: [130] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:WATCHDOG_MODULES) op: assign_op.Equal rhs: { (sh_array_literal left: (Token id:Id.Op_LParen val:'(' span_id:152) words: [{(bcm2835_wdt)} {(bcm2835_wdog)} {(bcm2708_wdt)} {(bcm2708_wdog)}] ) } spids: [151] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:OPTION_NAMES) op: assign_op.Equal rhs: { (sh_array_literal left: (Token id:Id.Op_LParen val:'(' span_id:163) words: [{(NO)} {(YES)}] ) } spids: [162] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:INSTALL_WATCHDOG) op: assign_op.Equal rhs: {(1)} spids: [170] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:WD_TARGET) op: assign_op.Equal rhs: {(1)} spids: [173] ) ] ) (command.ShFunction name: replace body: (command.BraceGroup children: [ (command.Simple words: [{(grep)} {($ Id.VSub_Number '$2')} {($ Id.VSub_Number '$1')}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:207) fd: -1 arg_word: {(/dev/null)} ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {($ Id.VSub_QMark '$?')} {(-eq)} {(0)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:222) ) ] action: [ (command.Simple words: [ {(sed)} {(-i)} {(DQ (s/) ($ Id.VSub_Number '$2') (/) ($ Id.VSub_Number '$3') (/g))} {($ Id.VSub_Number '$1')} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:245) fd: -1 arg_word: {(/dev/null)} ) ] ) ] spids: [211 224] ) ] ) ] ) ) (command.ShFunction name: replaceAppend body: (command.BraceGroup children: [ (command.Simple words: [{(grep)} {($ Id.VSub_Number '$2')} {($ Id.VSub_Number '$1')}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:273) fd: -1 arg_word: {(/dev/null)} ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {($ Id.VSub_QMark '$?')} {(-eq)} {(0)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:288) ) ] action: [ (command.Simple words: [ {(sed)} {(-i)} {(DQ (s/) ($ Id.VSub_Number '$2') (/) ($ Id.VSub_Number '$3') (/g))} {($ Id.VSub_Number '$1')} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:311) fd: -1 arg_word: {(/dev/null)} ) ] ) ] spids: [277 290] ) ] else_action: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_Number '$3')}) (command.Simple words: [{(sudo)} {(tee)} {(-a)} {($ Id.VSub_Number '$1')}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:336) fd: -1 arg_word: {(/dev/null)} ) ] ) ] negated: F ) ] ) ] ) ) (command.ShFunction name: append1 body: (command.BraceGroup children: [ (command.Simple words: [{(grep)} {($ Id.VSub_Number '$2')} {($ Id.VSub_Number '$1')}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:364) fd: -1 arg_word: {(/dev/null)} ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {($ Id.VSub_QMark '$?')} {(-ne)} {(0)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:379) ) ] action: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_Number '$3')}) (command.Simple words: [{(sudo)} {(tee)} {(-a)} {($ Id.VSub_Number '$1')}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:402) fd: -1 arg_word: {(/dev/null)} ) ] ) ] negated: F ) ] spids: [368 381] ) ] ) ] ) ) (command.ShFunction name: append2 body: (command.BraceGroup children: [ (command.Simple words: [{(grep)} {($ Id.VSub_Number '$2')} {($ Id.VSub_Number '$1')}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:433) fd: -1 arg_word: {(/dev/null)} ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {($ Id.VSub_QMark '$?')} {(-ne)} {(0)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:448) ) ] action: [ (command.Simple words: [ {(sed)} {(-i)} {(DQ (s/) (Id.Lit_Other '\\') ("'/ ") ($ Id.VSub_Number '$3') (/g))} {($ Id.VSub_Number '$1')} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:471) fd: -1 arg_word: {(/dev/null)} ) ] ) ] spids: [437 450] ) ] ) ] ) ) (command.ShFunction name: mark_script_run body: (command.BraceGroup children:[(C {(touch)} {(/etc/fs_read_only_config)})]) ) (C {(echo)} {(DQ (---------------------------------------------------------------------------))}) (C {(echo)} {(DQ ('Starting installation...'))}) (C {(echo)} {(DQ (---------------------------------------------------------------------------))}) (C {(systemctl)} {(disable)} {(systemd-rfkill.service)}) (C {(echo)} {(DQ (---------------------------------------------------------------------------))}) (C {(echo)} {(DQ ('Removing unwanted packages...'))}) (C {(echo)} {(DQ (---------------------------------------------------------------------------))}) (C {(apt-get)} {(remove)} {(-y)} {(--force-yes)} {(--purge)} {(dphys-swapfile)} {(fake-hwclock)}) (C {(apt-get)} {(-y)} {(--force-yes)} {(autoremove)} {(--purge)}) (C {(echo)} {(DQ (---------------------------------------------------------------------------))}) (C {(echo)} {(DQ ('Configuring system...'))}) (C {(echo)} {(DQ (---------------------------------------------------------------------------))}) (C {(sed)} {(-i)} {(DQ ('s/#Storage=auto/Storage=volatile/'))} {(/etc/systemd/journald.conf)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {($ Id.VSub_DollarName '$INSTALL_WATCHDOG')} {(-ne)} {(0)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:624) ) ] action: [ (C {(apt-get)} {(install)} {(-y)} {(--force-yes)} {(watchdog)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:MODULE) op: assign_op.Equal rhs: { (braced_var_sub token: (Token id:Id.VSub_Name val:WATCHDOG_MODULES span_id:646) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.Binary op_id: Id.Arith_Minus left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$WD_TARGET')}) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) ) ) } spids: [644] ) ] ) (C {(append1)} {(/etc/modules)} {($ Id.VSub_DollarName '$MODULE')} {($ Id.VSub_DollarName '$MODULE')} ) (C {(replace)} {(/etc/watchdog.conf)} {(DQ ('#watchdog-device'))} {(DQ (watchdog-device))}) (C {(replace)} {(/etc/watchdog.conf)} {(DQ ('#max-load-1'))} {(DQ (max-load-1))}) (C {(apt-get)} {(install)} {(-y)} {(--force-yes)} {(insserv)}) (C {(insserv)} {(watchdog)}) (C {(append1)} {(/lib/systemd/system/watchdog.service)} {(DQ (WantedBy))} {(DQ ('WantedBy=multi-user.target'))} ) (C {(systemctl)} {(enable)} {(watchdog)}) (C {(replaceAppend)} {(/etc/sysctl.conf)} {(DQ ('^.*kernel.panic.*') (Id.Lit_Other '$'))} {(DQ ('kernel.panic = 10'))} ) ] spids: [613 626] ) ] ) (C {(append2)} {(/boot/cmdline.txt)} {(fastboot)} {(fastboot)}) (C {(append2)} {(/boot/cmdline.txt)} {(noswap)} {(noswap)}) (C {(append2)} {(/boot/cmdline.txt)} {(ro) (Id.Lit_Other '^') (o) (Id.Lit_Other '^') (t)} {(ro)}) (C {(rm)} {(-rf)} {(/var/spool)}) (C {(ln)} {(-s)} {(/tmp)} {(/var/spool)}) (C {(touch)} {(/tmp/openauto.ini)}) (C {(ln)} {(-s)} {(/tmp/openauto.ini)} {(/home/pi/openauto.ini)}) (C {(chown)} {(pi) (Id.Lit_Other ':') (pi)} {(/home/pi/openauto.ini)}) (C {(mkdir)} {(-p)} {(/tmp/.config)}) (C {(mkdir)} {(-p)} {(/tmp/.local)}) (C {(ln)} {(-s)} {(/tmp/.config)} {(/home/pi/)}) (C {(ln)} {(-s)} {(/tmp/.local)} {(/home/pi/)}) (C {(apt)} {(clean)}) (C {(rm)} {(-rf)} {(/var/cache/apt/)}) (C {(replace)} {(/usr/lib/tmpfiles.d/var.conf)} {(DQ (spool) (Id.Lit_Other '\\') ('s*0755'))} {(DQ ('spool 1777'))} ) (C {(touch)} {(/tmp/dhcpcd.resolv.conf)}) (command.Simple words: [{(echo)} {(DQ ('nameserver 8.8.8.8'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:908) fd: -1 arg_word: {(/tmp/dhcpcd.resolv.conf)} ) ] ) (command.Simple words: [{(echo)} {(DQ ('nameserver 8.8.4.4'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_DGreat val:'>>' span_id:918) fd: -1 arg_word: {(/tmp/dhcpcd.resolv.conf)} ) ] ) (C {(rm)} {(/etc/resolv.conf)}) (C {(ln)} {(-s)} {(/tmp/dhcpcd.resolv.conf)} {(/etc/resolv.conf)}) (C {(replace)} {(/etc/fstab)} {(DQ (vfat) (Id.Lit_Other '\\') ('s*defaults') (Id.Lit_Other '\\') (s))} {(DQ ('vfat defaults,ro '))} ) (C {(replace)} {(/etc/fstab)} {(DQ (ext4) (Id.Lit_Other '\\') ('s*defaults,noatime') (Id.Lit_Other '\\') (s))} {(DQ ('ext4 defaults,noatime,ro '))} ) (C {(append1)} {(/etc/fstab)} {(DQ (/var/log))} {(DQ ('tmpfs /var/log tmpfs nodev,nosuid 0 0'))}) (C {(append1)} {(/etc/fstab)} {(DQ (/var/tmp))} {(DQ ('tmpfs /var/tmp tmpfs nodev,nosuid 0 0'))}) (C {(append1)} {(/etc/fstab)} {(DQ (Id.Lit_Other '\\') (s/tmp))} {(DQ ('tmpfs /tmp tmpfs nodev,nosuid 0 0'))} ) (C {(mark_script_run)}) (C {(sync)}) (command.ControlFlow token:(Token id:Id.ControlFlow_Exit val:exit span_id:1025) arg_word:{(0)}) ] )