wok view get-dropbox/stuff/get-dropbox @ rev 23503

updated python-llfuse (0.38 -> 1.3.6)
author Hans-G?nter Theisgen
date Mon Apr 06 08:57:07 2020 +0100 (2020-04-06)
parents 44e5646831ce
children
line source
1 #!/bin/sh
2 #
3 # get-dropbox - create and install SliTaz package dropbox
4 #
5 # (C) 2020 SliTaz - GNU General Public License v3.
6 # Author : unknown
7 # modified by HGT on 2020-02-10
8 #
10 # === Initialisations ===
12 PKGS_DB="/var/lib/tazpkg" # packages database directory
13 PACKAGE="dropbox"
14 WEB_SITE="https://www.dropbox.com"
15 CATEGORY="non-free"
16 DEPENDS="python"
18 PLATFORM="lnx.x86" # or lnx.x86_64
20 # Declare functions check_root, status, ...
21 . /lib/libtaz.sh
22 # and make commandline options (if any) available as variables
24 is_installed()
25 {
26 if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
27 then #package is deemed to be installed
28 return 0
29 else
30 return 1
31 fi
32 }
34 # Show commandline options, if requested by --help
35 if [ "$help" == "yes" ]
36 then
37 echo "Commandline options:
38 $0
39 --root=<path-to-root>
40 --install=yes|no
41 --keep=no|yes
42 --tmpdir=<directory-to-build-package>"
43 exit
44 fi
46 # Check for system administrator privileges
47 check_root
49 title "Package $PACKAGE will be build as SliTaz package and installed"
51 # Fetch latest version, unless version is set by option --version (unusable by now)
52 [ -z "$version" ] && version="latest"
54 # Install SliTaz package, unless inhibited by option --install=no
55 [ -z "$install" ] && install="yes"
57 # Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
58 # unless option --keep=yes is given
59 [ -z "$keep" ] && keep="no"
61 # Directory for temporary files
62 TMP_DIR="$tmpdir"
63 [ -z "$tmpdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
65 # Logging file (unused by now)
66 LOG=$TMP_DIR/get-$PACKAGE.log
68 cat <<EOT
69 Options in use:
70 root : $root/
71 install package: $install
72 keep tazpkg : $keep
73 build directory: $TMP_DIR
75 EOT
77 separator; newline
79 # === Remove package, if installed ===
80 if is_installed
81 then
82 action "Removing installed version..."
83 tazpkg remove $PACKAGE --root="$root/"
84 [ ! is_installed ] &&
85 die "Can't remove installed version. Exiting."
86 fi
88 # === Fetch archive file, if not existing ===
89 if [ "$version" == "latest" ]
90 then
91 FILE=$PACKAGE-$PLATFORM.tar.gz
92 WGET_URL="$WEB_SITE/download?plat=$PLATFORM"
93 else
94 die "A version cannot be specified. Exiting."
95 fi
97 CUR_DIR=$(pwd)
98 mkdir -p $TMP_DIR
99 cd $TMP_DIR
100 if [ -f $FILE ]
101 then
102 echo "Using existing archive file $FILE"
103 else
104 action "Fetching the archive"
105 newline
106 wget --no-check-certificate -O $FILE $WGET_URL
107 if [ ! -f $FILE ]
108 then
109 cd $CUR_DIR
110 rm -rf $TMP_DIR
111 echo "Could not transfer $FILE from $WGET_URL. Exiting."
112 exit 1
113 fi
114 fi
116 # === Extract files from archive ===
117 action "Extracting the archive"
118 newline
120 tar xzf $FILE
121 status
123 # Remove archive file
124 rm -f $FILE
126 # === Create SliTaz package ===
128 VERSION="$(cat $TMP_DIR/.dropbox-dist/VERSION)"
130 mkdir -p $PACKAGE-$VERSION/fs/usr/lib
131 mkdir -p $PACKAGE-$VERSION/fs/usr/bin
132 mkdir -p $PACKAGE-$VERSION/fs/usr/share/applications
134 mv $TMP_DIR/.dropbox-dist $PACKAGE-$VERSION/fs/usr/lib/dropbox
135 strip $PACKAGE-$VERSION/fs/usr/lib/dropbox 2>/dev/null
137 # Customise Dropboxd
138 cat > $PACKAGE-$VERSION/fs/usr/lib/dropbox/dropboxd << "EOT"
139 #!/bin/sh
140 PAR=$(ls -d /usr/lib/dropbox/dropbox-lnx*)
141 LD_LIBRARY_PATH=$PAR:$LD_LIBRARY_PATH exec $PAR/dropboxd $@
142 EOT
144 # Create Desktop file
145 cat > $PACKAGE-$VERSION/fs/usr/share/applications/dropbox.desktop << EOT
146 [Desktop Entry]
147 Type=Application
148 Name=Dropbox Storage
149 Exec=dropboxd
150 Icon=dropbox
151 Terminal=false
152 Categories=Network
153 EOT
155 # Create symbolic links to have Dropbox in PATH and fake nautilus
156 cd $PACKAGE-$VERSION/fs/usr/bin
157 rm -f dropboxd nautilus
158 ln -s ../lib/dropbox/dropboxd .
159 ln -s /usr/bin/pcmanfm nautilus
161 cd $TMP_DIR
163 # Create recipe for SliTaz package
164 cat > $PACKAGE-$VERSION/receipt << EOT
165 # SliTaz package receipt.
167 PACKAGE="$PACKAGE"
168 VERSION="$VERSION"
169 CATEGORY="$CATEGORY"
170 SHORT_DESC="Dropbox daemon and client for online storage."
171 WEB_SITE="$WEB_SITE/"
173 SUGGESTED="ntlmaps"
174 DEPENDS="$DEPENDS"
175 EOT
177 action "Creating the package $PACKAGE..."
178 # Pack
179 tazpkg pack $PACKAGE-$VERSION
181 # Remove package tree
182 rm -rf $PACKAGE-$VERSION
184 # === Install the SliTaz package ===
185 [ "$install" == "yes" ] &&
186 yes y | tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
188 # === Cleanup ===
189 # Preserve package file, if requested
190 [ "$keep" == "yes" ] &&
191 ( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR &&
192 echo Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR )
194 # Remove temporary build directory
195 cd $CUR_DIR
196 rm -rf $TMP_DIR