aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure4
-rwxr-xr-xponysay.py13
2 files changed, 13 insertions, 4 deletions
diff --git a/configure b/configure
index 4db81de..db6229d 100755
--- a/configure
+++ b/configure
@@ -223,6 +223,9 @@ function makeMakefile()
echo 'install "'"$file"'" "$(INSTALLDIR)/share/licenses/ponysay/'"$file"'"'
done
echo
+ echo -en '\t' ; echo 'mkdir -p $(DESTDIR)/var/cache/ponysay/'
+ echo -en '\t' ; echo 'chmod 777 $(DESTDIR)/var/cache/ponysay/'
+ echo
for completion in $completions; do
shell="${completion##*/}"
@@ -286,6 +289,7 @@ EOF
echo
echo 'uninstall:'
+ echo -en '\t' ; echo 'if [ -d "$(DESTDIR)/var/cache/ponysay" ]; then rm -rf "$(INSTALLDIR)/var/cache/ponysay"; fi'
for old in $installedDirs; do
echo -en '\t'
echo 'if [ -d "$(INSTALLDIR)/'"$old"'" ]; then rm -rf "$(INSTALLDIR)/'"$old"'"; fi'
diff --git a/ponysay.py b/ponysay.py
index 4696b01..65b8235 100755
--- a/ponysay.py
+++ b/ponysay.py
@@ -491,23 +491,28 @@ class Ponysay():
palettefile = env_kms.replace('\033]P', '')
kmsponies = '/var/cache/ponysay/kmsponies/' + palettefile
- kmspony = kmsponies + pony
+ kmspony = (kmsponies + pony).replace('//', '/')
if not os.path.isfile(kmspony):
protokmsponies = '/var/cache/ponysay/protokmsponies/'
- protokmspony = protokmsponies + pony
+ protokmspony = (protokmsponies + pony).replace('//', '/')
+
+ protokmsponydir = protokmspony[:protokmspony.rindex('/')]
+ kmsponydir = kmspony[: kmspony.rindex('/')]
_protokmspony = '\'' + protokmspony.replace('\'', '\'\\\'\'') + '\''
_kmspony = '\'' + kmspony.replace('\'', '\'\\\'\'') + '\''
_pony = '\'' + pony.replace('\'', '\'\\\'\'') + '\''
if not os.path.isfile(protokmspony):
- os.makedirs(protokmsponies)
+ if not os.path.isdir(protokmsponydir):
+ os.makedirs(protokmsponydir)
if not os.system('ponysay2ttyponysay < ' + _pony + ' > ' + _protokmspony) == 0:
sys.stderr.write('Unable to run ponysay2ttyponysay successfully, you need util-say for KMS support\n')
exit(1)
- os.makedirs(kmsponies)
+ if not os.path.isdir(kmsponydir):
+ os.makedirs(kmsponydir)
if not os.system('tty2colourfultty -e -p ' + palette + ' < ' + _protokmspony + ' > ' + _kmspony) == 0:
sys.stderr.write('Unable to run tty2colourfultty successfully, you need util-say for KMS support\n')
exit(1)