From adf44b3b94c6dfbbbe3b2b103314fb83e38f8ad6 Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Tue, 14 May 2024 18:44:50 +0000 Subject: [PATCH] feat: add vscode integration --- .vscode/tasks.json | 108 ++++++++++++++++++++++++++++++++++++ scripts/common-build-iso.sh | 15 +---- scripts/get-defaults.sh | 7 ++- 3 files changed, 117 insertions(+), 13 deletions(-) create mode 100644 .vscode/tasks.json diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000000..6ec5bbb5cb1 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,108 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Connect to VM", + "dependsOn": [ + "Run-ISO", + "Open Browser" + ], + "problemMatcher": [] + }, + { + "label": "Open Browser", + "command": "${input:openSimpleBrowser}", + "problemMatcher": [] + }, + { + "label": "Build Container", + "command": "just", + "args": [ + "build", + "${input:outputChoice}" + ], + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "Build ISO", + "command": "just", + "args": [ + "build-iso", + "${input:outputChoice}" + ], + "problemMatcher": [] + }, + { + "label": "Build ISO (testing)", + "command": "just", + "args": [ + "build-iso-installer-main", + "${input:outputChoice}" + ], + "problemMatcher": [] + }, + { + "label": "Run-ISO", + "command": "just", + "args": [ + "run-iso", + "${input:outputChoice}" + ], + "problemMatcher": [], + "isBackground": true + }, + { + "label": "List Images", + "command": "just", + "args": [ + "list-images" + ], + "problemMatcher": [] + }, + { + "label": "Check justfiles", + "command": "just", + "args": [ + "just-check" + ], + "problemMatcher": [] + }, + { + "label": "Run Container", + "command": "just", + "args": [ + "run-container", + "${input:outputChoice}" + ], + "problemMatcher": [] + } + ], + "inputs": [ + { + "id": "openSimpleBrowser", + "type": "command", + "command": "simpleBrowser.show", + "args": [ + "http://localhost:8006" + ] + }, + { + "id": "outputChoice", + "type": "pickString", + "description": "Choose which container to build", + "default": "bluefin", + "options": [ + "bluefin", + "bluefin-dx", + "bluefin latest", + "bluefin-dx latest", + "aurora", + "aurora-dx", + ] + } + ] +} \ No newline at end of file diff --git a/scripts/common-build-iso.sh b/scripts/common-build-iso.sh index 5d0306c9959..e4d507f582a 100644 --- a/scripts/common-build-iso.sh +++ b/scripts/common-build-iso.sh @@ -20,16 +20,6 @@ if "${container_mgr}" info | grep Root | grep -q /home; then echo "Cannot build ISO with rootless container..." exit 1 fi -# function work-in-process(){ -# echo "ISO Builder script is a Work In Process" -# secs=5 -# while [ $secs -gt 0 ] -# do -# printf "\r\033[KWaiting %.d seconds." $((secs--)) -# sleep 1 -# done -# } -# work-in-process # Get Inputs image=$1 @@ -45,6 +35,7 @@ tag=$(just _tag "${image}" "${target}") # Don't use -build suffix, flatpak dependency using ghcr ghcr_tag=${tag::-6} + # Remove old ISO if present sudoif rm -f "${project_root}/scripts/files/output/${tag}-${version}-${git_branch}.iso" sudoif rm -f "${project_root}/scripts/files/output/${tag}-${version}-${git_branch}.iso-CHECKSUM" @@ -88,7 +79,7 @@ ostree refs --repo=\${FLATPAK_SYSTEM_DIR}/repo | grep '^deploy/' | grep -v 'org\ EOF workspace=${project_root} -if [[ -f /.dockerenv ]]; then +if [[ -f /.dockerenv || -f /run/.containerenv ]]; then FLATPAK_REFS_DIR=${LOCAL_WORKSPACE_FOLDER}/${flatpak_dir_shortname} TEMP_FLATPAK_INSTALL_DIR="${LOCAL_WORKSPACE_FOLDER}/$(echo "${TEMP_FLATPAK_INSTALL_DIR}" | rev | cut -d / -f 1 | rev)" workspace=${LOCAL_WORKSPACE_FOLDER} @@ -102,7 +93,7 @@ if [[ ! -f ${project_root}/${flatpak_dir_shortname}/flatpaks_with_deps ]]; then -e FLATPAK_TRIGGERSDIR=/flatpak/triggers \ --volume "${FLATPAK_REFS_DIR}":/output \ --volume "${TEMP_FLATPAK_INSTALL_DIR}":/temp_flatpak_install_dir \ - "ghcr.io/ublue-os/${base_name}-main:${version}" /temp_flatpak_install_dir/script.sh + "ghcr.io/ublue-os/${base_image}-main:${version}" /temp_flatpak_install_dir/script.sh fi # Remove Temp Directory diff --git a/scripts/get-defaults.sh b/scripts/get-defaults.sh index b57af4fae41..36d811cd310 100755 --- a/scripts/get-defaults.sh +++ b/scripts/get-defaults.sh @@ -16,11 +16,16 @@ fi # if no target, base if [[ -z "${target}" ]]; then target="base" - # if $2 is numeric, assume that is version and target is base elif [[ ${target} =~ ^[0-9]+$ ]]; then version=${target} target="base" +elif [[ ${target} =~ latest ]]; then + version=${target} + target="base" +elif [[ ${target} =~ gts ]]; then + version=${target} + target="base" fi # if no version, bluefin is GTS, Aurora is Latest