<commit_before>#!/usr/bin/python3

import argparse
import os

import icon_lib


parser = argparse.ArgumentParser(description='iconograph persistent')
parser.add_argument(
    '--chroot-path',
    dest='chroot_path',
    action='store',
    required=True)
FLAGS = parser.parse_args()


def main():
  module = icon_lib.IconModule(FLAGS.chroot_path)

  os.mkdir(os.path.join(FLAGS.chroot_path, 'persistent'))

  tool_path = os.path.join(FLAGS.chroot_path, 'icon', 'persistent')
  os.makedirs(tool_path, exist_ok=True)

  script = os.path.join(tool_path, 'startup.sh')
  with open(script, 'w') as fh:
    os.chmod(fh.fileno(), 0o755)
    fh.write("""\
#!/bin/bash
set -ex
e2fsck -a /persistent
mount -o data=journal,noatime,sync LABEL=PERSISTENT /persistent
""")

  with module.ServiceFile('persistent.service') as fh:
    fh.write("""
[Unit]
Description=Mount /persistent
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-remount-fs.service
Before=sysinit.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/icon/persistent/startup.sh

[Install]
WantedBy=sysinit.target
""")
  module.EnableService('persistent.service')


if __name__ == '__main__':
  main()<commit_msg>Remove flags that drastically slow down writes<commit_after>#!/usr/bin/python3

import argparse
import os

import icon_lib


parser = argparse.ArgumentParser(description='iconograph persistent')
parser.add_argument(
    '--chroot-path',
    dest='chroot_path',
    action='store',
    required=True)
FLAGS = parser.parse_args()


def main():
  module = icon_lib.IconModule(FLAGS.chroot_path)

  os.mkdir(os.path.join(FLAGS.chroot_path, 'persistent'))

  tool_path = os.path.join(FLAGS.chroot_path, 'icon', 'persistent')
  os.makedirs(tool_path, exist_ok=True)

  script = os.path.join(tool_path, 'startup.sh')
  with open(script, 'w') as fh:
    os.chmod(fh.fileno(), 0o755)
    fh.write("""\
#!/bin/bash
set -ex
e2fsck -a /persistent
mount -o noatime LABEL=PERSISTENT /persistent
""")

  with module.ServiceFile('persistent.service') as fh:
    fh.write("""
[Unit]
Description=Mount /persistent
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-remount-fs.service
Before=sysinit.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/icon/persistent/startup.sh

[Install]
WantedBy=sysinit.target
""")
  module.EnableService('persistent.service')


if __name__ == '__main__':
  main()
{'fraction_non_alphanumeric': 0.1433347262849979, 'fraction_numerical': 0.005014625992478061, 'mean_word_length': 5.186046511627907, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5368343', 'n_tokens_mistral': 900, 'n_tokens_neox': 856, 'n_words': 153}