+# Create a new talk (--new flag).
+if ($new) {
+ my %files = (
+ "essay.txt" => {
+ mode => 0644,
+ desc => "essay and background notes",
+ c => 'Start by writing your thoughts in this file as an essay.
+
+You can then provide this as extra background reading material
+for your audience after the talk.'
+ },
+
+ "0010-introduction.html" => {
+ mode => 0644,
+ desc => "title slide",
+ c => '<link rel="stylesheet" href="style.css" type="text/css"/>
+<script src="code.js" type="text/javascript"></script>
+
+<div class="titlepage">
+<p>A Technical Talk</p>
+<author>by John Smith (jsmith@example.com)</author>
+</div>'
+ },
+
+ "0500-demonstration.html" => {
+ mode => 0644,
+ desc => "intro to demonstration slide",
+ c => '<link rel="stylesheet" href="style.css" type="text/css"/>
+<script src="code.js" type="text/javascript"></script>
+
+<h1>Demonstration</h1>
+
+<p>The next slide demonstrates a gnome terminal.</p>
+
+<p>Hit the UP arrow to access the preloaded history.</p>'
+ },
+
+ "0510-demonstration.sh" => {
+ mode => 0755,
+ desc => "shell demonstration slide",
+ c => '#!/bin/bash -
+source functions
+add_history ls -l
+add_history virt-df -a
+terminal --title="Demonstration terminal"'
+ },
+
+ "9900-conclusion.html" => {
+ mode => 0644,
+ desc => "last slide",
+ c => '<link rel="stylesheet" href="style.css" type="text/css"/>
+<script src="code.js" type="text/javascript"></script>
+
+<h1>Conclusions</h1>
+
+<p>The conclusion page</p>'
+ },
+
+ "functions" => {
+ mode => 0644,
+ desc => "shell script helper functions",
+ c => '# -*- shell-script -*-
+
+# Place any local environment variables and settings in "local".
+if [ -f local ]; then source local; fi
+
+export PS1=\'\\$ \'
+
+export HISTFILE=$talkdir/history
+
+rm -f $HISTFILE
+touch $HISTFILE
+
+add_history ()
+{
+ echo "$@" >> $HISTFILE
+}
+
+# Note: If you hand-configure gnome-terminal by adding a
+# new profile (eg. with larger fonts) then you can use that
+# profile here by replacing the --window flag with
+# --window-with-profile=ProfileName
+
+terminal ()
+{
+ chmod -w $HISTFILE
+ exec \\
+ gnome-terminal \\
+ --window \\
+ --geometry=+140+64 \\
+ --hide-menubar \\
+ --disable-factory \\
+ -e \'/bin/bash --norc\' \\
+ "$@"
+}
+'
+ },
+
+ "style.css" => {
+ mode => 0644,
+ desc => "HTML stylesheet",
+ c => 'body {
+ font-size: 28pt;
+ font-family: liberation, helvetica;
+}
+
+h1 {
+ font-size: 48px;
+ top: 8;
+ left: 0;
+ border-bottom: 2px solid #ccc;
+}
+
+div.titlepage {
+ margin-top: 100px;
+ text-align: center;
+}
+'
+ },
+ );
+
+ # Refuse to overwrite existing files.
+ foreach (sort keys %files) {
+ die "techtalk-pse: refusing to overwrite '$_'\n" if -f $_;
+ }
+
+ # Write the files.
+ foreach (sort keys %files) {
+ print "writing $_ ($files{$_}{desc}) ...\n";
+ open FILE, ">$_" or die "$_: open: $!";
+ print FILE $files{$_}{c} or die "$_: print: $!";
+ close FILE or die "$_: close: $!";
+ chmod $files{$_}{mode}, $_ or die "$_: chmod: $!";
+ }
+
+ exit 0;
+}
+