Skip to content

Commit

Permalink
Add uninstall xtd.
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Apr 19, 2022
1 parent 31f125c commit 2f035fd
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 10 deletions.
20 changes: 20 additions & 0 deletions scripts/cmake/update_version_number.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,24 @@ if (${STRING_FOUND} EQUAL -1)
"set xtd_version=${XTD_VERSION}\n"
"call scripts\\install\\install.cmd %*\n"
)

file(WRITE uninstall
"#!/usr/bin/env bash\n"
"# This code was generated by CMake script.\n"
"#\n"
"# Changes to this file may cause incorrect behavior and will be lost if the file is regenerated.\n"
"\n"
"export xtd_version=${XTD_VERSION}\n"
"scripts/install/uninstall.sh \"$@\"\n"
)

file(WRITE uninstall.cmd
"@echo off\n"
":: This code was generated by CMake script.\n"
"::\n"
":: Changes to this file may cause incorrect behavior and will be lost if the file is regenerated.\n"
"\n"
"set xtd_version=${XTD_VERSION}\n"
"call scripts\\install\\uninstall.cmd %*\n"
)
endif()
11 changes: 8 additions & 3 deletions scripts/install/install.cmd
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
@echo off

if "%xtd_version%"== "" (
echo "ERROR : Use install.cmd from root folder"
exit /B 1
)

set WXWIDGETS_VERSION=v3.1.6

echo Install xtd libraries version %xtd_version%, copyright Gammasoft, 2020
echo Install xtd libraries version %xtd_version%, copyright Gammasoft, 2022
echo.

echo Operating System is Windows

:: check if administrator mode
WHOAMI /Groups | FIND "12288" > nul 2>&1
IF %ERRORLEVEL% neq 0 (
whoami /Groups | find "12288" > nul 2>&1
if %ERRORLEVEL% neq 0 (
echo You are not in administrator mode!
echo Run cmd as administrator before execute install.
exit /B 1
Expand Down
25 changes: 18 additions & 7 deletions scripts/install/install.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#!/usr/bin/env bash

if [ -z ${xtd_version+x} ]; then
echo "ERROR : Use ./install from root folder"
exit 1
fi

WXWIDGETS_VERSION=v3.1.6

echo "Install xtd libraries version $xtd_version, copyright Gammasoft, 2020"
echo "Install xtd libraries version $xtd_version, copyright Gammasoft, 2022"
echo ""

# detecting linux distribution
Expand Down Expand Up @@ -39,13 +44,13 @@ popd
mkdir -p wxwidgets/build_cmake
pushd wxwidgets/build_cmake
mkdir Debug && mkdir Release
pushd Debug
cmake ../.. -DCMAKE_BUILD_TYPE=Debug -DwxBUILD_SHARED=OFF
pushd Release
cmake ../.. -DCMAKE_BUILD_TYPE=Release -DwxBUILD_SHARED=OFF
cmake --build . -- -j8
sudo cmake --build . --target install
popd
pushd Release
cmake ../.. -DCMAKE_BUILD_TYPE=Release -DwxBUILD_SHARED=OFF
pushd Debug
cmake ../.. -DCMAKE_BUILD_TYPE=Debug -DwxBUILD_SHARED=OFF
cmake --build . -- -j8
sudo cmake --build . --target install
popd
Expand All @@ -60,12 +65,12 @@ mkdir Release && mkdir Debug
pushd Release
cmake ../.. -DCMAKE_BUILD_TYPE=Release "$@"
cmake --build . -- -j8
sudo cmake --build . --target install -- -j8
sudo cmake --build . --target install
popd
pushd Debug
cmake ../.. -DCMAKE_BUILD_TYPE=Debug "$@"
cmake --build . -- -j8
sudo cmake --build . --target install -- -j8
sudo cmake --build . --target install
popd
popd

Expand All @@ -85,6 +90,12 @@ elif [[ "$OSTYPE" == *"Darwin"* ]]; then
ln -s "/usr/local/bin/guidgen-gui.app" "/Applications/guidgen-gui"
fi

# copy install manifest files to xtd share directory
sudo cp build/3rdparty/wxwidgets/build_cmake/Release/install_manifest.txt /usr/local/share/xtd/wxwidgets_release_install_manifest.txt
sudo cp build/3rdparty/wxwidgets/build_cmake/Debug/install_manifest.txt /usr/local/share/xtd/wxwidgets_debug_install_manifest.txt
sudo cp build/Release/install_manifest.txt /usr/local/share/xtd/xtd_release_install_manifest.txt
sudo cp build/Debug/install_manifest.txt /usr/local/share/xtd/xtd_debug_install_manifest.txt

# launch xtd-gui
echo "launch xtdc-gui..."
if [[ "$OSTYPE" == *"MSYS"* ]] || [[ "$OSTYPE" == *"MINGW64"* ]]; then
Expand Down
31 changes: 31 additions & 0 deletions scripts/install/uninstall.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@echo off

if "%xtd_version%"== "" (
echo ERROR : Use uninstall.cmd from root folder
exit /B 1
)

echo Uninstall xtd libraries version %xtd_version%, copyright Gammasoft, 2022
echo.

:: check if administrator mode
whoami /Groups | find "12288" > nul 2>&1
if %ERRORLEVEL% neq 0 (
echo You are not in administrator mode!
echo Run cmd as administrator before execute install.
exit /B 1
)

echo WARNING : You will unsinstall xtd.
echo Press ENTER to continue or CTRL-C to stop...
pause > nul 2>&1

echo Removing wxwidgets files...
del /F /S /Q "%ProgramFiles(x86)%\wxwidgets" > nul 2>&1
echo Removing xtd files...
del /F /S /Q "%ProgramFiles(x86)%\xtd" > nul 2>&1
del /F /S /Q "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\xtd" > nul 2>&1

echo.
echo xtd is uninstalled.
echo If you want to use xtd again, you will have to reinstall it.
31 changes: 31 additions & 0 deletions scripts/install/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

if [ -z ${xtd_version+x} ]; then
echo "ERROR : Use ./uninstall from root folder"
exit 1
fi

echo "Uninstall xtd libraries version $xtd_version, copyright Gammasoft, 2022"
echo ""

echo "WARNING : You will unsinstall xtd."
read -p "Press ENTER to continue or CTRL-C to stop..."

manifest_files=("/usr/local/share/xtd/wxwidgets_release_install_manifest.txt" "/usr/local/share/xtd/wxwidgets_debug_install_manifest.txt" "/usr/local/share/xtd/xtd_release_install_manifest.txt" "/usr/local/share/xtd/xtd_debug_install_manifest.txt")

# removing files
for manifest_file in ${manifest_files[@]}; do
if test -f "$manifest_file"; then
input="$manifest_file"
while IFS= read -r line; do
sudo echo "Removing \"$line\"..."
sudo rm -f "$line" >/dev/null 2>&1
done < "$input"
sudo echo "Removing \"$manifest_file\"..."
sudo rm -f "$manifest_file" >/dev/null 2>&1
fi
done

echo ""
echo "xtd is uninstalled."
echo "If you want to use xtd again, you will have to reinstall it."
7 changes: 7 additions & 0 deletions uninstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# This code was generated by CMake script.
#
# Changes to this file may cause incorrect behavior and will be lost if the file is regenerated.

export xtd_version=0.2.0
scripts/install/uninstall.sh "$@"
7 changes: 7 additions & 0 deletions uninstall.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
:: This code was generated by CMake script.
::
:: Changes to this file may cause incorrect behavior and will be lost if the file is regenerated.

set xtd_version=0.2.0
call scripts\install\uninstall.cmd %*

0 comments on commit 2f035fd

Please sign in to comment.