There might be one directory that you might want to delete and that is ~/.config/arduino-ide/.
I've just started creating a portable implementation using bat files under Windows 11 and encountered that some stuff is still there; I think it was a list of libraries although they were not in the sketchbook directory.
I'm using portable installations probably differently than you do; I have several portable 1.8.19 installations for different board packages and even for projects so a board package upgrade or library update does not cause havoc; update warnings are disabled in this setup.
Sorry, didn't really understad what You mean. This Thread is for Arduino 2.x (>1.8.9). I use Version 1,8,x already (see my Thread here).
On Linux, there is no additional dir (neither in V2.x nor 1.x).
But if You use V1.x making it portable is simple, becaus all what is needed is a dir "portabl" byside the exe...
@sterretje: First, thanks for Your clarification, it leads me to some more investigations.
Beside to the (extra) directory you mentioned, I found two more (on Linux):
~/.arduinoIDE # settings..
~/.arduino15 # packages
~/Arduino # empty, for Sketchboard ?
~/.config/arduino-ide # Preferences ??
~/.config/Arduino IDE # log
But all that is irrelevant, when using a command-line like:
HOME="${NEW_HOME}" ...
In this case every data goes into "${NEW_HOME}".
So it isn't even necessary to do the preparation steps as described above.
Simply (adapt and) use my (new) script below.
Parts that needs adaption are clearly noticed between "Configuration options" and "End of Configuration options"
Because You wrote:
I'm using portable installations probably differently than you do; I have several portable 1.8.19 installations for different board packages and even for projects so a board package upgrade or library update does not cause havoc; update warnings are disabled in this setup.
OK, I thing about "portable" as the ability to put everything that is need for using an app onto a removable media (pen drive).
But Your approach to uses arduino has it's own authorization. So I modify my script to support both approaches.
If You define PORTABLE_PATH before running the script you may use unlimited installations.
You may write an extra script that defines this var, then sources my script.
#!/usr/bin/env bash
#set -o xtrace
set -e
###############################################################
# This is a wrapper for the arduino-ide.AppImage
#
# Important:
# This script must be copied to the same directory as the AppImage.
# Only one *.AppImage (with the x flag set) may exist in this directory.
###############################################################
# Configuration options:
#
# PORTABLE_PATH / DEFAULT_PORTABLE_PATH:
# PORTABLE_PATH defines the Arduino variant/instance/installation to use.
# It can be specified as an absolute path or relative to the APPDIR.
# If PORTABLE_PATH does not exist, you will be asked whether to create it.
# If PORTABLE_PATH was not defined before starting this script, DEFAULT_PORTABLE_PATH will be used.
DEFAULT_PORTABLE_PATH="portable"
#PORTABLE_PATH="portable"
# SKETCHBOOK:
# If your sketchbook is on a USB stick, SKETCHBOOK should be set to the
# relative path within the directory; otherwise, it should be left undefined.
SKETCHBOOK="Portables/Arduino/portable/Sketchbook"
# Run the app in the background (with nohup)
DOBACKGROUND="${DOBACKGROUND-y}"
# Uncomment if your AppImage doesn't work without --no-sandbox.
# See Note 1 (below) for information on customizing your AppImage for sandbox support.
#NO_SANDBOX=--no-sandbox
# End of Configuration options
###############################################################
###############################################################
# Get Path of this script
###############################################################
APPDIR="$(dirname -- "$(readlink -f -- "${0}")" )"
cd ${APPDIR}
MOUNT_POINT=$(df --output=target "${APPDIR}" | tail -n1)
REL_PATH="${APPDIR#$MOUNT_POINT/}" # whithout leading slash
###############################################################
# Determine exe
###############################################################
EXE=$(find . -maxdepth 1 -executable -name "*.AppImage")
EXE_CNT=$(find . -maxdepth 1 -executable -name "*.AppImage" | grep -c ".AppImage")
if [ ${EXE_CNT} -ne 1 ]; then
read -p "Invaid # of AppImages found: ${EXE_CNT}"
exit
fi
###############################################################
# PORTABLE_PATH / DEFAULT_PORTABLE_PATH -> NEW_HOME
###############################################################
USED_PORTABLE_PATH="${PORTABLE_PATH-${DEFAULT_PORTABLE_PATH}}"
if [ ! "${USED_PORTABLE_PATH%%/*}" ]; then
# PORTABLE_PATH is an absolute path
NEW_HOME="${USED_PORTABLE_PATH}"
else
# PORTABLE_PATH is a relative path
NEW_HOME="${APPDIR}/${USED_PORTABLE_PATH}"
fi
###############################################################
# NEW_HOME exist ?
###############################################################
CreateYaml()
{
if [ ! -z "${SKETCHBOOK-x}" ]; then
echo "directories:" >"${yaml}"
echo " user: ${MOUNT_POINT}/${SKETCHBOOK}" >>"${yaml}"
fi
}
yaml="${NEW_HOME}/.arduinoIDE/arduino-cli.yaml"
if [ ! -d "${NEW_HOME}" ]; then
if GetYn "Do you wish to create \"${NEW_HOME}\"? "; then
exit
fi
# Create NEW_HOME (& create yaml if needed)
mkdir "${NEW_HOME}"
CreateYaml
else
# Adjust path to Sketchbook inside ${yaml}
if [ ! -e "${yaml}" ]; then # yaml does not exist
CreateYaml
fi
if [ ! -z "${SKETCHBOOK}" ]; then # SKETCHBOOK set
t=$(grep "user: ${MOUNT_POINT}/${SKETCHBOOK}" "${yaml}")
if [ -z "${t}" ]; then # user does not point to current mount-point
sed -i -e "s;user: .*;user: ${MOUNT_POINT}/${SKETCHBOOK};g" "${yaml}"
fi
fi
fi
###############################################################
# Start Arduiino
###############################################################
if [ "${DOBACKGROUND}" != "y" ]; then
HOME="${NEW_HOME}" "${EXE}" ${NO_SANDBOX}
else
HOME="${NEW_HOME}" nohup "${EXE}" ${NO_SANDBOX} >"nohup.out" 2>&1 &
sleep 5
fi
###############################################################
# Get User Input Yes or No return 0 if user enters no
###############################################################
GetYn()
{
while true; do
read -p "$1" yn
case $yn in
[Yy]* ) return 1;;
[Nn]* ) return 0;;
* ) echo "Please answer yes or no.";;
esac
done
}
###############################################################
# Note 1
#
# Currently all AppImage (started under Ubuntu 24.04) terminate with error:
# "The SUID sandbox helper binary was found, but is not configured correctly"
# The problem seams to be, that the files extracted from an AppImage to a
# temporary dir will lose the suid bit!
# This leads to the failure of chrome-sandbox (from within AppImage)
#
# Modify AppImage to use chrome-sandbox (in opt) of local system:
#
# cd <to dir containing the AppImage>
# EXE=$(find . -maxdepth 1 -executable -name "*.AppImage")
# mkdir t; cd t
# Download appimagetool from https://github.com/AppImage/appimagetool/releases
# Set TOOL to its full path
# TOOL=$(find / -executable -iname "appimagetool*.AppImage")
# ${EXE} --appimage-extract
# cd squashfs-root/
# #Optional: sudo cp usr/share/icons/hicolor/512x512/apps/arduino-ide.png /usr/share/icons/hicolor/512x512/apps/arduino-ide.png
# rm chrome-sandbox
# ln -s $(sudo find /opt -name "chrome-sandbox") chrome-sandbox
# cd ..
# ARCH=x86_64 ${TOOL} squashfs-root # Adjust ARCH as nessesary
# rm -r squashfs-root/
# move the new AppImage to desired dir
# cd ..; rm -r t
###############################################################
Not quite; preferences would be what you called settings. As far as I know it's a directory where stuff is remembered like the last sketches and the board that that sketch is compiled for; it contains something more but I'm definitely not sure of what exactly.
There should be one more, the cache where compiled files are cached so not every file will be compiled over and over again. On Windows it is C:\Users\yourUsername\AppData\Local\arduino and contains the directories cores and sketches. It might be beneficial to also have that on the removable media but I have no idea how to configure its path.
I'm an occasional Linux user. I will need to analyse your script and possibly consult man pages and bash tutorials to figure out what is all going on