Ticket #4815: [Proposal] Run script (bash) for FreeCAD

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Ticket #4815: [Proposal] Run script (bash) for FreeCAD

Post by Kunda1 »

Discussion thread for issue #4815: [Proposal] Run script (bash) for FreeCAD
mcgiwer wrote: Hello. I had wrote a script in bash that (after placing in the same folder as for example bin) would allow to launch FreeCAD directly from it and with creates a log file.

I hope that it becomes included to the base FreeCAD. I also hope to recieve a upload permission on GitHub to be able to contribute as well.

Code: Select all

#!/bin/bash

#########################
# Fix for the XCB issue #
#########################

sudo xhost +si:localuser:${USER}
export DISPLAY=:0

######################
# End of the XCB fix #
######################

## Supportive function to get app directory

function getpwd
{
    lnk="$(readlink -f $0)"
    ln="$(basename ${lnk})"
    ls=${#ln}

    ((ls=${ls}+1))
    ((ls=-${ls}))

    echo ${lnk::$ls}
}

## End of function


## Get the root folder

root="$(gwtpwd)"

# Create the link to the user home dir

if [ ! -d "${HOME}/.FreeCAD" -o ! -h "${HOME}/.FreeCAD" ]; then ln -vfs ${root} ${HOME}/.FreeCAD; fi

################################################################
#  TODO: Automatical discovery of the avaliable Python version #
################################################################

export PYTHONHOME=${root}

# Qt

export QT_XKB_CONFIG_ROOT=${LD_LIBRARY_PATH}:${root}/lib
# export QT_QPA_PLATFORM_PLUGIN_PATH=plugins
# export QTWEBENGINEPROCESS_PATH=libexec/QtWebEngineProcess

# Support for launching other applications from /usr/bin ( https://github.com/FreeCAD/FreeCAD-AppImage/issues/30)

if [ ! -z "$1" ] && [ -e "bin/$1" ] ; then
    MAIN="bin/$1" ; shift
else
    MAIN="bin/freecad"
fi

nice -n19 ${MAIN} "$@" &> ${root}/freecad.log &

Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Ticket #4815: [Proposal] Run script (bash) for FreeCAD

Post by Kunda1 »

bump
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Ticket #4815: [Proposal] Run script (bash) for FreeCAD

Post by Kunda1 »

Can the community weigh in on this?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
flachyjoe
Veteran
Posts: 1869
Joined: Sat Mar 31, 2012 12:00 pm
Location: Limoges, France

Re: Ticket #4815: [Proposal] Run script (bash) for FreeCAD

Post by flachyjoe »

I don't understand what is this script for.
It seems only run freecad with a modified nice value (useless in most case, user based niceness is good) and write a log.
freecad can already and properly save a log with -l [ --write-log ] or --log-file arguments
See

Code: Select all

freecad --help
- Flachy Joe -
Image
Post Reply