Skip to content

Instantly share code, notes, and snippets.

@koter84
Last active November 7, 2024 11:48
Show Gist options
  • Save koter84/7422bd8462bba5ee7b57c1c73f95e624 to your computer and use it in GitHub Desktop.
Save koter84/7422bd8462bba5ee7b57c1c73f95e624 to your computer and use it in GitHub Desktop.
updater for fwbuilder
#!/bin/bash
if [ -d /opt/fwbuilder-5.1.0.3599 ]
then
echo "removing deprecated version"
rm -rf /opt/fwbuilder-5.1.0.3599
fi
if [ ! -d /opt/fwbuilder/build ]
then
echo "New Installation! (no old version found)"
new_install="1"
mkdir -p /opt/fwbuilder/build
cd /opt/fwbuilder
git clone [email protected]:fwbuilder/fwbuilder.git
fi
cd /opt/fwbuilder/fwbuilder
## hmm - fix indentation
sed s/' QDialog::accept'/' QDialog::accept'/ src/libgui/ObjConflictResolutionDialog.cpp
sed s/' QDialog::reject'/' QDialog::reject'/ src/libgui/ObjConflictResolutionDialog.cpp
git remote update
if [ "$(git rev-parse HEAD)" != "$(git rev-parse @{u})" ]
then
echo "> files have changed, rebuild"
new_pull="TRUE"
git pull
fi
installed_version=""
if [ "$(which fwbuilder 2>/dev/null)" != "" ]
then
installed_version=$(fwbuilder -v|tail -n1)
fi
git_version=$(git describe --tags --always)
git_version_short=$(git describe --tags --always|cut -d- -f1)
if [ "$installed_version" == "" ]
then
if [ "$new_install" != "1" ]
then
echo "New Installation! (no old version found)"
new_install="1"
fi
elif [ "v$installed_version" == "$git_version" ]
then
echo "installed_version: v$installed_version"
echo "git_version: $git_version"
elif [ "v$installed_version" == "$git_version_short" ]
then
echo "installed_version: v$installed_version"
echo "git_version: $git_version"
echo "git_version_short: $git_version_short"
else
echo "installed_version: $installed_version"
echo "git_version: $git_version"
fi
if [ "$installed_version" == "$git_version" ] || [ "v$installed_version" == "$git_version" ] || [ "v$installed_version" == "$git_version_short" ]
then
read -p "run full-rebuild? [y/N] " run_rebuild
if [ "$run_rebuild" == "y" ] || [ "$run_rebuild" == "Y" ]
then
new_install="1"
else
if [ "$new_pull" != "TRUE" ]
then
exit
fi
fi
fi
if [ "$new_install" != "1" ]
then
echo "New Version Found!"
read -p "run autogen? [y/N] " run_autogen
else
run_autogen="Y"
fi
cd /opt/fwbuilder/build
# compile without warnings-as-errors setting
for file in $(grep -rl 'Werror' /opt/fwbuilder/fwbuilder/)
do
echo "file: ${file}"
sed -i -e s/' -Werror'// -e s/';-Werror'// "${file}"
done
if [ "$run_autogen" == "y" ] || [ "$run_autogen" == "Y" ]
then
sudo dnf install automake autoconf cmake libxml2-devel libtool libxslt-devel net-snmp-devel qt qt-devel qt-x11 qt5-qtbase-devel
make clean
cmake ../fwbuilder
fi
make
result=$?
if [ $result == 0 ]
then
sudo make install
else
echo "build failed! go to /opt/fwbuilder/ and try to fix the build."
echo "after building run 'sudo make install' to install fwbuilder"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment