#!/usr/bin/perl $rdir = "$ENV{'HOME'}/.hyplan"; $home = 'home'; $html = 'home.html'; $ENV{'KZB_PATH'} = 'styles/kinzb/'; $new = "\"*NEW*\""; # ''; $newd = 30; grep($strong{$_}++ && 0, 'align', 'vshnu', 'vshnucfg', 'webrowse', 'xtitle', 'z'); grep($em{$_}++ && 0, 'dumpdates', 'ftw', 'pop', 'push', 'rdistsumm', 'rename', 'rolllogs', 'starthttpd', 'vigrep', 'wh', 'width'); @catorder = ('webadm', 'Web Administration', 'web', 'Web Usage', 'unixadm', 'Unix Administration', 'unix', 'Unix Usage', 'unixuni', 'Unix Uniformity', 'unixcfg', 'Unix Configuration', 'vi', 'Vi/Vim', 'x11', 'X11', 'palm', 'Palm', 'homedir', 'Personal Home Directories Administration', 'hyplan', 'Personal Home Page Administration', 'refer', 'Reference', 'unknown', 'Unclassified', 'other', 'Other Authors'); %catlabel = @catorder; @catorder = grep(++$n % 2, @catorder); %catspec = (); %catdflt = ('etc', 'unixcfg', 'img', 'x11'); # mkhome - generate and install an HTML index of home directory files # Steve Kinzler, kinzler@cs.indiana.edu, Sep 94/Mar 98 # http://www.cs.indiana.edu/~kinzler/home.html#hyplan $cwd = "$rdir/$home"; chdir $cwd || die "$0: cannot chdir $cwd ($!)\n"; open(HTML, "> $rdir/$html") || die "$0: cannot open $rdir/$html ($!)\n"; while () { last if /__TAIL__/; print(HTML (s/^#include\s+`(.*)`\s*$/$1/) ? `$_` : $_); } $newt = time - $newd * 24 * 60 * 60; print HTML "\n" . <$new indicates that this file was added or changed within the last $newd days.

EOF unless (opendir(HOME, '.')) { warn "$0: cannot opendir $cwd ($!)\n"; } else { foreach (sort readdir HOME) { next if /^\.?\.?$/; if (-f) { (-T _ && (stat(_))[2] & 04) ? &dofile($_, (stat(_))[9]) : warn "$0: $cwd/$_ isn't world readable text\n"; } elsif (-d _) { warn("$0: cannot opendir $cwd/$dir ($!)\n"), next unless opendir(DIR, $dir = $_); foreach (sort readdir DIR) { next if /^\.?\.?$/; &dofile("$dir/$_", (stat(_))[9]) if ! -l "$dir/$_" && -f "$dir/$_" && (-T _ || /\.pdf$/) && (stat(_))[2] & 04; } closedir DIR; } else { warn "$0: $cwd/$_ isn't a file or directory\n"; } } closedir HOME; foreach $cat (@catorder) { if (@cat = grep($_ ne '', split(/\001/, $cat{$cat}))) { warn "$0: warning, unclassified filesets (@cat)\n" if $cat eq 'unknown'; print HTML "\n", `htmlbit sect`, "

$catlabel{$cat}", "

\n\n\n"; } } } while () { print(HTML (s/^#include\s+`(.*)`\s*$/$1/) ? `$_` : $_); } close HTML; ############################################################################### sub dofile { local($file, $mtime) = @_; local($item, $key, $cat, $junk) = ('', '', '', ''); ($key = $file) =~ s,.*/,,; $key =~ s/^\.*([^.]*).*/$1/; warn("$0: cannot open $cwd/$file ($!)\n"), return unless open(FILE, $file); $item = "$file"; while () { $junk = $1, $item =~ s/href="[^"]*/href="$junk/ if /^;?[!#"] see website (\S+)/i; $item !~ /\n- / && ($item .= "\n- " . &htmlencode($1)) if /^;?[!#"] \S+ --? (\S.*)/ || /^-- \S+ --? (\S.*)/ || /^$key \\- (\S.*)/ || /^\s*<[Pp]>\s*$key - (\S.*)<\/[Pp]>\s*$/ || /^\s*\s*$/; $cat = $1, last if /\/$html#(\w+)/o; } close FILE; $item = "$item" if $em{$key}; $item = "$item" if $strong{$key}; $item = "
  • $item\n"; $item .= "$new\n" if $new && $mtime >= $newt; $cat = $catspec{$key} if $cat eq ''; $cat = $catdflt{(grep($file =~ m;^$_/;, keys %catdflt))[0]} if $cat eq ''; $cat = 'unknown' if $cat eq ''; warn("$0: unknown category ($cat) in $file\n"), $cat = 'unknown' if $catlabel{$cat} eq ''; if ($file{$key} eq '') { $file{$key} = $file; $item{$file} = $item; $cat{$cat} .= "\001$file"; } else { $item{$file{$key}} .= $item; } } sub htmlencode { local($_, $mlm) = (join('', @_), $*); $* = 1; s/&/&/g; s//>/g; $* = $mlm; return $_; } ############################################################################### __END__ Steve Kinzler - Home Directory #include `htmlbit body | sed 's/100%"/& align=center/; s/serif"/& size="+2"/'` Steve Kinzler's Home Directory #include `htmlbit sect`

    These are some scripts, configuration files and man pages from my Unix/X Window System home environment. They were developed and collected to allow me to maintain an enhanced, consistent home environment across many varieties of Unix and many separate home directories. As such, they generally favor portability over efficiency and restrict themselves to ubiquitous Unix tools when possible, but take advantage of better tools when available. As a systems administrator in a heterogenous environment, I've found them to be useful.

    Feel free to browse and borrow from these files as you wish. I'm afraid there's often little or no documentation or comments, so you may be on your own to figure out what some of them are good for. Most of my scripts (ie, except those in the "Other Authors" section) will only print a usage message if run with a -h flag. Most of the scripts will port "as is" to most versions of Unix and have any configuration options specified at the top of the script file.

    Note: Please observe any copyrights in these files. If none is given for a particular file, an implicit copyright by the author may be presumed which permits copying, modification and redistribution and with any express or implied warranties disclaimed (ie, use at your own risk).

    Thumbnail of Desktop A screenshot of my typical desktop. [.gif, 317 KB, 1280x1024]

    __TAIL__ #include `htmlbit sect`

    The Unix System Administration Webring
    [Home] [Next] [Prev] [Random] [List]

    This document is generated daily with mkhome.

    #include `htmlbit tail | sed 's/"[^"]*">@@