Browse Source

add a point where it kinda works, but the blog layout is still

duplicated..  This is to freeze a working version before I try
to make macros work via call blocks...
main
John-Mark Gurney 3 years ago
parent
commit
fe44674e0b
9 changed files with 290 additions and 0 deletions
  1. +73
    -0
      content/2014/10/building-bhyve-images-using-makefs-and.html
  2. +3
    -0
      content/2014/10/meta.yaml
  3. +6
    -0
      content/index.html
  4. +1
    -0
      content/media/meta.yaml
  5. +28
    -0
      layout/article.j2
  6. +92
    -0
      layout/base.j2
  7. +35
    -0
      layout/blog.j2
  8. +21
    -0
      layout/frontpage.j2
  9. +31
    -0
      layout/macros.j2

+ 73
- 0
content/2014/10/building-bhyve-images-using-makefs-and.html View File

@@ -0,0 +1,73 @@
---
title: Building bhyve Images using makefs and mkimg
description: >
this is a test blog post and a sample for things
created: !!timestamp '2014-10-29'
tags:
- bhyve
- FreeBSD
---

Recently Neel Natu [committed](https://svnweb.freebsd.org/changeset/base/r273375)
work to enable bhyve to run on AMD processors. My main development
machine is an AMD A10-5700, so the commit enables me to use bhyve for
testing.

EDIT: Anish Gupta did the work that Neel Natu commited. Thanks Anish!

I had previously built images using makefs and mkimg for a CF card for
use in another machine, so being able to build images to use with bhyve
makes sense.

First, you need to make sure that you have a complete source check out
along with a completed buildworld and buildkernel. Then follow these steps:

1. Install world and distribution into a temporary directory using the `NO_ROOT` option:
<pre>```
make installworld DESTDIR=<tmpdir> -DDB_FROM_SRC -DNO_ROOT
make distribution DESTDIR=<tmpdir> -DDB_FROM_SRC -DNO_ROOT
```</pre>
This preps everything with the defaults as necessary.
2. Install a kernel either into a different directory (I do this) or into the same directory above:
<pre>```
make installkernel DESTDIR=<tmpkerndir> -DNO_ROOT KERNCONF=<conf>
```</pre>
3. Make a directory with your custom configuration files. The basics
are `/etc/rc.conf` and `/etc/fstab` and you might want `/firstboot` on
there too. You will also need a METALOG file which contains the
permissions for the files. This is just a standard mtree file, so
you could use mtree to generate this instead of creating it by hand.
The file contents are below.
4. Build the ufs image using the `makeroot.sh` script in the src tree at `tools/tools/makeroot/makeroot.sh`:
<pre>```
/usr/src/tools/tools/makeroot/makeroot.sh -e <custdir>/METALOG -e <tmpkerndir>/METALOG -p <tmpdir>/etc/master.passwd -s 2g ufs.img root
```</pre>
5. Build the disc image:
<pre>```
mkimg -s gpt -b <tmpdir>/boot/pmbr -p freebsd-boot:=<tmpdir>/boot/gptboot -p freebsd-swap::1G -p freebsd-ufs:=ufs.img -o disc.img
```</pre>
6. Run the image:
<pre>```
sh /usr/share/examples/bhyve/vmrun.sh -d disc.img vm0
```</pre>

There you have it. Besides running the image, all the other steps can
be done as a normal user w/o root access.

EDIT: You also might want to include an `/entropy` file (populated with 4k
from `/dev/random`) in your custom directory so that the image has a good
seed for entropy at first boot for things such as sshd key generation.

File contents:

* `/etc/fstab`:
<pre>```
/dev/vtbd0p3 / ufs rw 1 1
```</pre>
* Custom `METALOG`:
<pre>```
#mtree 2.0
./etc/rc.conf type=file uname=root gname=wheel mode=0644
./etc/fstab type=file uname=root gname=wheel mode=0644
./firstboot type=file uname=root gname=wheel mode=0644
```</pre>

+ 3
- 0
content/2014/10/meta.yaml View File

@@ -0,0 +1,3 @@
extends: blog.j2
default_block: post
listable: true

+ 6
- 0
content/index.html View File

@@ -0,0 +1,6 @@
---
title: encthenet Ramblings
description: Blog of John-Mark Gurney
extends: frontpage.j2
listable: false
---

+ 1
- 0
content/media/meta.yaml View File

@@ -0,0 +1 @@
extends: false

+ 28
- 0
layout/article.j2 View File

@@ -0,0 +1,28 @@
<article class="post">

<h1><a class="no-tufte-underline" href="{{ res.url }}">{{ res.meta.title }}</a></h1>

<p>Posted: {{ res.meta.created.strftime('%B %e, %Y') }}</p>

{% if res.meta.tags %}
<ul class="tags clear">
{% for tag in res.meta.tags %}
<li>
<a class="small" href="{{ content_url('blog/tags/'~tag~'.html') }}">
{{ tag }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
<div class="clear"/>
{% refer to res.relative_path as post %}
{{ post.post|markdown|typogrify }}
{#
{% filter markdown|typogrify -%}
{% mark post -%}
{% block post -%}{%- endblock %}
{%- endmark %}
{%- endfilter %}
#}
</article>

+ 92
- 0
layout/base.j2 View File

@@ -0,0 +1,92 @@
<!doctype html>
<!-- https://github.com/paulirish/html5-boilerplate/blob/master/index.html -->
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if (gte IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head>
{% block starthead %}{% endblock starthead %}
<meta charset="{{ resource.meta.charset }}">

<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
Remove this if you use the .htaccess -->
<meta http-equiv="X-UA-Compatible" content="{{ resource.meta.compatibility }}">

<!-- encoding must be specified within the first 512 bytes
www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#charset -->

<!-- meta element for compatibility mode needs to be before
all elements except title & meta
msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx -->
<!-- Chrome Frame is only invoked if meta element for
compatibility mode is within the first 1K bytes
code.google.com/p/chromium/issues/detail?id=23003 -->

<!-- automatically refresh, add/remove closing comment to enable/disable
<meta http-equiv="refresh" content="2">
<!-- end comment for above refresh -->

<!-- Twitter cards, OpenGraph and Slack unfurling -->
<meta name="twitter:card" content="summary" />
{% if resource.meta.twittertitle %}
<meta property="og:title" content="{{ resource.meta.twittertitle }}" />
{% else %}
<meta property="og:title" content="{{ resource.meta.title }}" />
{% endif %}
<meta property="og:description" content="{{ resource.meta.description }}" />
{% if resource.meta.image %} <meta property="og:image" content="{{ resource.meta.image }}" />{% endif %}
{% if resource.meta.imagealt %} <meta name="twitter:image:alt" content="{{ resource.meta.imagealt }}" />{% endif %}
{% if resource.meta.twitterlabel1 %} <meta name="twitter:label1" content="{{ resource.meta.twitterlabel1 }}" />{% endif %}
{% if resource.meta.twitterlabel2 %} <meta name="twitter:label2" content="{{ resource.meta.twitterlabel2 }}" />{% endif %}
{% if resource.meta.twitterdata1 %} <meta name="twitter:data1" content="{{ resource.meta.twitterdata1 }}" />{% endif %}
{% if resource.meta.twitterdata2 %} <meta name="twitter:data2" content="{{ resource.meta.twitterdata2 }}" />{% endif %}

<title>{% block title %}{{ resource.meta.title }}{% endblock %}</title>
<meta name="description" content="{{ resource.meta.description }}">
<meta name="author" content="{{ resource.meta.author }}">

<!-- Mobile viewport optimized: j.mp/bplateviewport -->
<meta name="viewport" content="{{ resource.meta.viewport }}">

{% block css %}
<link rel="stylesheet" href="{{ media_url('css/tufte.css') }}">
{% endblock css %}
{% block endhead %}{% endblock endhead %}
</head>

<body id="{{ resource.meta.id if resource.meta.id else resource.slug }}">
{% block content %}
<div class="site" id="main" role="main">
{% block container %}
<header class="banner clearfix title">
{% block header -%}
<h1>{{ site.context.title }}</h1>
{%- endblock %}
</header>
{% block main %}
{% endblock main %}
{% endblock container %}
<footer>
<div class="footer">
<div class="contact">
<ul>
<li><a href="https://twitter.com/{{ site.context.tweet_via }}">Twitter</a></li>
</ul>
</div>
</div>
</footer>
</div>
{% endblock content%}
{% block js %}
<!-- Javascript at the bottom for fast page loading -->

{% block scripts %}
{% endblock scripts %}


<!--[if lt IE 7 ]>
<script src="js/libs/dd_belatedpng.js"></script>
<script>DD_belatedPNG.fix('img, .png_bg'); // Fix any <img> or .png_bg bg-images. Also, please read goo.gl/mZiyb </script>
<![endif]-->

{% endblock js %}
</body>
</html>

+ 35
- 0
layout/blog.j2 View File

@@ -0,0 +1,35 @@
{% from "macros.j2" import render with context %}
{% extends "base.j2" %}

{% block main -%}
starting test
{% include "article.j2" %}
ending test

<article class="post">

<h1><a class="no-tufte-underline" href="{{ resource.url }}">{{ resource.meta.title }}</a></h1>

<p>Posted: {{ resource.meta.created.strftime('%B %e, %Y') }}</p>

{{ resource.meta.created.tz }}
{% if resource.meta.tags %}
<ul class="tags clear">
{% for tag in resource.meta.tags %}
<li>
<a class="small" href="{{ content_url('blog/tags/'~tag~'.html') }}">
{{ tag }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
<div class="clear"/>
{% filter markdown|typogrify -%}
{% mark post -%}
{% block post -%}{%- endblock %}
{%- endmark %}
{%- endfilter %}
</article>

{%- endblock %}

+ 21
- 0
layout/frontpage.j2 View File

@@ -0,0 +1,21 @@
{% extends "base.j2" %}
{% from "macros.j2" import render with context %}
{% block main %}
<!--
{% block page_title %}<h1 class="title">{{ resource.meta.title }}</h1>{% endblock %}
-->
{% for res in resource.node.walk_resources_sorted_by_time()[0:1] %}

block test

prerender macro

{% include "article.j2" %}

old data
<h1><a href="{{ res.relative_path }}">{{ res.meta.title }}</a></h1>
{% refer to res.relative_path as post %}
{{ post.post|markdown|typogrify }}
{% endfor %}

{% endblock %}

+ 31
- 0
layout/macros.j2 View File

@@ -0,0 +1,31 @@
{% macro render(res) %}
{% refer to res.relative_path as post %}
<article class="post">

<h1><a class="no-tufte-underline" href="{{ res.url }}">{{ res.meta.title }}</a></h1>

<p>Posted: {{ res.meta.created.strftime('%B %e, %Y') }}</p>

{% if res.meta.tags %}
<ul class="tags clear">
{% for tag in res.meta.tags %}
<li>
<a class="small" href="{{ content_url('blog/tags/'~tag~'.html') }}">
{{ tag }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
<div class="clear"/>
{% refer to res.relative_path as post %}
{{ post.post|markdown|typogrify }}
{#
{% filter markdown|typogrify -%}
{% mark post -%}
{% block post -%}{%- endblock %}
{%- endmark %}
{%- endfilter %}
#}
</article>
{% endmacro %}

Loading…
Cancel
Save