How to Symlink A Theme Pack Using Portable Scripts

Moderator: Forum moderators

Post Reply
geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

How to Symlink A Theme Pack Using Portable Scripts

Post by geo_c »

@mikewalsh

I'm looking at your portable launch script for Libre Office included below, because I'm collecting about 100 gtk3/4 themes into a theme pack, and I'd like the user to be able to unzip a directory from basically anywhere (although it should probably be in /mnt/home) and then the script would copy, or create symlinks into /usr/share/themes, or /root/.themes as the case would be in Void.

I'd rather not create 100 symlinks with individual lines in a script. Could I link the themepack directory full of theme directories recursively with a wildcard? something like:

Code: Select all

HERE=$(cd `dirname $0` && pwd)
cd $HERE
cp -sr  $HERE/themepack/gtk3/* /usr/share/themes

If that would actually work it would probably recursively symlink all the directories and files under the gtk3 directory, All I want is a symlink to each theme folder. And so maybe it should just be:

Code: Select all

cp -s /$HERE/themepack/gtk3/* /usr/share/themes

It seems like it would be a lot easier to create the links using one drag and drop in Rox, include them in the theme pack, and then have the script copy those links to the filesystem. But that would require the portable theme directory to be located in a predetermined location like /mnt/home, making it somewhat less than portable.

Or I could do what you appear to be doing in this script below, which is deleting any /root/.config/libreoffice directory already present, and then symlinking. But that confuses me, unless it it is not possible or advisable to be running the portable along side a built in or installed version of LibreOffice, which I don't do. I removed my previous LibreOffice .sfs before running the portable.

Of course a theme pack would be different. I wouldn't want to remove the /usr/share/themes directory, even temporarily. And the theme pack wouldn't exactly be running once the script the runs. It would only be linking a bunch of files until uninstalled, which would require a script to remove the symlinks.

LibeOffice Portable script:

Code: Select all

#!/bin/sh
#
# Launcher for 'portable' LibreOffice...
#
HERE="$(dirname "$(readlink -f "$0")")"
#
mkdir "$HERE/config" 2> /dev/null
mkdir "$HERE/config/libreoffice" 2> /dev/null
#
if [ -d "/root/.config/libreoffice" ]
then 
	rm -rf /root/.config/libreoffice
	ln -s $HERE/config/libreoffice /root/.config/libreoffice
else
	ln -s $HERE/config/libreoffice /root/.config/libreoffice
fi
#
"$HERE/LibreOffice64" "$@"
#
rm -rf /root/.config/libreoffice

geo_c
Old School Hipster, and Such

Post Reply

Return to “Package Collections/Repositories”