#!/usr/bin/perl use strict; use warnings; use File::Glob ':glob'; my($install_dir_logical) = 'C:'; my($scriptname) = 'install_script.iss'; if($#ARGV > 0) { print "Usage: $0 > [install script.sh]\n"; print "Run from the directory innounp.exe created $scriptname into.\n"; print "Once run, you can review the generated shell install script\n"; print "Finally, run install script with target install directory as parameter\n"; print "(the directory your windows fake C: drive lives in).\n"; exit 1; } my $date = `date +'%F %T'`; chomp $date; my $defaultdirname; my $defaultdirname_logical; my $current_subkey = ''; my $setup_section = 0; my $files_section = 0; my $registry_section = 0; sub eval_check { my($check) = @_; # print STDERR "<$check>"; my(%atoms) = ( # What environment do we emulate? Should be configurable with parameters... 'IsWinXP' => 1, 'IsVISTA' => 0, 'IsWindows7' => 0, 'IsWindows32' => 1, 'IsWindows64' => 0, ); $check =~ s@\band\b@&&@gi; while(my($key, $value) = each(%atoms)) { $check =~ s@\b$key\b@$value@egi; } # print STDERR "=> <$check>\n"; eval $check; } sub esc_chars { # will change, for example, a!!a to a\!\!a $_[0] =~ s/([;<>\*\|`&\$!#\(\)\[\]\{\}:'" ])/\\$1/g; return $_[0]; } sub any_case { my($filename) = @_; $filename =~ s@([a-zA-Z])@"[".lc($1).uc($1)."]"@ge; $filename; } my(%created_dirs_cache) = (); open(SCRIPT, '<', $scriptname) or die "$scriptname not found"; print <<'EOF'; #/bin/sh -x INSTALL_DIR="$1" if [ ! -d "$INSTALL_DIR" -o ! -d "$INSTALL_DIR/windows" -o ! -d "$INSTALL_DIR/Program Files" ]; then echo "Usage: $0 [install dir]" exit 1 fi EOF while(defined(my $line =