File PKGBUILD of Package firetools-linphone-desktop
# Fix for error: bsdtar: Failed to set default locale
# LANG=en_US.UTF-8 # not available, use C or POSIX
LANG=C
LC_ALL=${LANG}
# Get some information about the machine we are building on:
_numberOfProcessorsOnMachine=$(nproc)
_wantedJobs=$(echo "1.1*${_numberOfProcessorsOnMachine}" | bc -l)
_jobsIget=$(echo ${_wantedJobs} | awk '{print int($1+0.5)}')
_TOTAL_DISK=$(df -h --total | awk 'END{print $2}')
_FREEMEM=$(free --mega)
_TOTAL_MEM=$(free --total --mega | xargs | awk '{print $19"MB"}')
_TOTAL_RAM=$(free --total --mega | xargs | awk '{print $8"MB"}')
_TOTAL_SWAP=$(free --total --mega | xargs | awk '{print $15"MB"}')
pkgname=firetools-linphone-desktop
pkgver=0.0.0
pkgrel=1
pkgdesc='firetools add linphone app to uiapps'
arch=('any')
url='http://to.be.def'
license=(GPL)
depends=()
optdepends=('firetools: firejail sandbox GUI')
makedepends=('coreutils' 'procps-ng' 'bc')
#source=("dummy.tar.xz")
#sha512sums=('SKIP')
options=()
_uploaddir=/usr/src/packages/SOURCES
_sourcedir=/usr/src/packages/BUILD/${pkgname}/src/${pkgname}-${pkgver}
# srcdir is already defined as
# ${srcdir}=/usr/src/packages/BUILD/${pkgname}/src
_builddir=/usr/src/packages/BUILD/${pkgname}/build
_pkgdir=/usr/src/packages/BUILD/${pkgname}/pkg/${pkgname}
build() {
echo "--- Machine data we are building on ---"
echo "Total disk: $_TOTAL_DISK"
echo "Output of free -h:"
echo "$_FREEMEM"
echo "Total memory: $_TOTAL_MEM"
echo "Total RAM: $_TOTAL_RAM"
echo "Total SWAP: $_TOTAL_SWAP"
echo "_numberOfProcessorsOnMachine=$_numberOfProcessorsOnMachine"
echo "_wantedJobs=$_wantedJobs"
echo "_jobsIget=$_jobsIget"
echo "--- End machine data we are building on ---"
}
package() {
mkdir -p "$pkgdir/usr/local/bin"
# Create a script to add linphone app to firetools uiapps
# Create script in /usr/local/bin/firetools-linphone-add
scriptFile="${pkgdir}/usr/local/bin/firetools-linphone-add"
uiappsFile="\$HOME/.config/firetools/uiapps"
echo "#!/usr/bin/bash" > $scriptFile
echo >> $scriptFile
echo "if [ ! -f \"${uiappsFile}\" ]; then" >> $scriptFile
echo "cat <<EOF > \"${uiappsFile}\"" >> $scriptFile
echo "# Program list for Firetools" >> $scriptFile
echo "#" >> $scriptFile
echo "# Each line defines an application, with semicolons separated fields as follows:" >> $scriptFile
echo "#" >> $scriptFile
echo "# executable; description; icon; (optional) command for starting Firejail" >> $scriptFile
echo "#" >> $scriptFile
echo "# Examples:" >> $scriptFile
echo "#" >> $scriptFile
echo "# inkscape;Inkscape SVG Editor;inkscape" >> $scriptFile
echo "# calibre;Calibre eBook Reader;/usr/share/calibre/images/lt.png" >> $scriptFile
echo "#" >> $scriptFile
echo "# Lines starting in # are comments." >> $scriptFile
echo "#" >> $scriptFile
echo >> $scriptFile
echo "# Missing Firetools apps" >> $scriptFile
echo >> $scriptFile
echo "EOF" >> $scriptFile
echo "else" >> $scriptFile
echo "echo \"\\\"${uiappsFile}\\\" exists\"" >> $scriptFile
echo "fi" >> $scriptFile
echo "echo \"linphone;Linphone;linphone\" >> \"${uiappsFile}\"" >> $scriptFile
echo "echo \"/opt/appimages/linphone.AppImage;Linphone AppImage;linphone-appimage;firejail --appimage --profile=/etc/firejail/linphone.profile /opt/appimages/linphone.AppImage\" >> \"${uiappsFile}\"" >> $scriptFile
echo "echo \"/opt/linphone/linphone-launcher;Linphone /opt/linphone/linphone-launcher;linphone-desktop;firejail --profile=/etc/firejail/linphone.profile /opt/linphone/linphone-launcher\" >> \"${uiappsFile}\"" >> $scriptFile
echo >> $scriptFile
echo "echo" >> $scriptFile
echo "echo \"cat \\\"${uiappsFile}\\\"\"" >> $scriptFile
echo "echo" >> $scriptFile
echo "cat \"${uiappsFile}\"" >> $scriptFile
echo "echo" >> $scriptFile
echo "echo" >> $scriptFile
echo "echo \"added linphone to Firetools apps to \\\"${uiappsFile}\\\"\"" >> $scriptFile
echo "echo" >> $scriptFile
echo "echo \"if you wish to remove \\\"${uiappsFile}\\\" copy and paste the following command followed by pressing ENTER:\"" >> $scriptFile
echo "echo \" rm -f \\\"${uiappsFile}\\\"\"" >> $scriptFile
echo "echo" >> $scriptFile
echo "echo \"if you wish to edit \\\"${uiappsFile}\\\" copy and paste the following command followed by pressing ENTER:\"" >> $scriptFile
echo "echo \" xdg-open \\\"${uiappsFile}\\\"\"" >> $scriptFile
echo "echo" >> $scriptFile
echo "echo \"Done.\"" >> $scriptFile
echo "exit 0" >> $scriptFile
# Make script executable
chmod +x "$scriptFile"
echo "--- Start list files that will be packaged ---"
find ${pkgdir} | sed "s|${pkgdir}||g"
echo "--- End list files that will be packaged ---"
}