wok-current view get-e-uae/stuff/get-e-uae @ rev 24688
updated jhead (3.04 -> 3.06.0.1)
author | Hans-G?nter Theisgen |
---|---|
date | Sat Mar 12 13:31:56 2022 +0100 (2022-03-12) |
parents | 7cfacc80d067 |
children |
line source
1 #!/bin/sh
2 #
3 # get-e-uae - create and install SliTaz package e-uae
4 #
5 # (C) 2020 SliTaz - GNU General Public License v3.
6 # Author : HGT
7 # created: 2019-10-24
8 # modified by HGT on 2020-02-08
9 #
11 # === Initialisations ===
13 PKGS_DB="/var/lib/tazpkg" # packages database directory
14 PACKAGE="e-uae" # package to create and install
15 WEB_SITE="http://www.rcdrummond.net/uae/"
16 CATEGORY="system-tools"
17 TAGS="emulator"
19 # Declare functions check_root, status, ...
20 . /lib/libtaz.sh
21 # and make commandline options (if any) available as variables
23 is_installed()
24 {
25 if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
26 then #package is deemed to be installed
27 return 0
28 else
29 return 1
30 fi
31 }
34 # Show commandline options, if requested by --help
35 if [ "$help" == "yes" ]
36 then
37 echo "Commandline options:
38 $0
39 --version=<version>
40 --root=<path-to-root>
41 --install=yes|no
42 --keep=no|yes
43 --tmpdir=<directory-to-build-package>"
44 exit
45 fi
47 # Check for system administrator privileges
48 check_root
50 title "Package $PACKAGE will be build as SliTaz package and installed"
52 # Fetch latest version, unless version is set by option --version
53 [ -z "$version" ] && version="latest"
55 # Install SliTaz package, unless inhibited by option --install=no
56 [ -z "$install" ] && install="yes"
58 # Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
59 # unless option --keep=yes is given
60 [ -z "$keep" ] && keep="no"
62 # Directory for temporary files
63 TMP_DIR=$tmpdir
64 [ -z "$tmpdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
66 # Logging file (unused by now)
67 LOG=$logging_file
68 [ -z "$logging_file" ] && LOG=$TMP_DIR/get-$PACKAGE.log
70 cat <<EOT
71 Options in use:
72 root : $root/
73 version : $version
74 install package: $install
75 keep tazpkg : $keep
76 build directory: $TMP_DIR
78 EOT
80 separator; newline
82 # === Remove package, if installed ===
83 if is_installed
84 then
85 echo "$PACKAGE is already installed."
86 echo -n "Would you like to remove and reinstall this package [y/n]? "
87 read answer
88 case "$answer" in
89 y|Y)
90 action "Removing installed version..."
91 tazpkg remove $PACKAGE --root="$root/"
92 [ ! is_installed ] &&
93 die "Can't remove installed version. Exiting."
94 ;;
95 *)
96 echo "Leaving $PACKAGE untouched."
97 exit 0
98 ;;
99 esac
100 fi
102 # === Fetch archive file, if not existing ===
104 WGET_URL="https://snapshot.debian.org/archive/debian/20100605T162440Z/pool/contrib/e/$PACKAGE/"
106 if [ "$version" == "latest" ]
107 then
108 # wget --output-document=index $WGET_URL
109 # output to be scanned for latest version!
110 VERSION="0.8.29-WIP4-10"
111 else
112 VERSION=$version
113 fi
115 FILE="${PACKAGE}_${VERSION}_i386.deb"
116 WGET_URL="https://snapshot.debian.org/archive/debian/20100605T162440Z/pool/contrib/e/$PACKAGE/$FILE"
118 CUR_DIR=$(pwd)
119 mkdir -p $TMP_DIR
120 cd $TMP_DIR
121 if [ -f $FILE ]
122 then
123 echo "Using existing archive file $FILE"
124 else
125 action "Fetching the archive"
126 newline
127 wget --no-check-certificate $WGET_URL
128 if [ ! -f $FILE ]
129 then
130 cd $CUR_DIR
131 rm -rf $TMP_DIR
132 echo "Could not transfer $FILE from $WGET_URL. Exiting."
133 exit 1
134 fi
135 fi
137 action "Creating the package $PACKAGE..."
138 newline
139 # Convert from Debian format
140 tazpkg convert $FILE
142 # === Install the SliTaz package ===
143 [ "$install" == "yes" ] &&
144 tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
146 # === Cleanup ===
147 # Preserve package file, if requested
148 [ "$keep" == "yes" ] &&
149 ( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR &&
150 echo Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR )
152 # Remove temporary build directory
153 cd $CUR_DIR
154 rm -rf $TMP_DIR