Updaten NIX build scripts
This commit is contained in:
parent
9ef1732d78
commit
15be531bf9
217
build_install.sh
217
build_install.sh
|
@ -9,61 +9,65 @@ cd "$docdir"
|
|||
|
||||
# Check cmake availability
|
||||
if [[ $(which cmake) =~ ^/ ]]
|
||||
then
|
||||
$()
|
||||
else
|
||||
echo "Error: Cmake is not installed"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
$()
|
||||
else
|
||||
echo "Error: Cmake is not installed"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check the existence of a previous executable file
|
||||
if [ -e /usr/bin/logdoctor ]
|
||||
then
|
||||
while true;
|
||||
do
|
||||
echo "Warning: the file /usr/bin/logdoctor already exists"
|
||||
printf "If you choose to continue, the actual file will be overwritten\nContinue? [y/n] : "
|
||||
read agree
|
||||
case "$agree"
|
||||
in
|
||||
"y" | "Y")
|
||||
printf "\n"
|
||||
break
|
||||
;;
|
||||
*)
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
then
|
||||
while true;
|
||||
do
|
||||
echo "Warning: the file /usr/bin/logdoctor already exists"
|
||||
printf "If you choose to continue, the actual file will be overwritten\nContinue? [y/n] : "
|
||||
read agree
|
||||
case "$agree"
|
||||
in
|
||||
"y" | "Y")
|
||||
printf "\n"
|
||||
break
|
||||
;;
|
||||
*)
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
# Start the compilation process
|
||||
echo "Starting compilation process"
|
||||
|
||||
# Make a build folder
|
||||
if [ -d build ]
|
||||
then
|
||||
rm -r build
|
||||
fi
|
||||
mkdir build && cd build
|
||||
|
||||
# Prepare the cmake files
|
||||
cmake ../logdoctor -DCMAKE_BUILD_TYPE=MinSizeRel
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
# an error occured during preparation
|
||||
echo "Error: failed to prepare cmake files"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
# an error occured during preparation
|
||||
echo "Error: failed to prepare cmake files"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Build the project
|
||||
cmake --build ./ --target all
|
||||
if [[ "$?" == "0" ]]
|
||||
then
|
||||
# compiled succesfully
|
||||
echo "Done compiling"
|
||||
mv LogDoctor logdoctor
|
||||
else
|
||||
# an error occured during compilation
|
||||
echo "Error: failed to compile"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
# compiled succesfully
|
||||
echo "Done compiling"
|
||||
mv LogDoctor logdoctor
|
||||
else
|
||||
# an error occured during compilation
|
||||
echo "Error: failed to compile"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Compilation finished
|
||||
wait
|
||||
|
@ -74,90 +78,91 @@ echo "Starting installation process"
|
|||
cd ../installation_stuff/
|
||||
|
||||
if [ -e ~/.config/LogDoctor ]
|
||||
then
|
||||
if [ -e ~/.config/LogDoctor/logdoctor.conf ]
|
||||
then
|
||||
if [ -e ~/.config/LogDoctor/logdoctor.conf ]
|
||||
then
|
||||
# A configuration file already exists
|
||||
while true;
|
||||
do
|
||||
echo "Warning: a configuration file already exists"
|
||||
printf "If you choose 'YES' the current file will be overwritten\nIf you choose 'NO' the current file will be kept\nOverwrite? [y/n] : "
|
||||
read agree
|
||||
case "$agree"
|
||||
in
|
||||
"y" | "Y")
|
||||
printf "\n"
|
||||
cp --no-preserve=all ./logdoctor.conf ~/.config/LogDoctor/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
# an error occured during compilation
|
||||
echo "Error: failed to copy configuration file"
|
||||
exit
|
||||
fi
|
||||
break
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
else
|
||||
mkdir -p ~/.config/LogDoctor
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to create directory: ~/.config/LogDoctor"
|
||||
exit
|
||||
fi
|
||||
cp --no-preserve=all ./logdoctor.conf ~/.config/LogDoctor/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy configuration file"
|
||||
exit
|
||||
fi
|
||||
# A configuration file already exists
|
||||
while true;
|
||||
do
|
||||
echo "Warning: a configuration file already exists"
|
||||
printf "If you choose 'YES' the current file will be overwritten\nIf you choose 'NO' the current file will be kept\nOverwrite? [y/n] : "
|
||||
read agree
|
||||
case "$agree"
|
||||
in
|
||||
"y" | "Y")
|
||||
printf "\n"
|
||||
cp --no-preserve=all ./logdoctor.conf ~/.config/LogDoctor/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
# an error occured during compilation
|
||||
echo "Error: failed to copy configuration file"
|
||||
exit
|
||||
fi
|
||||
break
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
else
|
||||
mkdir -p ~/.config/LogDoctor
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to create directory: ~/.config/LogDoctor"
|
||||
exit
|
||||
fi
|
||||
cp --no-preserve=all ./logdoctor.conf ~/.config/LogDoctor/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy configuration file"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -e ~/.local/share/LogDoctor ]
|
||||
else
|
||||
mkdir -p ~/.local/share/LogDoctor
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to create directory: ~/.local/share/LogDoctor"
|
||||
exit
|
||||
fi
|
||||
cp -r --no-preserve=all ./logdocdata/* ~/.local/share/LogDoctor/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
mkdir -p ~/.local/share/LogDoctor
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy LogDoctor's data"
|
||||
echo "Error: failed to create directory: ~/.local/share/LogDoctor"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
cp -r --no-preserve=all ./logdocdata/* ~/.local/share/LogDoctor/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy LogDoctor's data"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
cp --no-preserve=all ./LogDoctor.desktop ~/.local/share/applications/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to create a menu entry"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
cp --no-preserve=all ./logdoctor ./logdoctor.copy
|
||||
chmod 755 ./logdoctor.copy
|
||||
sudo mv ./logdoctor.copy /usr/bin/logdoctor
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy the executable"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
echo "Error: failed to create a menu entry"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
sudo cp --no-preserve=all ./logdoctor.svg /usr/share/icons
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy LogDoctor's icon"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
echo "Error: failed to copy LogDoctor's icon"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
cd ../build
|
||||
chmod 755 ./logdoctor
|
||||
sudo mv ./logdoctor /usr/bin/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy the executable"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
# Installation finished
|
||||
|
|
|
@ -9,19 +9,19 @@ cd "$docdir"
|
|||
|
||||
# Check cmake availability
|
||||
if [[ $(which cmake) =~ ^/ ]]
|
||||
then
|
||||
$()
|
||||
else
|
||||
echo "Error: Cmake is not installed"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
$()
|
||||
else
|
||||
echo "Error: Cmake is not installed"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check the existence of a previous executable file
|
||||
if [ ! -e /usr/bin/logdoctor ]
|
||||
then
|
||||
echo "Warning: no previous installation detected, please run the installation script instead"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
echo "Warning: no previous installation detected, please run the installation script instead"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Start the compilation process
|
||||
echo "Starting compilation process"
|
||||
|
@ -32,24 +32,23 @@ mkdir build && cd build
|
|||
# Prepare the cmake files
|
||||
cmake ../logdoctor -DCMAKE_BUILD_TYPE=MinSizeRel
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
# an error occured during preparation
|
||||
echo "Error: failed to prepare cmake files"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
# an error occured during preparation
|
||||
echo "Error: failed to prepare cmake files"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Build the project
|
||||
cmake --build ./ --target all
|
||||
if [[ "$?" == "0" ]]
|
||||
then
|
||||
# compiled succesfully
|
||||
echo "Done compiling"
|
||||
mv LogDoctor logdoctor
|
||||
else
|
||||
# an error occured during compilation
|
||||
echo "Error: failed to compile"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
# compiled succesfully
|
||||
mv LogDoctor logdoctor
|
||||
else
|
||||
# an error occured during compilation
|
||||
echo "Error: failed to compile"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Compilation finished
|
||||
wait
|
||||
|
@ -61,46 +60,46 @@ cd ../installation_stuff/
|
|||
|
||||
|
||||
if [ ! -e ~/.local/share/LogDoctor ]
|
||||
then
|
||||
mkdir -p ~/.local/share/LogDoctor
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
mkdir -p ~/.local/share/LogDoctor
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to create directory: ~/.local/share/LogDoctor"
|
||||
exit
|
||||
fi
|
||||
cp -r --no-preserve=all ./logdocdata/* ~/.local/share/LogDoctor/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy LogDoctor's data"
|
||||
echo "Error: failed to create directory: ~/.local/share/LogDoctor"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
cp -r --no-preserve=all ./logdocdata/* ~/.local/share/LogDoctor/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy LogDoctor's data"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
cp --no-preserve=all ./LogDoctor.desktop ~/.local/share/applications/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to create a menu entry"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
echo "Error: failed to create a menu entry"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
sudo cp --no-preserve=all ./logdoctor.svg /usr/share/icons
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy LogDoctor's icon"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
echo "Error: failed to copy LogDoctor's icon"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
cd ../build
|
||||
cp --no-preserve=all ./logdoctor ./logdoctor.copy
|
||||
chmod 755 ./logdoctor.copy
|
||||
sudo mv ./logdoctor.copy /usr/bin/logdoctor
|
||||
chmod 755 ./logdoctor
|
||||
sudo mv ./logdoctor /usr/bin/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy the executable"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
echo "Error: failed to copy the executable"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
# Update finished
|
||||
|
|
Loading…
Reference in New Issue