I cannot find an easy way to run development builds along side by stable built on Linux. Under Windows, I can do this easy by just downloading a portable stable version of Sublime Text, plus a portable development build of Sublime Text. Once, I open each one of them, they run on a separate process with their own Data/
directory.
How do you do it?
For now, I empowered this shell script:
#!/bin/bash
multi_user_runner="~/sublime_text/run_as_user.sh"
function print_usage() {
printf "\\n"
printf "Installation: \\n"
printf " chmod +x \\n" "$0"
printf "\\n"
printf "Usage: \\n"
printf " %s username buildnumber\\n" "$0"
read -p "Press 'Enter' to continue..." variable1
exit 1
}
rerunnow="rerunnow"
if [ ! -f "$multi_user_runner" ]
then
printf "Error: The multiuser runner script was not found in '%s'!\\n" "$multi_user_runner"
read -p "Press 'Enter' to continue..." variable1
exit 1
fi
# Open a terminal window to ask for the sudo password
if [ "$1" != "$rerunnow" ]
then
full_command_line="$0 $rerunnow $(printf '%q ' "${@:1}")"
declare -a available_terminals=(
"xfce4-terminal --maximize --command"
"gnome-terminal --maximize -- /bin/bash -c"
"terminator --maximise -e"
"konsole -e /bin/bash -c"
"xterm -maximize -e"
)
for current_command in "${available_terminals[@]}"
do
current_terminal=$(printf "%s" "$current_command" | head -n1 | cut -d " " -f1)
printf "current_terminal: %s, current_command: %s\\n" "$current_terminal" "$current_command"
if command -v "$current_terminal" >/dev/null 2>&1; then
$current_command "$full_command_line"
exit 0
fi
done
printf "Error: No valid terminal found!\\n"
read -p "Press 'Enter' to continue..." variable1
exit 1
fi
sublime_text_user=$2
sublime_text_build=$3
if [ -z "$sublime_text_build" ] || [ ! -d "./$sublime_text_build" ]
then
printf "Error: Invalid destine build '%s'\\n" "$sublime_text_build"
print_usage
fi
id -u "$sublime_text_user" > /dev/null 2>&1
if [ "$?" != "0" ] || [ -z "$sublime_text_user" ]
then
printf "Error: Invalid user '%s'\\n" "$sublime_text_user"
print_usage
fi
function handle_exception() {
printf "\\n"
printf "There was some exception while running this script!\\n"
printf "Check/revise the error messages and decide if it is safe to continue.\\n"
read -p "If it is safe, press 'Enter' to continue... Otherwise close this terminal window!" variable1
}
source_point="./Data"
mount_point="./$sublime_text_build/Data"
sublime_text_executable="./$sublime_text_build/sublime_text"
mkdir -p "$source_point" "$mount_point" || handle_exception
mountpoint -q "$mount_point" || sudo mount --bind "$source_point" "$mount_point" || handle_exception
if [ "$#" -gt 3 ]
then
extra_arguments=$(printf '%q ' "${@:4}")
fi
"$multi_user_runner" "$sublime_text_user" "$sublime_text_executable" -n "$extra_arguments" || handle_exception
# read -p "Press 'Enter' to continue..." variable1
printf "Exiting %s...\\n" "$0"
exit 0
To use it, you need to create another a shell script I posted on this other thread and set the variable multi_user_runner
pointing to that script path:
Here, I had the following directory structure:
-
/home/sublime/sublime_text
- This directory contains all Sublime Text builds I have installed, each build is on a directory named after them, i.e.,
3194
3176
etc
- This directory contains all Sublime Text builds I have installed, each build is on a directory named after them, i.e.,
-
/home/sublime/sublime_text/Data
- This directory contains all Sublime Text files which are going to be mounted inside each Sublime Text build.
3194/Data
3176/Data
etc/Data
- This directory contains all Sublime Text files which are going to be mounted inside each Sublime Text build.