<commit_before>fix_acpid() {
  # Fix acpid
  mkdir -p /etc/acpi/events
  cat >> /etc/acpi/events/power << EOF
event=button/power.*
action=/usr/local/sbin/power.sh "%e"
EOF
  cat >> /usr/local/sbin/power.sh << EOF
#!/bin/bash
/sbin/poweroff
EOF
  chmod a+x /usr/local/sbin/power.sh
}

fix_acpid<commit_msg>CLOUDSTACK-7143: cleanup configure_acpid.sh code<commit_after>#!/bin/bash

set -e
set -x

function configure_acpid() {
  grep /usr/local/sbin/power.sh /etc/acpi/events/power && return

  mkdir -p /etc/acpi/events
  cat >> /etc/acpi/events/power << EOF
event=button/power.*
action=/usr/local/sbin/power.sh "%e"
EOF
  cat >> /usr/local/sbin/power.sh << EOF
#!/bin/bash
/sbin/poweroff
EOF
  chmod a+x /usr/local/sbin/power.sh
}

return 2>/dev/null || configure_acpid
{'fraction_non_alphanumeric': 0.171875, 'fraction_numerical': 0.006510416666666667, 'mean_word_length': 3.445086705202312, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, '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': '7320379', 'n_tokens_mistral': 338, 'n_tokens_neox': 324, 'n_words': 58}