<commit_before>#!/bin/bash
set -e


if [[ ${USER} == "root" ]]; then
	echo "Please run this script without root privilege."
	exit 1
fi

if [ -e ../configure.sh ]; then
        source ../configure.sh
elif [ -e ./configure.sh ]; then
        source ./configure.sh
else
        echo "Error: Could not find 'configure.sh'!"
        exit 1
fi

## postgresql setup
sudo pacman -S --needed --noconfirm postgresql
echo "Setting the password for system user 'postgres'..."
sudo passwd postgres
sudo -u postgres initdb --locale $LANG -E UTF-8 -D '/var/lib/postgres/data'
sudo systemctl enable postgresql.service
sudo systemctl start postgresql.service
sudo -u postgres createuser firmadyne -s
sudo -u postgres createdb -O firmadyne -U firmadyne firmware
sudo -u postgres psql -d firmware < ${DB_DIR}/schema

## install dependencies
sudo pacman -S --needed --noconfirm bc fakeroot curl git openbsd-netcat nmap net-snmp util-linux fuse binwalk python-crypto python-capstone squashfs-tools python-magic python-psycopg2 qemu qemu-arch-extra mtd-utils tar unrar xz gzip bzip2 p7zip arj lhasa cabextract arj cpio python-opengl sleuthkit afl gcc clang llvm gnuplot afl-utils gdb

yaourt -S --needed --noconfirm busybox-static multipath-tools jefferson-git ubi_reader flawfinder

## firmware-mod-kit
git clone https://aur.archlinux.org/firmware-mod-kit.git && cd firmware-mod-kit
sed -i -e "8s/^source=.*$/source=('https:\/\/storage.googleapis.com\/google-code-archive-downloads\/v2\/code.google.com\/firmware-mod-kit\/fmk_099.tar.gz')/" PKGBUILD
updpkgsums
makepkg -srci --noconfirm --needed
cd .. && rm -rf firmware-mod-kit

## uml_utilities
curl -L -O http://user-mode-linux.sourceforge.net/uml_utilities_20070815.tar.bz2
tar jxf uml_utilities_20070815.tar.bz2
rm uml_utilities_20070815.tar.bz2
cd tools-20070815/
make
sudo make install<commit_msg>cancel installing afl, afl-utils from pacman<commit_after>#!/bin/bash
set -e


if [[ ${USER} == "root" ]]; then
	echo "Please run this script without root privilege."
	exit 1
fi

if [ -e ../configure.sh ]; then
        source ../configure.sh
elif [ -e ./configure.sh ]; then
        source ./configure.sh
else
        echo "Error: Could not find 'configure.sh'!"
        exit 1
fi

## postgresql setup
sudo pacman -S --needed --noconfirm postgresql
echo "Setting the password for system user 'postgres'..."
sudo passwd postgres
sudo -u postgres initdb --locale $LANG -E UTF-8 -D '/var/lib/postgres/data'
sudo systemctl enable postgresql.service
sudo systemctl start postgresql.service
sudo -u postgres createuser firmadyne -s
sudo -u postgres createdb -O firmadyne -U firmadyne firmware
sudo -u postgres psql -d firmware < ${DB_DIR}/schema

## install dependencies
sudo pacman -S --needed --noconfirm bc fakeroot curl git openbsd-netcat nmap net-snmp util-linux fuse binwalk python-crypto python-capstone squashfs-tools python-magic python-psycopg2 qemu qemu-arch-extra mtd-utils tar unrar xz gzip bzip2 p7zip arj lhasa cabextract arj cpio python-opengl sleuthkit

yaourt -S --needed --noconfirm busybox-static multipath-tools jefferson-git ubi_reader flawfinder

## firmware-mod-kit
git clone https://aur.archlinux.org/firmware-mod-kit.git && cd firmware-mod-kit
sed -i -e "8s/^source=.*$/source=('https:\/\/storage.googleapis.com\/google-code-archive-downloads\/v2\/code.google.com\/firmware-mod-kit\/fmk_099.tar.gz')/" PKGBUILD
updpkgsums
makepkg -srci --noconfirm --needed
cd .. && rm -rf firmware-mod-kit

## uml_utilities
curl -L -O http://user-mode-linux.sourceforge.net/uml_utilities_20070815.tar.bz2
tar jxf uml_utilities_20070815.tar.bz2
rm uml_utilities_20070815.tar.bz2
cd tools-20070815/
make
sudo make install
{'fraction_non_alphanumeric': 0.11679431072210066, 'fraction_numerical': 0.02516411378555799, 'mean_word_length': 3.694480102695764, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7344023', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1241, 'n_words': 375}