diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..0470103 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,12 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "cmake", + "label": "CMake: настроить", + "command": "configure", + "problemMatcher": [], + "detail": "Задача шаблона CMake настроить" + } + ] +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bd983c..db1688d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,11 @@ project( add_custom_target( Package COMMAND cp -f ${CMAKE_CURRENT_SOURCE_DIR}/install.sh ${CMAKE_CURRENT_SOURCE_DIR}/package/DEBIAN/postinst + COMMAND chmod 775 ${CMAKE_CURRENT_SOURCE_DIR}/package/DEBIAN + COMMAND chmod 775 ${CMAKE_CURRENT_SOURCE_DIR}/package/DEBIAN/control + COMMAND chmod 775 ${CMAKE_CURRENT_SOURCE_DIR}/package/DEBIAN/prerm COMMAND chmod 775 ${CMAKE_CURRENT_SOURCE_DIR}/package/DEBIAN/postinst + COMMAND chmod 775 ${CMAKE_CURRENT_SOURCE_DIR}/package/DEBIAN/postrm COMMAND dpkg-deb --build ${CMAKE_CURRENT_SOURCE_DIR}/package ${CMAKE_CURRENT_BINARY_DIR}/package.deb WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/README.md b/README.md index c8940c8..a3f75c6 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Некоторые команды требуют sudo -Тулчейн устанавливается в папку `/home/autobuild/tools/win32` +Тулчейн по умолчанию устанавливается в папку `/home/autobuild/tools/win32`, но скрипт вас спросит перед установкой ### Windows diff --git a/install.sh b/install.sh index f1b0ca7..95244e9 100755 --- a/install.sh +++ b/install.sh @@ -133,21 +133,34 @@ sudo ln -sf /usr/lib/libmpfr.so.6 /usr/lib/libmpfr.so.4 print_ok "Successfully!" -sudo ln -sf $TOOLCHAIN_DIR $DEFAULT_TOOLCHAIN_DIR +if [ "$TOOLCHAIN_DIR" != "$DEFAULT_TOOLCHAIN_DIR" ]; then + sudo ln -sf $TOOLCHAIN_DIR $DEFAULT_TOOLCHAIN_DIR +fi + + +MESSAGE="PATH=\$PATH:$TOOLCHAIN_DIR/win32/bin" + +EXPORT_MESSSAGE="export $MESSAGE" if [ ! "$(id -u)" -ne 0 ] then - print_msg "Add" - echo 'PATH=$PATH:/home/autobuild/tools/win32/bin' >> /etc/profile + print_msg "Add path to profile" + echo $MESSAGE >> /etc/profile else - if ! grep -q 'export PATH=$PATH:/home/autobuild/tools/win32/bin' ~/.bashrc; then - export PATH=$PATH:/home/autobuild/tools/win32/bin + if ! grep -q $EXPORT_MESSSAGE ~/.bashrc; then print_msg "Adding '$TOOLCHAIN_DIR/win32/bin' to '~/.bashrc'" - echo 'export PATH=$PATH:/home/autobuild/tools/win32/bin' >> ~/.bashrc + echo $EXPORT_MESSSAGE >> ~/.bashrc fi fi +# WTF?! +sudo /usr/bin/mkdir -p /etc/kos32-gcc +sudo echo $TOOLCHAIN_DIR >> /etc/kos32-gcc/install-path + + +export $MESSAGE + cd "$OLDPWD" print_ok "Installation was successful!" diff --git a/package/DEBIAN/control b/package/DEBIAN/control index fd324b6..5fddf45 100755 --- a/package/DEBIAN/control +++ b/package/DEBIAN/control @@ -3,7 +3,7 @@ Version: 0.1.4 Architecture: all Section: devel Depends: libc6-i386:amd64, libmpc3:amd64 -Pre-Depends: p7zip, wget +Pre-Depends: p7zip-full, wget Recommends: fasm Priority: optional Homepage: https://github.com/Egor00f/kolibrios-gcc-toolchain diff --git a/package/DEBIAN/dirs b/package/DEBIAN/dirs deleted file mode 100644 index a3d8927..0000000 --- a/package/DEBIAN/dirs +++ /dev/null @@ -1 +0,0 @@ -/home/autobuild/tools/ \ No newline at end of file diff --git a/package/DEBIAN/postrm b/package/DEBIAN/postrm index f0f97a2..de08bc7 100755 --- a/package/DEBIAN/postrm +++ b/package/DEBIAN/postrm @@ -1,11 +1,12 @@ #!/bin/bash -rm -R /home/autobuild/tools/win32 +TOOLCHAIN_DIR=$(head -n 1 /etc/kos32-gcc/install-path) -if grep -q 'PATH=$PATH:/home/autobuild/tools/win32/bin' /etc/profile; then - val="PATH=\$PATH:/home/autobuild/tools/win32/bin" - sed -i '/$val/d' /etc/profile +MESSAGE="PATH=\$PATH:$TOOLCHAIN_DIR" + +if grep -q $MESSAGE /etc/profile; then + sed -i '/$MESSAGE/d' /etc/profile fi - +rm /etc/kos32-gcc -R diff --git a/package/DEBIAN/prerm b/package/DEBIAN/prerm new file mode 100755 index 0000000..0b3ec41 --- /dev/null +++ b/package/DEBIAN/prerm @@ -0,0 +1,5 @@ +#!/bin/bash + +TOOLCHAIN_DIR=$(head -n 1 /etc/kos32-gcc/install-path) + +rm -R $TOOLCHAIN_DIR