Add files via upload

This commit is contained in:
iVAN 2023-03-13 03:26:27 +01:00 committed by GitHub
parent b97673d210
commit 037633f062
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,12 +2,13 @@
case "$1" in
''|'-h'|'--help')
echo "\n USAGE:\n\n junest-export {OPTION} {APPNAME}\n"
echo " EXAMPLES:\n\n junest-export --app celestia\n junest-export --bind-app kdenlive\n junest-export --sudo-app pamac-manager\n"
echo "\n USAGE:\n\n junest-export {OPTION} {APPNAME} {FLAG}\n"
echo " EXAMPLES:\n\n junest-export --app celestia\n junest-export --app kdenlive --media\n junest-export --app pamac-manager --sudo\n"
echo " OPTIONS:\n"
echo " --app/-a: export the app normally\n"
echo " --sudo-app/-sa: export an app requiring root privileges\n"
echo " --bind-app/-ba: export an app and made it use external drives\n"
echo " --app/-a: name of the application to export"
echo "\n FLAGS:\n"
echo " --media/-m: enable the support for drives mounted in /media"
echo " --sudo/-S: specify if the exported item should be run as sudo\n"
;;
'-a'|'--app')
if [ -n "$SUDO_COMMAND" ]; then echo -e "\n WARNING: You don't need to run the option '$1' with SUDO.\n"; exit; fi
@ -18,46 +19,24 @@ case "$1" in
launchername=$(ls ~/.cache/junest-export)
appbinary=$(cat ~/.cache/junest-export/$launchername | grep Exec | cut -c 6- | head -1)
appiconname=$(cat ~/.cache/junest-export/$launchername | grep Icon | cut -c 6- | head -1)
addmedia='"--bind /media /media"'
sed -i "s#Exec=$appbinary#Exec=sh -c '~/.local/share/junest/bin/junest -- $appbinary'#g" ~/.cache/junest-export/$launchername
mkdir -p ~/.local/share/applications
mv ~/.cache/junest-export/$launchername ~/.local/share/applications/
rm -R -f ~/.cache/junest-export
mkdir -p ~/.local/share/icons
ln -s ~/.junest/usr/share/icons/hicolor ~/.local/share/icons/hicolor > /dev/null 2>&1
cp ~/.junest/usr/share/pixmaps/*$appiconname* ~/.local/share/icons/ > /dev/null 2>&1
echo " $2 has been successfully exported!"
exit
done;;
'-sa'|'--sudo-app')
if [ -n "$SUDO_COMMAND" ]; then echo -e "\n WARNING: You don't need to run the option '$1' with SUDO.\n"; exit; fi
while [ -n "$1" ]
while [ -n "$3" ]
do
mkdir ~/.cache/junest-export
cp ~/.junest/usr/share/applications/*$2* ~/.cache/junest-export
launchername=$(ls ~/.cache/junest-export)
appbinary=$(cat ~/.cache/junest-export/$launchername | grep Exec | cut -c 6- | head -1)
appiconname=$(cat ~/.cache/junest-export/$launchername | grep Icon | cut -c 6- | head -1)
sed -i "s#Exec=$appbinary#Exec=sh -c '~/.local/share/junest/bin/junest -- sudo $appbinary'#g" ~/.cache/junest-export/$launchername
mkdir -p ~/.local/share/applications
mv ~/.cache/junest-export/$launchername ~/.local/share/applications/
rm -R -f ~/.cache/junest-export
mkdir -p ~/.local/share/icons
ln -s ~/.junest/usr/share/icons/hicolor ~/.local/share/icons/hicolor > /dev/null 2>&1
cp ~/.junest/usr/share/pixmaps/*$appiconname* ~/.local/share/icons/ > /dev/null 2>&1
echo " $2 has been successfully exported!"
exit
done;;
'-ba'|'--bind-app')
if [ -n "$SUDO_COMMAND" ]; then echo -e "\n WARNING: You don't need to run the option '$1' with SUDO.\n"; exit; fi
while [ -n "$1" ]
case "$3" in
'-S'|'--sudo') sed -i "s#junest --#junest -- sudo#g" ~/.cache/junest-export/$launchername; break;;
'-m'|'--media') sed -i "s#junest --#junest -b $addmedia --#g" ~/.cache/junest-export/$launchername; break;;
''|*) break;;
esac
done
while [ -n "$4" ]
do
mkdir ~/.cache/junest-export
cp ~/.junest/usr/share/applications/*$2* ~/.cache/junest-export
launchername=$(ls ~/.cache/junest-export)
appbinary=$(cat ~/.cache/junest-export/$launchername | grep Exec | cut -c 6- | head -1)
appiconname=$(cat ~/.cache/junest-export/$launchername | grep Icon | cut -c 6- | head -1)
addbind='"--bind /media /media"'
sed -i "s#Exec=$appbinary#Exec=sh -c '~/.local/share/junest/bin/junest -b $addbind -- $appbinary'#g" ~/.cache/junest-export/$launchername
case "$4" in
'-S'|'--sudo') sed -i "s#junest -b $addmedia --#jjunest -b $addmedia -- sudo#g" ~/.cache/junest-export/$launchername; break;;
'-m'|'--media') sed -i "s#junest -- sudo#junest -b $addmedia -- sudo#g" ~/.cache/junest-export/$launchername; break;;
''|*) break;;
esac
done
mkdir -p ~/.local/share/applications
mv ~/.cache/junest-export/$launchername ~/.local/share/applications/
rm -R -f ~/.cache/junest-export