Open sergiymaksymenko opened 2 years ago
The script was made to be run like ./scripts/build.sh
(as seen in the readme)
would it be possible to change the build script so that both cd scripts && ./build.sh
and ./scripts/build.sh
work?
Hi, thank you for the message, yes, it is better to change script than the README. We can change the function as follows:
build_deb() {
# https://www.devdungeon.com/content/debian-package-tutorial-dpkgdeb
# that was really easy actually
cd ..
baseDir=$(pwd)
scriptsDir=${baseDir}/scripts # scripts/
buildDir=${scriptsDir}/build # scripts/build/
debDir=${buildDir}/deb # scripts/build/deb
distDir=${baseDir}/dist # dist/
rm ${buildDir} -r
mkdir ${debDir} -p
python3 ${baseDir}/setup.py install --root=${debDir}
mv ${debDir}/usr/local/lib/python3.*/ ${debDir}/usr/lib/python3/
cp ${baseDir}/DEBIAN ${debDir}/ -r
mkdir ${distDir} -p
rm ${distDir}/input-remapper-1.5.0.deb || true
dpkg -b ${debDir} ${distDir}/input-remapper-1.5.0.deb
}
Now it works as required by cd scripts && ./build.sh
.
It explicitly substitutes all full paths, and therefore it should work on all distributions.
Also the command
mv ${debDir}/usr/local/lib/python3.*/ ${debDir}/usr/lib/python3/
assumes that python3 installs everything into usr/local/lib/
and the program require for python3 to be installed into usr/lib/
.
I think something like a check
# ensure we are in the root directory of the project
if [ ! -f "./setup.py" ]; then
cd ..
fi
would make it flexible and avoid problems.
Could you please test it and make a PR for this? And please add "_all" to the two occurrences of the output filename, like input-remapper-1.5.0_all.deb
, to address https://github.com/sezanzeb/input-remapper/issues/480
Build script
scripts/buiild.sh
is not working on my Linux MX 21 (Debian GNU/Linux 11, bullseye). The reason is that it does not finds correct paths. If we change it as follows:then creating deb-package can be run by the command:
cd input-remapper/scripts/ && ./build.sh