594e1d9812
Fixed a bug that caused the host to not respond to any commands when a module is present. CmdExecutor::loadMods() had a malformed 'for' loop that caused the command executor to infinite loop. Also re-formed the way the external command loaders (modules) are constructed. Instead, the modules are also intialized at the same time as the internal command loader. The CmdExecutor::loadModFile() and CmdExecutor::unloadModFile() functions now load and unload modules via the module name instead of the path to the module main file. The documentation for ASYNC_ENABLE_MOD and ASYNC_DISABLE_MOD updated to reflect this change. Also part of the module contruction re-form, it fixed a bug that caused the command loaders to operate in a thread different from the command executor. CmdExecutor::loadMods() was refactored into cmdExecutor::buildCmdLoaders(), added the internal command loader to it and have it so this function gets called only when the command executor successfully moves to it's own thread. Fixed a bug that caused the session to crash only when a module is present. It turns out the qobject_cast() function used in CmdExecutor::loadModFile() only pulled the surface class ModCommandLoader so any attempt to access the base class functions from CommandLoader caused the session to crash so to fix this, ModCommandLoader was merged into CommandLoader. The Command loader documentation and test module were updated to reflect this change. Fixed a bug that auto removed any modules that were installed when the host is restarted. The issue was in TCPServer::syncModPath() that used the modules's main file without a suffix when the file did indeed have a suffix, causing the function to think the module no longer exists and remove all of it's files from the host file system. The original intent for this function was to keep the module database table in sync with what was actually in the host file system. It was decided that this is not necessary so the function was removed altogether. Also changed up the way the module files are deleted. The TCPSever class will now use the module name instead of the path to the module's main library file and will use a single use ModDeleteTimer for each module that was requested to be deleted instead of a single continuous timer constantly checking for modules to delete. The ls_cmds command will now list the commands in alphabetical order of the command names and fixed a bug with the -find option that would display nothing if an exact match to any text in the table could not be found. Fixed a bug found in the deployed application that would segmentation fault on startup due to certain library files being included in the deployed installation directory. Updated the linux_build.sh script to include only libsqlite, libQT5, libssl and libicu files. It will no longer blindly copy all library files from the dev machine and then remove files the setup script thinks the application might or might not need. Any module built on import rev1 will simply not work and no attempt will be made to make it work so the host new minimum import rev is now rev2. this update is mustly just bug fixes; nothing that would require any client behaviour changes so just the host patch is bumped. 1.0.0 --> 1.0.1
127 lines
4.3 KiB
Bash
127 lines
4.3 KiB
Bash
#!/bin/sh
|
|
|
|
qt_dir="$1"
|
|
installer_file="$2"
|
|
|
|
src_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
bin_name="mrci"
|
|
app_version="1.0.0"
|
|
app_name="MRCI"
|
|
install_dir="/opt/$bin_name"
|
|
bin_dir="/usr/bin"
|
|
tmp_dir="$HOME/.cache/mrci_build"
|
|
user="$USER"
|
|
|
|
if [ "$qt_dir" != "" ]; then
|
|
|
|
PATH=$qt_dir:$PATH
|
|
|
|
fi
|
|
|
|
if [ "$installer_file" = "" ]; then
|
|
|
|
installer_file="$src_dir/$bin_name-$app_version.run"
|
|
|
|
fi
|
|
|
|
if [ -d "$tmp_dir" ]; then
|
|
|
|
rm -rfv $tmp_dir
|
|
|
|
fi
|
|
|
|
mkdir -vp $tmp_dir
|
|
cp -rv $src_dir/. $tmp_dir
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
cd $tmp_dir
|
|
|
|
qmake -config release
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
make
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
mkdir -v ./build/
|
|
mkdir -v ./build/sqldrivers
|
|
mkdir -v ./build/lib
|
|
ldd ./$bin_name | grep "libQt" | awk '{print $3}' | xargs -I '{}' cp -v '{}' ./build/lib
|
|
ldd ./$bin_name | grep "libicu" | awk '{print $3}' | xargs -I '{}' cp -v '{}' ./build/lib
|
|
ldd ./$bin_name | grep "libssl" | awk '{print $3}' | xargs -I '{}' cp -v '{}' ./build/lib
|
|
ldd ./$bin_name | grep "libcrypto" | awk '{print $3}' | xargs -I '{}' cp -v '{}' ./build/lib
|
|
mv -v ./$bin_name ./build/$bin_name
|
|
cp -v $qt_dir/../plugins/sqldrivers/libqsqlite.so ./build/sqldrivers
|
|
|
|
startup_script="./build/$bin_name.sh"
|
|
setup_script="./build/setup.sh"
|
|
uninstall_script="./build/uninstall.sh"
|
|
service_file="./build/$bin_name.service"
|
|
|
|
echo "#!/bin/sh" > $startup_script
|
|
echo "export LD_LIBRARY_PATH=$install_dir/lib" >> $startup_script
|
|
echo "$install_dir/$bin_name \$1 \$2 \$3 \$4 \$5 \$6 \$7 \$8 \$9 \$10" >> $startup_script
|
|
|
|
echo "#!/bin/sh" > $setup_script
|
|
echo "if [ -f \"$install_dir/uninstall.sh\" ]; then" >> $setup_script
|
|
echo " sh $install_dir/uninstall.sh" >> $setup_script
|
|
echo "fi" >> $setup_script
|
|
echo "if [ ! -d \"$install_dir\" ]; then" >> $setup_script
|
|
echo " sudo mkdir -p $install_dir" >> $setup_script
|
|
echo "fi" >> $setup_script
|
|
echo "sudo cp -rfv ./lib $install_dir" >> $setup_script
|
|
echo "sudo cp -rfv ./sqldrivers $install_dir" >> $setup_script
|
|
echo "sudo cp -fv ./$bin_name $install_dir" >> $setup_script
|
|
echo "sudo cp -fv ./$bin_name.sh $install_dir" >> $setup_script
|
|
echo "sudo cp -fv ./uninstall.sh $install_dir" >> $setup_script
|
|
echo "sudo cp -fv ./$bin_name.service /etc/systemd/system/$bin_name@$USER.service" >> $setup_script
|
|
echo "sudo chmod 755 $install_dir/$bin_name" >> $setup_script
|
|
echo "sudo chmod 755 $install_dir/$bin_name.sh" >> $setup_script
|
|
echo "sudo chmod 755 $install_dir/uninstall.sh" >> $setup_script
|
|
echo "sudo chmod 755 $install_dir" >> $setup_script
|
|
echo "sudo chmod -R 755 $install_dir/lib" >> $setup_script
|
|
echo "sudo chmod -R 755 $install_dir/sqldrivers" >> $setup_script
|
|
echo "sudo chmod 755 /etc/systemd/system/$bin_name@$USER.service" >> $setup_script
|
|
echo "sudo ln -sf $install_dir/$bin_name.sh $bin_dir/$bin_name" >> $setup_script
|
|
echo "sudo systemctl start $bin_name@$USER" >> $setup_script
|
|
echo "sudo systemctl enable $bin_name@$USER" >> $setup_script
|
|
echo "echo \"\nInstallation finished. If you ever need to uninstall this application, run this command:\n\"" >> $setup_script
|
|
echo "echo \" sh $install_dir/uninstall.sh\n\"" >> $setup_script
|
|
|
|
echo "[Unit]" > $service_file
|
|
echo "Description=$app_name host" >> $service_file
|
|
echo "After=network.target" >> $service_file
|
|
echo "" >> $service_file
|
|
echo "[Service]" >> $service_file
|
|
echo "Type=simple" >> $service_file
|
|
echo "User=%i" >> $service_file
|
|
echo "ExecStart=/usr/bin/env $bin_name -host" >> $service_file
|
|
echo "" >> $service_file
|
|
echo "[Install]" >> $service_file
|
|
echo "WantedBy=multi-user.target" >> $service_file
|
|
|
|
echo "#!/bin/sh" > $uninstall_script
|
|
echo "sudo systemctl -q stop $bin_name@$USER" >> $uninstall_script
|
|
echo "sudo systemctl -q disable $bin_name@$USER" >> $uninstall_script
|
|
echo "sudo rm -v /etc/systemd/system/$bin_name@$USER.service" >> $uninstall_script
|
|
echo "sudo rm -v $bin_dir/$bin_name" >> $uninstall_script
|
|
echo "sudo rm -rv $install_dir" >> $uninstall_script
|
|
|
|
chmod +x $setup_script
|
|
|
|
makeself ./build $installer_file "$app_name Installation" ./setup.sh
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ -d "$tmp_dir" ]; then
|
|
|
|
rm -rf $tmp_dir
|
|
|
|
fi
|