diff --git a/helper_scripts/packages.sh b/helper_scripts/packages.sh index 0b639d414d65061d6facff3ff15f943b50e7279a..3d67695f7b7c4883aba48c421c3c3c76693c22c8 100644 --- a/helper_scripts/packages.sh +++ b/helper_scripts/packages.sh @@ -60,9 +60,11 @@ FLATPAK_REMMINA_PACKAGE_DISPLAY_NAME="Remmina" # Raw packages RAW_GITEXTENSIONS_PACKAGE="$RAW_IDENTIFIER:gitextensions" RAW_K3D_PACKAGE="$RAW_IDENTIFIER:k3d" +RAW_JAN_PACKAGE="$RAW_IDENTIFIER:jan" RAW_GITEXTENSIONS_PACKAGE_DISPLAY_NAME="GitExtensions" RAW_K3D_PACKAGE_DISPLAY_NAME="k3d" +RAW_JAN_PACKAGE_DISPLAY_NAME="Jan Local AI Assistant" # Mainline kernel MAINLINE_KERNEL_PACKAGE="$MAINLINE_KERNEL_IDENTIFIER" @@ -98,4 +100,35 @@ PACKAGES=( ["$SNAP_FIREFOX_PACKAGE"]="$SNAP_FIREFOX_PACKAGE_DISPLAY_NAME" ["$MAINLINE_KERNEL_PACKAGE"]="$MAINLINE_KERNEL_PACKAGE_DISPLAY_NAME" ["$APT_DCONF_EDITOR"]="$APT_DCONF_EDITOR_DISPLAY_NAME" + ["$RAW_JAN_PACKAGE"]="$RAW_JAN_PACKAGE_DISPLAY_NAME" +) + +ORDERED_PACKAGES=( # Needed when order matters + "$SNAP_VSCODE_PACKAGE" + "$FLATPAK_IDEA_COMMUNITY_PACKAGE" + "$SNAP_RIDER_PACKAGE" + "$FLATPAK_WEBSTORM_PACKAGE" + "$FLATPAK_ANDROID_STUDIO_PACKAGE" + "$APT_GIT_PACKAGE" + "$RAW_GITEXTENSIONS_PACKAGE" + "$APT_DOCKER_CE_PACKAGE" + "$RAW_K3D_PACKAGE" + "$SNAP_KUBECTL_PACKAGE" + "$SNAP_FIREFOX_PACKAGE" + "$FLATPAK_OBSIDIAN_PACKAGE" + "$FLATPAK_SPOTIFY_PACKAGE" + "$FLATPAK_GIMP_PACKAGE" + "$APT_VIRTUALBOX_PACKAGE" + "$APT_VLC_PACKAGE" + "$APT_NET_TOOLS_PACKAGE" + "$FLATPAK_FLAMESHOT_PACKAGE" + "$APT_DL_DRIVER_PACKAGE" + "$FLATPAK_NEXTCLOUD_CLIENT_PACKAGE" + "$APT_PROTONVPN_PACKAGE" + "$APT_WIREGUARDVPN_PACKAGE" + "$FLATPAK_FLATSEAL_PACKAGE" + "$FLATPAK_REMMINA_PACKAGE" + "$APT_DCONF_EDITOR" + "$RAW_JAN_PACKAGE" + "$MAINLINE_KERNEL_PACKAGE" ) diff --git a/install.sh b/install.sh index e35414910e972fdf8bf0aa1cf78e0b16b51c0cc5..40d7c38126f20b10e2ba71120fafe678a3434a14 100644 --- a/install.sh +++ b/install.sh @@ -5,41 +5,13 @@ HELPER_SCRIPTS_DIR="$INSTALLER_DIR/helper_scripts" source "$HELPER_SCRIPTS_DIR/packages.sh" -ORDERED_PACKAGES=( # Needed when order matters - "$SNAP_VSCODE_PACKAGE" - "$FLATPAK_IDEA_COMMUNITY_PACKAGE" - "$SNAP_RIDER_PACKAGE" - "$FLATPAK_WEBSTORM_PACKAGE" - "$FLATPAK_ANDROID_STUDIO_PACKAGE" - "$APT_GIT_PACKAGE" - "$RAW_GITEXTENSIONS_PACKAGE" - "$APT_DOCKER_CE_PACKAGE" - "$RAW_K3D_PACKAGE" - "$SNAP_KUBECTL_PACKAGE" - "$SNAP_FIREFOX_PACKAGE" - "$FLATPAK_OBSIDIAN_PACKAGE" - "$FLATPAK_SPOTIFY_PACKAGE" - "$FLATPAK_GIMP_PACKAGE" - "$APT_VIRTUALBOX_PACKAGE" - "$APT_VLC_PACKAGE" - "$APT_NET_TOOLS_PACKAGE" - "$FLATPAK_FLAMESHOT_PACKAGE" - "$APT_DL_DRIVER_PACKAGE" - "$FLATPAK_NEXTCLOUD_CLIENT_PACKAGE" - "$APT_PROTONVPN_PACKAGE" - "$APT_WIREGUARDVPN_PACKAGE" - "$FLATPAK_FLATSEAL_PACKAGE" - "$FLATPAK_REMMINA_PACKAGE" - "$APT_DCONF_EDITOR" - "$MAINLINE_KERNEL_PACKAGE" -) - declare -A NEEDS_VERSION NEEDS_VERSION=( ["$APT_VIRTUALBOX_PACKAGE"]="https://www.virtualbox.org/wiki/Linux_Downloads|${PACKAGES["$APT_VIRTUALBOX_PACKAGE"]} version (e.g. 7.1)" ["$RAW_GITEXTENSIONS_PACKAGE"]="https://github.com/gitextensions/gitextensions/releases|${PACKAGES["$RAW_GITEXTENSIONS_PACKAGE"]} version (e.g. 2.51.05)" ["$APT_PROTONVPN_PACKAGE"]="https://protonvpn.com/support/official-linux-vpn-ubuntu|${PACKAGES["$APT_PROTONVPN_PACKAGE"]} Repository version (e.g. 1.0.6)" ["$MAINLINE_KERNEL_PACKAGE"]="https://kernel.ubuntu.com/mainline/|Kernel versions, comma separated (e.g. 6.11.10)" + ["$RAW_JAN_PACKAGE"]="https://github.com/janhq/jan/releases|${PACKAGES["$RAW_JAN_PACKAGE"]} version (e.g. 0.5.13)" ) PACKAGES_WITH_GROUP=( @@ -72,6 +44,7 @@ CAN_AUTOSTART=( "$APT_PROTONVPN_PACKAGE" "$FLATPAK_FLATSEAL_PACKAGE" "$SNAP_FIREFOX_PACKAGE" + "$RAW_JAN_PACKAGE" # "$FLATPAK_REMMINA_PACKAGE" # Adds itself to autostart ) diff --git a/tasks/general_templates/appimage_installation.yaml b/tasks/general_templates/appimage_installation.yaml new file mode 100644 index 0000000000000000000000000000000000000000..524fcf84f2b680cc4c6626799179a887016f053d --- /dev/null +++ b/tasks/general_templates/appimage_installation.yaml @@ -0,0 +1,27 @@ +- name: Install AppImage + block: + - name: Copy AppImage + copy: + src: "{{ installation_file }}" + dest: "{{ destination }}" + + - name: Install libfuse + include_tasks: ../apt_templates/install_apt_package.yaml + vars: + app: libfuse2 + + - name: Setting AppImage permissions + file: + path: "{{ destination }}" + mode: '0775' + state: file + + - name: Extract Icon + when: "extract_icon | default (false)" + vars: + squashfs_path: "squashfs-root" + shell: | + chmod +x "{{ installation_file }}" + "{{ installation_file }}" --appimage-extract + cp "{{ squashfs_path }}/{{ appimage_icon_subpath }}" "{{ icon_destination }}" + rm -r "{{ squashfs_path }}" diff --git a/tasks/general_templates/wget_file.yaml b/tasks/general_templates/wget_file.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6512049cdc96bc1df1919e313ce84cd2235a699a --- /dev/null +++ b/tasks/general_templates/wget_file.yaml @@ -0,0 +1,9 @@ +- name: wget File + block: + - name: Install wget + include_tasks: ../apt_templates/install_apt_package.yaml + vars: + app: wget + + - name: Download File + shell: wget -q "{{ url }}" -O "{{ output_path }}" diff --git a/tasks/general_templates/wget_install.yaml b/tasks/general_templates/wget_install.yaml index 852e37a0212249c6b4c048564bc0fffc9294bfe0..f3aeddd54f89e9761227a33f4bb0074c1154cc83 100644 --- a/tasks/general_templates/wget_install.yaml +++ b/tasks/general_templates/wget_install.yaml @@ -1,21 +1,17 @@ -- name: wget File +- name: wget and install File vars: output_path: "{{ temporary_downloads_path }}/{{ wget_output_file }}" block: - - name: Install wget - include_tasks: ../apt_templates/install_apt_package.yaml - vars: - app: wget - - - name: Download File - shell: wget -q "{{ url }}" -O "{{ output_path }}" + - name: wget File + include_tasks: wget_file.yaml - name: Install File include_tasks: "{{ installation_task }}" vars: installation_file: "{{ output_path }}" + download_path: "{{ temporary_downloads_path }}" - name: wget Cleanup file: - path: "{{ temporary_downloads_path }}/{{ wget_output_file }}" + path: "{{ output_path }}" state: absent diff --git a/tasks/raw_packages.yaml b/tasks/raw_packages.yaml index 049d9030d823468f43c2e4effd6f946909168ebf..f0003f6616e6e024bd543b80413ebd79aa0476f9 100644 --- a/tasks/raw_packages.yaml +++ b/tasks/raw_packages.yaml @@ -68,3 +68,61 @@ wget_output_file: k3d.sh installation_task: bash_installation.yaml when: "'k3d' in raw_packages" + +- name: Install Jan (Raw) + vars: + jan_path: "{{ portable_programs_path }}/Jan" + jan_filename: "jan.AppImage" + jan_appimage_path: "{{ jan_path }}/{{ jan_filename }}" + desktop_filename: jan + desktop_app_name: Jan + desktop_description: Jan - Local AI Assistant + desktop_icon_path: "{{ jan_path }}/icon.png" + when: raw_packages is search('jan:') + block: + - name: Remove old Jan Installation + file: + path: "{{ jan_path }}" + state: absent + + - name: Ensure Jan directory + include_tasks: general_templates/make_dir.yaml + vars: + path: "{{ jan_path }}" + + - name: Install Jan (Raw) + include_tasks: general_templates/wget_install.yaml + vars: + version: "{{ raw_packages | regex_search('jan:([^\\s]+)', '\\1') | first | trim }}" + url: https://github.com/janhq/jan/releases/download/v{{ version }}/jan-linux-x86_64-{{ version }}.AppImage + wget_output_file: "{{ jan_filename }}" + installation_task: appimage_installation.yaml + destination: "{{ jan_appimage_path }}" + extract_icon: true + icon_destination: "{{ desktop_icon_path }}" + appimage_icon_subpath: usr/share/icons/hicolor/512x512/apps/jan.png + + # - name: Download Jan Icon + # include_tasks: general_templates/wget_file.yaml + # vars: + # url: https://avatars.githubusercontent.com/u/102363196?s=200&v=4 + # output_path: "{{ desktop_icon_path }}" + + - name: Create Application Entry + include_tasks: general_templates/create_desktop_file.yaml + vars: + dir: "{{ applications_directory }}" + filename: "{{ desktop_filename }}" + app_name: "{{ desktop_app_name }}" + description: "{{ desktop_description }}" + executable: "{{ jan_appimage_path }}" + icon_path: "{{ desktop_icon_path }}" + + - name: Create Autostart Entry + include_tasks: general_templates/create_desktop_file.yaml + vars: + filename: "{{ desktop_filename }}" + app_name: "{{ desktop_app_name }}" + description: "{{ desktop_description }}" + executable: "{{ jan_appimage_path }}" + when: "'jan' in autostart_applications" diff --git a/variables/editable_variables.yaml b/variables/editable_variables.yaml index 9211f2b5894a38b68de935ce5dfbab58bd5ab24c..9329b2abea46bc50129b34064690b1b3cc501801 100644 --- a/variables/editable_variables.yaml +++ b/variables/editable_variables.yaml @@ -1,2 +1,2 @@ portable_programs_path: "{{ ansible_env.HOME }}/Programs" -temporary_downloads_path: "." +temporary_downloads_path: "{{ '.' | realpath }}"