🎉 Added duf

This commit is contained in:
Edgar 2021-08-23 13:03:48 +02:00
parent 76afab8189
commit 6e23d82c0a
No known key found for this signature in database
GPG Key ID: 17D930BB616061A5
6 changed files with 71 additions and 14 deletions

20
.gitignore vendored
View File

@ -2,3 +2,23 @@ build
tmp
.vscode/
.idea/
### CMake ###
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
### CMake Patch ###
# External projects
*-prefix/
build.ninja
.ninja_log

28
CMakeLists.txt Normal file
View File

@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.16)
project(ci-scripts LANGUAGES NONE)
set(TOOLS
"kitware/cmake"
"mozilla/sccache"
"muesli/duf"
)
foreach (item IN ITEMS ${TOOLS})
string(REPLACE "/" ";" RLIST ${item})
list(GET RLIST 1 TOOL)
add_custom_target(
${TOOL}
COMMAND ${CMAKE_COMMAND} -DGH_REPO=${item} -P ${CMAKE_SOURCE_DIR}/update.cmake
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM
)
list(APPEND all_tools ${TOOL})
endforeach ()
add_custom_target(
update_all ALL
COMMENT "Update all tools"
DEPENDS ${all_tools}
VERBATIM
)

View File

@ -1,10 +0,0 @@
all : cmake sccache lazygit
cmake:
cmake -DTOOL=cmake -DREPO=kitware -P update.cmake
sccache:
cmake -DTOOL=sccache -DREPO=mozilla -P update.cmake
lazygit:
cmake -DTOOL=lazygit -DREPO=jesseduffield -P update.cmake

5
install-duf.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
set -eu
wget "https://github.com/muesli/duf/releases/download/v0.6.2/duf_0.6.2_linux_amd64.deb" -nv -O /tmp/duf.deb
dpkg -i /tmp/duf.deb

View File

@ -0,0 +1,5 @@
#!/bin/bash
set -eu
wget "https://github.com/muesli/duf/releases/download/v@VERSION@/duf_@VERSION@_linux_amd64.deb" -nv -O /tmp/duf.deb
dpkg -i /tmp/duf.deb

View File

@ -1,6 +1,15 @@
message("TOOL \"${TOOL}\" REPO \"${REPO}\"")
macro(mgs text)
execute_process(COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --green --bold ${text})
endmacro()
SET(URL "https://api.github.com/repos/${REPO}/${TOOL}/releases/latest")
string(REPLACE "/" ";" RLIST "${GH_REPO}")
list(GET RLIST 0 OWNER)
list(GET RLIST 1 TOOL)
mgs("TOOL \"${TOOL}\" OWNER \"${OWNER}\"")
SET(URL "https://api.github.com/repos/${OWNER}/${TOOL}/releases/latest")
execute_process(COMMAND curl -s -L ${URL} OUTPUT_VARIABLE VERSION_JSON)
string(JSON VERSION_DIRTY GET ${VERSION_JSON} tag_name)
@ -8,5 +17,5 @@ string(JSON VERSION_DIRTY GET ${VERSION_JSON} tag_name)
string(REGEX REPLACE [^0-9\\.] "" VERSION "${VERSION_DIRTY}")
string(REPLACE "." "_" VERSION_UNDERSCORE ${VERSION})
message("Latest VERSION ${VERSION}")
mgs("Latest VERSION ${VERSION}")
configure_file("${CMAKE_CURRENT_LIST_DIR}/templates/install-${TOOL}.sh.in" "${CMAKE_CURRENT_LIST_DIR}/install-${TOOL}.sh" @ONLY)