chore: Remove dev_tools (#1384)

This commit is contained in:
Jonas L 2021-10-17 17:29:52 +02:00 committed by GitHub
parent 5e8d8db6e9
commit 10d073dcfb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 0 additions and 785 deletions

View file

@ -1,11 +0,0 @@
Last updated: September 4, 2015
To update the Airtime translations:
- Make sure you run bootstrap_development_environment.sh as root once to set up this magic git merge driver for PO files.
- Run update_po_files.sh
- Commit the updated files.
- Push to GitHub.
- Transifex will then pick up the updated files in about 24 hours, and they'll be available for translation there.
- After translators have updated strings, they'll be automatically downloaded and committed to our git repo by
a script running here at Sourcefabric (contact Andrey).

View file

@ -1,192 +0,0 @@
<?PHP
/*
The purpose of this script is to take a file from cc_files table, and insert it into
the schedule table. DB columns at the time of writing are
starts | ends | file_id | clip_length | fade_in | fade_out | cue_in | cue_out | media_item_played | instance_id
an example of data in this row is:
"9" | "2012-02-29 17:10:00" | "2012-02-29 17:15:05.037166" | 1 | "00:05:05.037166" | "00:00:00" | "00:00:00" | "00:00:00" | "00:05:05.037166" | FALSE | 5
*/
function query($conn, $query){
$result = pg_query($conn, $query);
if (!$result) {
echo "Error executing query $query.\n";
exit(1);
}
return $result;
}
function getFileFromCcFiles($conn){
$query = "SELECT * from cc_files LIMIT 2";
$result = query($conn, $query);
$files = array();
while ($row = pg_fetch_array($result)) {
$files[] = $row;
}
if (count($files) == 0){
echo "Library is empty. Could not choose random file.";
exit(1);
}
return $files;
}
function insertIntoCcShow($conn){
/* Step 1:
* Create a show
* */
$query = "INSERT INTO cc_show (name, url, genre, description, color, background_color) VALUES ('test', '', '', '', '', '')";
echo $query.PHP_EOL;
$result = query($conn, $query);
$query = "SELECT currval('cc_show_id_seq');";
$result = pg_query($conn, $query);
if (!$result) {
echo "Error executing query $query.\n";
exit(1);
}
while ($row = pg_fetch_array($result)) {
$show_id = $row["currval"];
}
return $show_id;
}
function insertIntoCcShowInstances($conn, $show_id, $starts, $ends, $files){
/* Step 2:
* Create a show instance.
* Column values:
* starts | ends | show_id | record | rebroadcast | instance_id | file_id | time_filled | last_scheduled | modified_instance
* */
$nowDateTime = new DateTime("now", new DateTimeZone("UTC"));
$now = $nowDateTime->format("Y-m-d H:i:s");
$columns = "(starts, ends, show_id, record, rebroadcast, instance_id, file_id, time_filled, last_scheduled, modified_instance)";
$values = "('$starts', '$ends', $show_id, 0, 0, NULL, NULL, TIMESTAMP '$ends' - TIMESTAMP '$starts', '$now', 'f')";
$query = "INSERT INTO cc_show_instances $columns values $values ";
echo $query.PHP_EOL;
$result = query($conn, $query);
$query = "SELECT currval('cc_show_instances_id_seq');";
$result = pg_query($conn, $query);
if (!$result) {
echo "Error executing query $query.\n";
exit(1);
}
while ($row = pg_fetch_array($result)) {
$show_instance_id = $row["currval"];
}
return $show_instance_id;
}
/*
* id | starts | ends | file_id | clip_length| fade_in | fade_out | cue_in | cue_out | media_item_played | instance_id
* 1 | 2012-02-29 23:25:00 | 2012-02-29 23:30:05.037166 | 1 | 00:05:05.037166 | 00:00:00 | 00:00:00 | 00:00:00 | 00:05:05.037166 | f | 5
*/
function insertIntoCcSchedule($conn, $files, $show_instance_id, $p_starts, $p_ends){
$columns = "(starts, ends, file_id, clip_length, fade_in, fade_out, cue_in, cue_out, media_item_played, instance_id)";
$starts = $p_starts;
foreach($files as $file){
$endsDateTime = new DateTime($starts, new DateTimeZone("UTC"));
$lengthDateInterval = getDateInterval($file["length"]);
$endsDateTime->add($lengthDateInterval);
$ends = $endsDateTime->format("Y-m-d H:i:s");
$values = "('$starts', '$ends', $file[id], '$file[length]', '00:00:00', '00:00:00', '00:00:00', '$file[length]', 'f', $show_instance_id)";
$query = "INSERT INTO cc_schedule $columns VALUES $values";
echo $query.PHP_EOL;
$starts = $ends;
$result = query($conn, $query);
}
}
function getDateInterval($interval){
list($length,) = explode(".", $interval);
list($hour, $min, $sec) = explode(":", $length);
return new DateInterval("PT{$hour}H{$min}M{$sec}S");
}
function getEndTime($startDateTime, $p_files){
foreach ($p_files as $file){
$startDateTime->add(getDateInterval($file['length']));
}
return $startDateTime;
}
function rabbitMqNotify(){
$ini_file = parse_ini_file("/etc/airtime/airtime.conf", true);
$url = "http://localhost/api/rabbitmq-do-push/format/json/api_key/".$ini_file["general"]["api_key"];
echo "Contacting $url".PHP_EOL;
$ch = curl_init($url);
curl_exec($ch);
curl_close($ch);
}
$conn = pg_connect("host=localhost port=5432 dbname=airtime user=airtime password=airtime");
if (!$conn) {
echo "Couldn't connect to Airtime DB.\n";
exit(1);
}
if (count($argv) > 1){
if ($argv[1] == "--clean"){
$tables = array("cc_schedule", "cc_show_instances", "cc_show");
foreach($tables as $table){
$query = "DELETE FROM $table";
echo $query.PHP_EOL;
query($conn, $query);
}
rabbitMqNotify();
exit(0);
} else {
$str = <<<EOD
This script schedules a file to play 30 seconds in the future. It
modifies the database tables cc_schedule, cc_show_instances and cc_show.
You can clean up these tables using the --clean option.
EOD;
echo $str.PHP_EOL;
exit(0);
}
}
$startDateTime = new DateTime("now + 30sec", new DateTimeZone("UTC"));
//$endDateTime = new DateTime("now + 1min 30sec", new DateTimeZone("UTC"));
$starts = $startDateTime->format("Y-m-d H:i:s");
//$ends = $endDateTime->format("Y-m-d H:i:s");
$files = getFileFromCcFiles($conn);
$show_id = insertIntoCcShow($conn);
$endDateTime = getEndTime(clone $startDateTime, $files);
$ends = $endDateTime->format("Y-m-d H:i:s");
$show_instance_id = insertIntoCcShowInstances($conn, $show_id, $starts, $ends, $files);
insertIntoCcSchedule($conn, $files, $show_instance_id, $starts, $ends);
rabbitMqNotify();
echo PHP_EOL."Show scheduled for $starts (UTC)".PHP_EOL;

View file

@ -1,7 +0,0 @@
#!/usr/bin/env bash
# Set up 3 way PO file merging, which we need for non-mainline branches
cp scripts/git-merge-po /usr/local/bin
chmod +x /usr/local/bin/git-merge-po
cat scripts/git-config-git-merge-po >> ../.git/config
cat scripts/git-attributes-git-merge-po >> ../.gitattributes

View file

@ -1,140 +0,0 @@
import logging
import os
import shutil
import sys
import time
from subprocess import PIPE, Popen
from api_clients import api_client as apc
from configobj import ConfigObj
"""
The purpose of this script is that you can run it, and it will compare what the database has to what your filesystem
has. It will then report if there are any differences. It will *NOT* make any changes, unlike media-monitor which uses
similar code when it starts up (but then makes changes if something is different)
"""
class AirtimeMediaMonitorBootstrap:
"""AirtimeMediaMonitorBootstrap constructor
Keyword Arguments:
logger -- reference to the media-monitor logging facility
pe -- reference to an instance of ProcessEvent
api_clients -- reference of api_clients to communicate with airtime-server
"""
def __init__(self):
config = ConfigObj("/etc/airtime/airtime.conf")
self.api_client = apc.api_client_factory(config)
"""
try:
logging.config.fileConfig("logging.cfg")
except Exception, e:
print 'Error configuring logging: ', e
sys.exit(1)
"""
self.logger = logging.getLogger()
self.logger.info("Adding %s on watch list...", "xxx")
self.scan()
"""On bootup we want to scan all directories and look for files that
weren't there or files that changed before media-monitor process
went offline.
"""
def scan(self):
directories = self.get_list_of_watched_dirs()
self.logger.info("watched directories found: %s", directories)
for id, dir in directories.iteritems():
self.logger.debug("%s, %s", id, dir)
# CHANGED!!!
# self.sync_database_to_filesystem(id, api_client.encode_to(dir, "utf-8"))
self.sync_database_to_filesystem(id, dir)
"""Gets a list of files that the Airtime database knows for a specific directory.
You need to provide the directory's row ID, which is obtained when calling
get_list_of_watched_dirs function.
dir_id -- row id of the directory in the cc_watched_dirs database table
"""
def list_db_files(self, dir_id):
return self.api_client.list_all_db_files(dir_id)
"""
returns the path and the database row id for this path for all watched directories. Also
returns the Stor directory, which can be identified by its row id (always has value of "1")
"""
def get_list_of_watched_dirs(self):
json = self.api_client.list_all_watched_dirs()
return json["dirs"]
def scan_dir_for_existing_files(self, dir):
command = (
'find "%s" -type f -iname "*.ogg" -o -iname "*.mp3" -readable'
% dir.replace('"', '\\"')
)
self.logger.debug(command)
# CHANGED!!
stdout = self.exec_command(command).decode("UTF-8")
return stdout.splitlines()
def exec_command(self, command):
p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
if p.returncode != 0:
self.logger.warn(
"command \n%s\n return with a non-zero return value", command
)
self.logger.error(stderr)
return stdout
"""
This function takes in a path name provided by the database (and its corresponding row id)
and reads the list of files in the local file system. Its purpose is to discover which files
exist on the file system but not in the database and vice versa, as well as which files have
been modified since the database was last updated. In each case, this method will call an
appropriate method to ensure that the database actually represents the filesystem.
dir_id -- row id of the directory in the cc_watched_dirs database table
dir -- pathname of the directory
"""
def sync_database_to_filesystem(self, dir_id, dir):
"""
set to hold new and/or modified files. We use a set to make it ok if files are added
twice. This is because some of the tests for new files return result sets that are not
mutually exclusive from each other.
"""
db_known_files_set = set()
files = self.list_db_files(dir_id)
for file in files["files"]:
db_known_files_set.add(file)
existing_files = self.scan_dir_for_existing_files(dir)
existing_files_set = set()
for file_path in existing_files:
if len(file_path.strip(" \n")) > 0:
existing_files_set.add(file_path[len(dir) :])
deleted_files_set = db_known_files_set - existing_files_set
new_files_set = existing_files_set - db_known_files_set
print("DB Known files: \n%s\n\n" % len(db_known_files_set))
print("FS Known files: \n%s\n\n" % len(existing_files_set))
print("Deleted files: \n%s\n\n" % deleted_files_set)
print("New files: \n%s\n\n" % new_files_set)
if __name__ == "__main__":
AirtimeMediaMonitorBootstrap()

View file

@ -1,123 +0,0 @@
#!/usr/bin/env bash
set -e
apt-get install -y --force-yes lsb-release sudo
dist=$(lsb_release -is)
code=$(lsb_release -cs)
# cpu=$(getconf LONG_BIT)
# cpuvalue=
#enable apt.sourcefabric.org source
set +e
grep -E "deb http://apt.sourcefabric.org $code main" /etc/apt/sources.list
returncode=$?
set -e
if [ "$returncode" -ne "0" ]; then
echo "deb http://apt.sourcefabric.org $code main" >> /etc/apt/sources.list
fi
apt-get update
apt-get -y --force-yes install sourcefabric-keyring
apt-get update
if [ "$dist" = "Ubuntu" ]; then
set +e
grep -E "deb http://ca.archive.ubuntu.com/ubuntu/ $code multiverse" /etc/apt/sources.list
returncode=$?
set -e
if [ "$returncode" -ne "0" ]; then
echo "deb http://ca.archive.ubuntu.com/ubuntu/ $code multiverse" >> /etc/apt/sources.list
echo "deb http://ca.archive.ubuntu.com/ubuntu/ $code universe" >> /etc/apt/sources.list
fi
fi
#enable squeeze backports to get lame packages
if [[ "$dist" == "Debian" && "$code" == "squeeze" ]]; then
set +e
grep -E "deb http://backports.debian.org/debian-backports squeeze-backports main" /etc/apt/sources.list
returncode=$?
set -e
if [ "$returncode" -ne "0" ]; then
echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list
fi
fi
# echo "System is $cpu bit..."
# if [ "$cpu" = "64" ]; then
# cpuvalue="amd64"
# else
# cpuvalue="i386"
# fi
apt-get update
apt-get -o Dpkg::Options::="--force-confold" upgrade
apt-get -y --force-yes install libopus0 libopus-dev libopus-dbg libopus-doc
#obsoleted code start
#apt-get -y --force-yes install wget
#rm -f libopu*
#rm -f aacplus*
#wget http://apt.sourcefabric.org/misc/libopus_1.0.1/libopus-dbg_1.0.1~$code~sfo-1_$cpuvalue.deb
#wget http://apt.sourcefabric.org/misc/libopus_1.0.1/libopus-dev_1.0.1~$code~sfo-1_$cpuvalue.deb
#wget http://apt.sourcefabric.org/misc/libopus_1.0.1/libopus0_1.0.1~$code~sfo-1_$cpuvalue.deb
#wget http://packages.medibuntu.org/pool/free/a/aacplusenc/aacplusenc_0.17.5-0.0medibuntu1_$cpuvalue.deb
#obsoleted code end
apt-get -y --force-yes install git-core ocaml-findlib libao-ocaml-dev \
libportaudio-ocaml-dev libmad-ocaml-dev libtaglib-ocaml-dev libalsa-ocaml-dev \
libvorbis-ocaml-dev libladspa-ocaml-dev libxmlplaylist-ocaml-dev libflac-dev \
libxml-dom-perl libxml-dom-xpath-perl patch autoconf libmp3lame-dev \
libcamomile-ocaml-dev libcamlimages-ocaml-dev libtool libpulse-dev camlidl \
libfaad-dev libpcre-ocaml-dev libfftw3-3 dialog
if [ "$code" != "lucid" ]; then
apt-get -y --force-yes install libvo-aacenc-dev
fi
#dpkg -i libopus-dbg_1.0.1~$code~sfo-1_$cpuvalue.deb libopus-dev_1.0.1~$code~sfo-1_$cpuvalue.deb libopus0_1.0.1~$code~sfo-1_$cpuvalue.deb aacplusenc_0.17.5-0.0medibuntu1_$cpuvalue.deb
#for aac+
#rm -rf libaac*
#apt-get -y --force-yes install libfftw3-dev pkg-config autoconf automake libtool unzip
#wget http://217.20.164.161/~tipok/aacplus/libaacplus-2.0.2.tar.gz
#tar -xzf libaacplus-2.0.2.tar.gz
#cd libaacplus-2.0.2
#./autogen.sh --enable-shared --enable-static
#make
#make install
#ldconfig
#cd ..
#end of aac+
rm -rf liquidsoap-full
git clone https://github.com/savonet/liquidsoap-full
cd liquidsoap-full
git checkout master
make init
make update
#tmp
#cd liquidsoap
#git checkout ifdef-encoder
#git merge master
#cd ..
#tmp end
cp PACKAGES.minimal PACKAGES
sed -i "s/#ocaml-portaudio/ocaml-portaudio/g" PACKAGES
sed -i "s/#ocaml-alsa/ocaml-alsa/g" PACKAGES
sed -i "s/#ocaml-pulseaudio/ocaml-pulseaudio/g" PACKAGES
sed -i "s/#ocaml-faad/ocaml-faad/g" PACKAGES
sed -i "s/#ocaml-opus/ocaml-opus/g" PACKAGES
#sed -i "s/#ocaml-aacplus/ocaml-aacplus/g" PACKAGES
#sed -i "s/#ocaml-shine/ocaml-shine/g" PACKAGES
if [ "$code" != "lucid" ]; then
sed -i "s/#ocaml-voaacenc/ocaml-voaacenc/g" PACKAGES
fi
chown -R tmp /liquidsoap-full
chmod -R 777 /liquidsoap-full
sudo -u tmp ./bootstrap
sudo -u tmp ./configure
sudo -u tmp make
cp /liquidsoap-full/liquidsoap/src/liquidsoap /

View file

@ -1,162 +0,0 @@
#!/usr/bin/env bash
exec 2>&1
ROOT_UID="0"
#Check if run as root
if [ "$UID" -ne "$ROOT_UID" ]; then
echo "You must have 'sudo' right to do that!"
exit 1
fi
rm -rf ./liquidsoap-compile_logs
mkdir -p ./liquidsoap-compile_logs
showhelp() {
echo "Usage: run.sh [options] [parameters]
-c all|ubuntu_lucid_32 Compile liquidsoap on all platforms or specified platform.
-b all|ubuntu_lucid_32 Build shroot environments for all platforms or specified platform.
-u username Local username will be used as sudo user of chroot env. Must be assigned before -b options"
exit 0
}
build_env() {
if [ $sudo_user = "-1" ]; then
echo "Please use -u to assign sudo username before build environments."
exit 1
fi
echo "build_env $1"
#exec > >(tee ./liquidsoap_compile_logs/build_env_$1.log)
os=$(echo $1 | awk '/(debian)/')
cpu=$(echo $1 | awk '/(64)/')
dist=$(echo $1 | awk -F "_" '{print $2}')
rm -f /etc/schroot/chroot.d/$1.conf
if cat /etc/passwd | awk -F:'{print $1}' | grep "tmp" > /dev/null 2>&1; then
echo "User tmp exists."
else
useradd tmp
echo "User tmp is created."
fi
apt-get update
apt-get --force-yes -y install debootstrap dchroot
echo [$1] > /etc/schroot/chroot.d/$1.conf
echo description=$1 >> /etc/schroot/chroot.d/$1.conf
echo directory=/srv/chroot/$1 >> /etc/schroot/chroot.d/$1.conf
echo type=directory >> /etc/schroot/chroot.d/$1.conf
echo users=$sudo_user,tmp >> /etc/schroot/chroot.d/$1.conf
echo root-users=$sudo_user >> /etc/schroot/chroot.d/$1.conf
rm -rf /srv/chroot/$1
mkdir -p /srv/chroot/$1
#cp liquidsoap_compile.sh /srv/chroot/$1/
if [ "$os" = "" ]; then
if [ "$cpu" = "" ]; then
echo "debootstrap --variant=buildd --arch=i386 $dist /srv/chroot/$1 http://archive.ubuntu.com/ubuntu/"
debootstrap --variant=buildd --arch=i386 $dist /srv/chroot/$1 http://archive.ubuntu.com/ubuntu/
else
echo "debootstrap --variant=buildd --arch=amd64 $dist /srv/chroot/$1 http://archive.ubuntu.com/ubuntu/"
debootstrap --variant=buildd --arch=amd64 $dist /srv/chroot/$1 http://archive.ubuntu.com/ubuntu/
fi
else
if [ "$cpu" = "" ]; then
echo "debootstrap --variant=buildd --arch=i386 $dist /srv/chroot/$1 http://ftp.debian.com/debian/"
debootstrap --variant=buildd --arch=i386 $dist /srv/chroot/$1 http://ftp.debian.com/debian/
else
echo "debootstrap --variant=buildd --arch=amd64 $dist /srv/chroot/$1 http://ftp.debian.com/debian/"
debootstrap --variant=buildd --arch=amd64 $dist /srv/chroot/$1 http://ftp.debian.com/debian/
fi
fi
}
compile_liq() {
echo "complie_liq $1"
#exec > >(tee ./liquidsoap_compile_logs/compile_liq_$1.log)
binfilename=$(echo $1 | sed -e 's/ubuntu/liquidsoap/g' -e 's/debian/liquidsoap/g' -e 's/32/i386/g' -e 's/64/amd64/g')
rm -f /srv/chroot/$1/liquidsoap-compile.sh
rm -f /srv/chroot/$1/liquidsoap
cp liquidsoap-compile.sh /srv/chroot/$1/
schroot -c $1 -u root -d / -- /liquidsoap-compile.sh
cp /srv/chroot/$1/liquidsoap ./$binfilename
if [ $? = 0 ]; then
echo "$binfilename is generated successfully"
else
mv ./liquidsoap-compile_logs/compile_liq_$1.log ./liquidsoap-compile_logs/fail_to_compile_liq_$1.log
fi
}
os_versions=("ubuntu_lucid_32" "ubuntu_lucid_64" "ubuntu_precise_32" "ubuntu_precise_64" "ubuntu_quantal_32" "ubuntu_quantal_64" "ubuntu_raring_32" "ubuntu_raring_64" "debian_squeeze_32" "debian_squeeze_64" "debian_wheezy_32" "debian_wheezy_64")
num=${#os_versions[@]}
flag=
os=
sudo_user="-1"
if [ x$1 = x ]; then
showhelp
fi
while getopts b:c:u: arg; do
case $arg in
b)
if [ "$OPTARG" = "all" ]; then
echo "Building all platforms on server..."
for i in $(seq 0 $((num - 1))); do
build_env ${os_versions[$i]} | tee ./liquidsoap-compile_logs/build_env_${os_versions[$i]}.log
done
else
flag=1
for i in $(seq 0 $((num - 1))); do
if [ "$OPTARG" = ${os_versions[$i]} ]; then
echo "Building platform: $OPTARG ..."
build_env ${os_versions[$i]} | tee ./liquidsoap-compile_logs/build_env_${os_versions[$i]}.log
flag=0
fi
done
if [ $flag = 1 ]; then
echo "Unsupported Platform from:"
for j in "${os_versions[@]}"; do
echo $j
done
exit 1
fi
fi
;;
c)
if [ "$OPTARG" = "all" ]; then
echo "Compiling liquidsoap for all platforms on server..."
for i in $(seq 0 $((num - 1))); do
compile_liq ${os_versions[$i]} | tee ./liquidsoap-compile_logs/compile_liq_${os_versions[$i]}.log
done
else
flag=1
for i in $(seq 0 $((num - 1))); do
if [ "$OPTARG" = ${os_versions[$i]} ]; then
echo "Compiling liquidsoap for platform: $OPTARG ..."
compile_liq ${os_versions[$i]} | tee ./liquidsoap-compile_logs/compile_liq_${os_versions[$i]}.log
flag=0
fi
done
if [ $flag = 1 ]; then
echo "Unsupported Platform from:"
for k in "${os_versions[@]}"; do
echo $k
done
exit 1
fi
fi
;;
u)
sudo_user="$OPTARG"
echo "sudo_user is set as $sudo_user."
;;
?)
showhelp
;;
esac
done

View file

@ -1,20 +0,0 @@
<?php
function GenerateRandomString($p_len=20, $p_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')
{
$string = '';
for ($i = 0; $i < $p_len; $i++)
{
$pos = mt_rand(0, strlen($p_chars)-1);
$string .= $p_chars{$pos};
}
return $string;
}
$connection = pg_connect("host=localhost dbname=airtime user=airtime password=airtime");
for ($i=0; $i<1000000; $i++){
$md5 = md5($i);
$sql = "INSERT INTO cc_files (gunid, name, artist_name, track_title, album_title) VALUES ('$md5', '".md5($i."salt")."', '".md5($i."salt1")."', '".md5($i."salt2")."', '".md5($i."salt3")."')";
pg_exec($connection, $sql);
}

View file

@ -1,24 +0,0 @@
#!/usr/bin/env bash
# the base url of the bamboo server
baseurl="$1/updateAndBuild.action?buildKey="
#
# Use the REST API to trigger a build
#
# Moves to the 2nd param (first is URL)
shift
# Loop for each build key
while (("$#")); do
#
# Invoke the trigger
#
remoteCall=$baseurl$1
echo "Detected last directory that was committed ... triggering $remoteCall"
/usr/bin/wget --timeout=10 -t1 $remoteCall -O /dev/null
shift
done
exit 0

View file

@ -1,2 +0,0 @@
*.po merge=pofile
*.pot merge=pofile

View file

@ -1,3 +0,0 @@
[merge "pofile"]
name = Gettext merge driver
driver = git merge-po %O %A %B

View file

@ -1,45 +0,0 @@
#!/bin/sh
#
# https://gist.github.com/mezis/1605647
# by Julien Letessier (mezis)
#
# Custom Git merge driver - merges PO files using msgcat(1)
#
# - Install gettext
#
# - Place this script in your PATH
#
# - Add this to your .git/config :
#
# [merge "pofile"]
# name = Gettext merge driver
# driver = git merge-po %O %A %B
#
# - Add this to .gitattributes :
#
# *.po merge=pofile
# *.pot merge=pofile
#
# - When merging branches, conflicts in PO files will be marked with "#-#-#-#"
#
# O=$1
A=$2
B=$3
# Extract the PO header from the current branch (top of file until first empty line)
header=$(mktemp /tmp/merge-po.XXXX)
sed -e '/^$/q' < $A > $header
# Merge files, then repair header
temp=$(mktemp /tmp/merge-po.XXXX)
msgcat -o $temp $A $B
msgcat --use-first -o $A $header $temp
# Clean up
rm $header $temp
# Check for conflicts
conflicts=$(grep -c "#-#" $A)
test $conflicts -gt 0 && exit 1
exit 0

View file

@ -1,37 +0,0 @@
#!/usr/bin/env bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root." 1>&2
exit 1
fi
usage() {
echo "Use --enable <user> or --disable flag. Enable is to set up environment"
echo "for specified user. --disable is to reset it back to pypo user"
}
if [ "$1" = "--enable" ]; then
/etc/init.d/libretime-playout stop
/etc/init.d/libretime-playout start-liquidsoap
user=$2
echo "Changing ownership to user $1"
chmod -R a+rw /var/log/airtime/pypo
chmod a+r /etc/airtime/airtime.conf
chown -Rv $user:$user /var/tmp/airtime/pypo/
chmod -v a+r /etc/airtime/api_client.cfg
elif [ "$1" = "--disable" ]; then
user="pypo"
echo "Changing ownership to user $1"
chmod 644 /etc/airtime/airtime.conf
chown -Rv $user:$user /var/tmp/airtime/pypo/
chmod -v a+r /etc/airtime/api_client.cfg
/etc/init.d/libretime-playout stop-liquidsoap
/etc/init.d/libretime-playout start
else
usage
fi

View file

@ -1,19 +0,0 @@
#! /bin/bash
cd ..
#generate a new .po file
#this will generate a file called messages.po
find legacy -print0 -iname "*.phtml" -o -name "*.php" | xargs xgettext -L php --from-code=UTF-8
find legacy -print0 -iname "*.phtml" -o -name "*.php" | xargs xgettext -L php --from-code=UTF-8 -k --keyword=_pro:1 -d pro --force-po
#merge the new messages from messages.po into each existing .po file
#this will generate new .po files
find ./legacy/locale/ -name "airtime.po" -exec msgmerge -N -U --no-wrap "{}" messages.po \;
find ./legacy/locale/ -name "pro.po" -exec msgmerge -N -U --no-wrap "{}" pro.po \;
#delete the old .po files
find ./legacy/locale/ -name "*.po~" -delete
#delete the temporary po files we create in the root directory
rm ./*.po