Generate custom scripts with %jpackage_script

This commit is contained in:
Mikolaj Izdebski 2013-07-10 15:24:42 +02:00
parent 642b0665b4
commit 7e3acd46fc

View File

@ -210,53 +210,8 @@ install -m 644 dist/bshservlet-wbsh.war $RPM_BUILD_ROOT%{_datadir}/%{name}/webap
# scripts # scripts
install -d $RPM_BUILD_ROOT%{_bindir} install -d $RPM_BUILD_ROOT%{_bindir}
function bsh_script() { %jpackage_script jline.ConsoleRunner "\\${BSH_DEBUG:+-Ddebug=true}" bsh.Interpreter %{name}:jline %{name} true
local jars=%{name}.jar runclass= %jpackage_script bsh.Console "\\${BSH_DEBUG:+-Ddebug=true}" "" %{name} %{name}-console true
if [ $2 = jline.ConsoleRunner ] ; then
jars="$jars jline.jar"
runclass=bsh.Interpreter
fi
cat > $RPM_BUILD_ROOT%{_bindir}/$1 << EOF
#!/bin/sh
#
# $1 script
# JPackage Project (http://jpackage.sourceforge.net)
# Source functions library
_prefer_jre=true
. %{_datadir}/java-utils/java-functions
# Source system prefs
if [ -f %{_sysconfdir}/%{name}.conf ] ; then
. %{_sysconfdir}/%{name}.conf
fi
# Source user prefs
if [ -f \$HOME/.%{name}rc ] ; then
. \$HOME/.%{name}rc
fi
# Configuration
MAIN_CLASS=$2
if [ -n "\$BSH_DEBUG" ]; then
BASE_FLAGS=-Ddebug=true
fi
BASE_JARS="$jars"
# Set parameters
set_jvm
set_classpath \$BASE_JARS
set_flags \$BASE_FLAGS
set_options \$BASE_OPTIONS
# Let's start
run $runclass "\$@"
EOF
}
bsh_script bsh jline.ConsoleRunner
bsh_script bsh-desktop bsh.Console
cat > $RPM_BUILD_ROOT%{_bindir}/%{name}doc << EOF cat > $RPM_BUILD_ROOT%{_bindir}/%{name}doc << EOF
#!/usr/bin/env %{_bindir}/%{name} #!/usr/bin/env %{_bindir}/%{name}
@ -311,6 +266,7 @@ fi
- Remove group tags - Remove group tags
- Remove Requires on jpackage-utils - Remove Requires on jpackage-utils
- Remove Requires on coreutils - Remove Requires on coreutils
- Generate custom scripts with %%jpackage_script
* Thu Jun 06 2013 Michal Srb <msrb@redhat.com> - 0:1.3.0-25 * Thu Jun 06 2013 Michal Srb <msrb@redhat.com> - 0:1.3.0-25
- Enable tests - Enable tests