-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun
executable file
·103 lines (86 loc) · 2.67 KB
/
run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/sh
#
# Little helper script that installs all dependencies for RedNotebook and runs
# it without installing. The script should work on all Ubuntu and Debian based
# distros, Fedora and OpenSUSE.
#
# Most of the code was taken from the gnome-shell build script.
# Copyright (C) 2008, Red Hat, Inc.
#
#set -e # Cannot be set, because the check for python may fail and we want to continue.
# Change into RedNotebook directory --------------------------------------------
BASEDIR="$(dirname "$0")"
cd $BASEDIR
# Install dependencies ---------------------------------------------------------
PKGS_DEB="python-gtk2 python-gtkspell python-yaml python-webkit"
PKGS_FEDORA="pygtk2 gnome-python2-extras PyYAML pywebkitgtk"
PKGS_OPENSUSE="python-gtk python-yaml python-webkitgtk"
release_file=
if which lsb_release > /dev/null 2>&1; then
system=`lsb_release -is`
version=`lsb_release -rs`
elif [ -f /etc/fedora-release ] ; then
system=Fedora
release_file=/etc/fedora-release
elif [ -f /etc/SuSE-release ] ; then
system=SUSE
release_file=/etc/SuSE-release
fi
if [ x$release_file != x ] ; then
version=`sed 's/[^0-9\.]*\([0-9\.]\+\).*/\1/' < $release_file`
fi
if test "x$system" = xUbuntu -o "x$system" = xDebian -o "x$system" = xLinuxMint ; then
reqd=$PKGS_DEB
if [ ! -x /usr/bin/dpkg-checkbuilddeps ]; then
echo "Please run 'sudo apt-get install dpkg-dev' and try again."
echo
exit 1
fi
for pkg in $reqd ; do
if ! dpkg-checkbuilddeps -d $pkg /dev/null 2> /dev/null; then
missing="$pkg $missing"
fi
done
if test ! "x$missing" = x; then
echo "You need to enter your password to install the missing packages $missing"
sudo apt-get install $missing
fi
fi
if test "x$system" = xFedora ; then
reqd=$PKGS_FEDORA
for pkg in $reqd ; do
if ! rpm -q $pkg > /dev/null 2>&1; then
missing="$pkg $missing"
fi
done
if test ! "x$missing" = x; then
gpk-install-package-name $missing
fi
fi
if test "x$system" = xSUSE -o "x$system" = "xSUSE LINUX" ; then
reqd=""
for pkg in $PKGS_OPENSUSE ; do
if ! rpm -q $pkg > /dev/null 2>&1; then
reqd="$pkg $reqd"
fi
done
if test ! "x$reqd" = x; then
echo "Please run 'su --command=\"zypper install $reqd\"' and try again."
echo
exit 1
fi
fi
# Run RedNotebook with the newest python2 version available --------------------
for PYTHON in python2.7 python2.6; do
echo Checking for $PYTHON
# Returns 0 if command is found.
command -v $PYTHON >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo Running $PYTHON
$PYTHON -V
$PYTHON rednotebook/journal.py "$@"
exit 0
fi
done
echo Error: No python interpreter found.
exit 1