<commit_before>VERSION=2.0.2

# amd64 or i386
ARCH=$1

echo -n "Cleaning... "
rm -rf build
rm -rf dist
rm -rf packages
echo "Done."

echo "Generating bundles... "
pyinstaller OmniDB.spec
echo "Done."

echo -n "Organizing bundles..."
rm -rf build
mkdir packages
cp dist/omnidb-config/omnidb-config dist/omnidb-server/omnidb-config-server
cp dist/omnidb-config/omnidb-config dist/omnidb-app/omnidb-config-app
mv dist/omnidb-server packages
mv dist/omnidb-app packages
rm -rf dist
echo "Done."

echo -n "Copying cefpython files... "
cp -r "/usr/local/lib/python$(python3 --version | cut -d' ' -f2 | cut -d'.' -f1).$(python3 --version | cut -d' ' -f2 | cut -d'.' -f2)/dist-packages/cefpython3" packages/omnidb-app/
echo "Done."

echo -n "Copying libgconf... "
if [ $ARCH == "amd64" ]
then
	cp /usr/lib/x86_64-linux-gnu/libgconf-2.so.4 packages/omnidb-app/libgconf-2.so.4
	cp /usr/lib/x86_64-linux-gnu/libgconf-2.so.4 packages/omnidb-app/cefpython3/libgconf-2.so.4
else
	cp /usr/lib/i386-linux-gnu/libgconf-2.so.4 packages/omnidb-app/libgconf-2.so.4
	cp /usr/lib/i386-linux-gnu/libgconf-2.so.4 packages/omnidb-app/cefpython3/libgconf-2.so.4
fi
chmod 755 packages/omnidb-app/libgconf-2.so.4
chmod 755 packages/omnidb-app/cefpython3/libgconf-2.so.4
echo "Done."

echo -n "Copying libxcb... "
if [ $ARCH == "amd64" ]
then
	cp /usr/lib/x86_64-linux-gnu/libxcb.so.1 packages/omnidb-app/libxcb.so.1
	cp /usr/lib/x86_64-linux-gnu/libxcb.so.1 packages/omnidb-app/cefpython3/libxcb.so.1
else
	cp /usr/lib/i386-linux-gnu/libxcb.so.1 packages/omnidb-app/libxcb.so.1
	cp /usr/lib/i386-linux-gnu/libxcb.so.1 packages/omnidb-app/cefpython3/libxcb.so.1
fi
chmod 755 packages/omnidb-app/libxcb.so.1
chmod 755 packages/omnidb-app/cefpython3/libxcb.so.1
echo "Done."

echo -n "Renaming bundles... "
mv packages/omnidb-server packages/omnidb-server_$VERSION-$ARCH
mv packages/omnidb-app packages/omnidb-app_$VERSION-$ARCH<commit_msg>Included libXss in deployment<commit_after>VERSION=2.0.2

# amd64 or i386
ARCH=$1

echo -n "Cleaning... "
rm -rf build
rm -rf dist
rm -rf packages
echo "Done."

echo "Generating bundles... "
pyinstaller OmniDB.spec
echo "Done."

echo -n "Organizing bundles..."
rm -rf build
mkdir packages
cp dist/omnidb-config/omnidb-config dist/omnidb-server/omnidb-config-server
cp dist/omnidb-config/omnidb-config dist/omnidb-app/omnidb-config-app
mv dist/omnidb-server packages
mv dist/omnidb-app packages
rm -rf dist
echo "Done."

echo -n "Copying cefpython files... "
cp -r "/usr/local/lib/python$(python3 --version | cut -d' ' -f2 | cut -d'.' -f1).$(python3 --version | cut -d' ' -f2 | cut -d'.' -f2)/dist-packages/cefpython3" packages/omnidb-app/
echo "Done."

echo -n "Copying libgconf... "
if [ $ARCH == "amd64" ]
then
	cp /usr/lib/x86_64-linux-gnu/libgconf-2.so.4 packages/omnidb-app/libgconf-2.so.4
	cp /usr/lib/x86_64-linux-gnu/libgconf-2.so.4 packages/omnidb-app/cefpython3/libgconf-2.so.4
else
	cp /usr/lib/i386-linux-gnu/libgconf-2.so.4 packages/omnidb-app/libgconf-2.so.4
	cp /usr/lib/i386-linux-gnu/libgconf-2.so.4 packages/omnidb-app/cefpython3/libgconf-2.so.4
fi
chmod 755 packages/omnidb-app/libgconf-2.so.4
chmod 755 packages/omnidb-app/cefpython3/libgconf-2.so.4
echo "Done."

echo -n "Copying libxcb... "
if [ $ARCH == "amd64" ]
then
	cp /usr/lib/x86_64-linux-gnu/libxcb.so.1 packages/omnidb-app/libxcb.so.1
	cp /usr/lib/x86_64-linux-gnu/libxcb.so.1 packages/omnidb-app/cefpython3/libxcb.so.1
else
	cp /usr/lib/i386-linux-gnu/libxcb.so.1 packages/omnidb-app/libxcb.so.1
	cp /usr/lib/i386-linux-gnu/libxcb.so.1 packages/omnidb-app/cefpython3/libxcb.so.1
fi
chmod 755 packages/omnidb-app/libxcb.so.1
chmod 755 packages/omnidb-app/cefpython3/libxcb.so.1
echo "Done."

echo -n "Copying libXss... "
if [ $ARCH == "amd64" ]
then
	cp /usr/lib/x86_64-linux-gnu/libXss.so.1 packages/omnidb-app/libXss.so.1
	cp /usr/lib/x86_64-linux-gnu/libXss.so.1 packages/omnidb-app/cefpython3/libXss.so.1
else
	cp /usr/lib/i386-linux-gnu/libXss.so.1 packages/omnidb-app/libXss.so.1
	cp /usr/lib/i386-linux-gnu/libXss.so.1 packages/omnidb-app/cefpython3/libXss.so.1
fi
chmod 755 packages/omnidb-app/libXss.so.1
chmod 755 packages/omnidb-app/cefpython3/libXss.so.1
echo "Done."

echo -n "Renaming bundles... "
mv packages/omnidb-server packages/omnidb-server_$VERSION-$ARCH
mv packages/omnidb-app packages/omnidb-app_$VERSION-$ARCH
{'fraction_non_alphanumeric': 0.1621559102475133, 'fraction_numerical': 0.052509831135785334, 'mean_word_length': 3.5372507869884573, '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': '3256003', 'n_tokens_mistral': 2074, 'n_tokens_neox': 1992, 'n_words': 326}