<commit_before>#!/bin/bash

PROGNAME=$(basename $0)

if test -z ${ASTERISK_VERSION}; then
    echo "${PROGNAME}: ASTERISK_VERSION requires" >&2
    exit 1
fi

# 1.5 jobs per core works out okay
: ${JOBS:=$(( $(nproc) + $(nproc) / 2 ))}

set -ex

mkdir -p /usr/src/asterisk
cd /usr/src/asterisk

curl -sL http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-${ASTERISK_VERSION}.tar.gz |
    tar --strip-components 1 -xz

./configure --prefix=/usr/local
make menuselect/menuselect menuselect-tree menuselect.makeopts

# MOAR SOUNDS
for i in CORE-SOUNDS-EN MOH-OPSOUND EXTRA-SOUNDS-EN; do
    for j in ULAW ALAW G722 GSM SLN16; do
        menuselect/menuselect --enable $i-$j menuselect.makeopts
    done
done

make -j ${JOBS} all
make install samples
chown -R asterisk:asterisk /usr/local/var/*/asterisk
chmod -R 750 /usr/local/var/spool/asterisk

# Set runuser and rungroup
sed -i -E 's/^;(run)(user|group)/\1\2/' /usr/local/etc/asterisk/asterisk.conf

cd /
exec rm -rf /usr/src/asterisk<commit_msg>Use default prefix, don't install samples<commit_after>#!/bin/bash

PROGNAME=$(basename $0)

if test -z ${ASTERISK_VERSION}; then
    echo "${PROGNAME}: ASTERISK_VERSION requires" >&2
    exit 1
fi

# 1.5 jobs per core works out okay
: ${JOBS:=$(( $(nproc) + $(nproc) / 2 ))}

set -ex

mkdir -p /usr/src/asterisk
cd /usr/src/asterisk

curl -sL http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-${ASTERISK_VERSION}.tar.gz |
    tar --strip-components 1 -xz

./configure 
make menuselect/menuselect menuselect-tree menuselect.makeopts

# MOAR SOUNDS
for i in CORE-SOUNDS-EN MOH-OPSOUND EXTRA-SOUNDS-EN; do
    for j in ULAW ALAW G722 GSM SLN16; do
        menuselect/menuselect --enable $i-$j menuselect.makeopts
    done
done

make -j ${JOBS} all
make install
chown -R asterisk:asterisk /var/*/asterisk
chmod -R 750 /var/spool/asterisk
mkdir -p /usr/etc/asterisk
cp /usr/src/asterisk/configs/basic-pbx/*.conf /usr/etc/asterisk/

# Set runuser and rungroup
sed -i -E 's/^;(run)(user|group)/\1\2/' /usr/etc/asterisk/asterisk.conf

cd /
exec rm -rf /usr/src/asterisk
{'fraction_non_alphanumeric': 0.14435445450214388, 'fraction_numerical': 0.016198189614101955, 'mean_word_length': 3.4491525423728815, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '3779393', 'n_tokens_mistral': 874, 'n_tokens_neox': 824, 'n_words': 208}