<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>http://wiki.codecivil.de/index.php?action=history&amp;feed=atom&amp;title=Remoteheader_script.sh</id>
	<title>Remoteheader script.sh - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.codecivil.de/index.php?action=history&amp;feed=atom&amp;title=Remoteheader_script.sh"/>
	<link rel="alternate" type="text/html" href="http://wiki.codecivil.de/index.php?title=Remoteheader_script.sh&amp;action=history"/>
	<updated>2026-04-30T08:46:46Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in codecivil</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>http://wiki.codecivil.de/index.php?title=Remoteheader_script.sh&amp;diff=20&amp;oldid=prev</id>
		<title>Codecivil am 29. März 2016 um 12:58 Uhr</title>
		<link rel="alternate" type="text/html" href="http://wiki.codecivil.de/index.php?title=Remoteheader_script.sh&amp;diff=20&amp;oldid=prev"/>
		<updated>2016-03-29T12:58:45Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Version vom 29. März 2016, 12:58 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Zeile 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;code lang=&amp;quot;bash&amp;quot;&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;nowiki&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/bin/sh&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/bin/sh&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;## original file name decryptkeydevice_script.sh&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;## original file name decryptkeydevice_script.sh&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l177&quot; &gt;Zeile 177:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 177:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	rm -f /etc/remoteheader/header 2&amp;gt;/dev/null&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	rm -f /etc/remoteheader/header 2&amp;gt;/dev/null&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;fi&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;fi&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;code&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;nowiki&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Codecivil</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.codecivil.de/index.php?title=Remoteheader_script.sh&amp;diff=19&amp;oldid=prev</id>
		<title>Codecivil am 29. März 2016 um 12:57 Uhr</title>
		<link rel="alternate" type="text/html" href="http://wiki.codecivil.de/index.php?title=Remoteheader_script.sh&amp;diff=19&amp;oldid=prev"/>
		<updated>2016-03-29T12:57:56Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Version vom 29. März 2016, 12:57 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Zeile 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;nowiki&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;code lang=&amp;quot;bash&amp;quot;&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/bin/sh&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/bin/sh&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;## original file name decryptkeydevice_script.sh&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;## original file name decryptkeydevice_script.sh&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l177&quot; &gt;Zeile 177:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 177:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	rm -f /etc/remoteheader/header 2&amp;gt;/dev/null&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	rm -f /etc/remoteheader/header 2&amp;gt;/dev/null&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;fi&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;fi&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;nowiki&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;code&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Codecivil</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.codecivil.de/index.php?title=Remoteheader_script.sh&amp;diff=18&amp;oldid=prev</id>
		<title>Codecivil: Die Seite wurde neu angelegt: „ &lt;nowiki&gt; #!/bin/sh ## original file name decryptkeydevice_script.sh ## modified for use for detached header by Marco Kühnel &lt;kuehnel@codecivil.de&gt; ## #### or…“</title>
		<link rel="alternate" type="text/html" href="http://wiki.codecivil.de/index.php?title=Remoteheader_script.sh&amp;diff=18&amp;oldid=prev"/>
		<updated>2016-03-29T12:57:13Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „ &amp;lt;nowiki&amp;gt; #!/bin/sh ## original file name decryptkeydevice_script.sh ## modified for use for detached header by Marco Kühnel &amp;lt;kuehnel@codecivil.de&amp;gt; ## #### or…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
## original file name decryptkeydevice_script.sh&lt;br /&gt;
## modified for use for detached header by Marco Kühnel &amp;lt;kuehnel@codecivil.de&amp;gt;&lt;br /&gt;
##&lt;br /&gt;
#### original header:&lt;br /&gt;
# original file name crypto-usb-key.sh&lt;br /&gt;
# heavily modified and adapted for &amp;quot;decryptkeydevice&amp;quot; by Franco&lt;br /&gt;
#&lt;br /&gt;
### original header :&lt;br /&gt;
#&lt;br /&gt;
# Part of passwordless cryptofs setup in Debian Etch.&lt;br /&gt;
# See: http://wejn.org/how-to-make-passwordless-cryptsetup.html&lt;br /&gt;
# Author: Wejn &amp;lt;wejn at box dot cz&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
# Updated by Rodolfo Garcia (kix) &amp;lt;kix at kix dot com&amp;gt;&lt;br /&gt;
# For multiple partitions&lt;br /&gt;
# http://www.kix.es/&lt;br /&gt;
#&lt;br /&gt;
# Updated by TJ &amp;lt;linux@tjworld.net&amp;gt; 7 July 2008&lt;br /&gt;
# For use with Ubuntu Hardy, usplash, automatic detection of USB devices,&lt;br /&gt;
# detection and examination of *all* partitions on the device (not just partition #1), &lt;br /&gt;
# automatic detection of partition type, refactored, commented, debugging code.&lt;br /&gt;
#&lt;br /&gt;
# Updated by Hendrik van Antwerpen &amp;lt;hendrik at van-antwerpen dot net&amp;gt; 3 Sept 2008&lt;br /&gt;
# For encrypted key device support, also added stty support for not&lt;br /&gt;
# showing your password in console mode.&lt;br /&gt;
&lt;br /&gt;
# define counter-intuitive shell logic values (based on /bin/true &amp;amp; /bin/false)&lt;br /&gt;
# NB. use FALSE only to *set* something to false, but don&amp;#039;t test for&lt;br /&gt;
# equality, because a program might return any non-zero on error&lt;br /&gt;
&lt;br /&gt;
# Updated by Dominique Bellenger &amp;lt;dev at domesdomain dot de&amp;gt;&lt;br /&gt;
# for usage with Ubuntu 10.04 Lucid Lynx&lt;br /&gt;
# - Removed non working USB device check&lt;br /&gt;
# - changed vol_id to blkid, changed sed expression&lt;br /&gt;
# - changed TRUE and FALSE to be 1 and 0&lt;br /&gt;
# - changed usplash usage to plymouth usage&lt;br /&gt;
# - removed possibility to read from an encrypted device (why would I want to do this? The script is unnecessary if I have to type in a password)&lt;br /&gt;
#&lt;br /&gt;
### original header END&lt;br /&gt;
&lt;br /&gt;
# read configuration settings&lt;br /&gt;
REMOTEHEADER_DISKID=&amp;quot;&amp;quot;&lt;br /&gt;
if [ -f /etc/remoteheader/remoteheader.conf ] ; then&lt;br /&gt;
		.  /etc/remoteheader/remoteheader.conf&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
TRUE=1&lt;br /&gt;
FALSE=0&lt;br /&gt;
&lt;br /&gt;
# set DEBUG=$TRUE to display debug messages, DEBUG=$FALSE to be quiet&lt;br /&gt;
#DEBUG=$TRUE&lt;br /&gt;
DEBUG=$FALSE&lt;br /&gt;
&lt;br /&gt;
PLYMOUTH=$FALSE&lt;br /&gt;
# test for plymouth and if plymouth is running&lt;br /&gt;
if [ -x /bin/plymouth ] &amp;amp;&amp;amp; plymouth --ping; then&lt;br /&gt;
        PLYMOUTH=$TRUE&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# is stty available? default false&lt;br /&gt;
STTY=$FALSE&lt;br /&gt;
STTYCMD=false&lt;br /&gt;
# check for stty executable&lt;br /&gt;
if [ -x /bin/stty ]; then&lt;br /&gt;
	STTY=$TRUE&lt;br /&gt;
	STTYCMD=/bin/stty&lt;br /&gt;
elif [ `(busybox stty &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; echo $?)` -eq 0 ]; then&lt;br /&gt;
	STTY=$TRUE&lt;br /&gt;
	STTYCMD=&amp;quot;busybox stty&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# print message to plymouth or stderr&lt;br /&gt;
# usage: msg &amp;quot;message&amp;quot; [switch]&lt;br /&gt;
# switch : switch used for echo to stderr (ignored for plymouth)&lt;br /&gt;
# when using plymouth the command will cause &amp;quot;message&amp;quot; to be&lt;br /&gt;
# printed according to the &amp;quot;plymouth message&amp;quot; definition.&lt;br /&gt;
# using the switch -n will allow echo to write multiple messages&lt;br /&gt;
# to the same line&lt;br /&gt;
msg ()&lt;br /&gt;
{&lt;br /&gt;
	if [ $# -gt 0 ]; then&lt;br /&gt;
		# handle multi-line messages&lt;br /&gt;
		echo $1 | while read LINE; do&lt;br /&gt;
			if [ $PLYMOUTH -eq $TRUE ]; then&lt;br /&gt;
				/bin/plymouth message --text=&amp;quot;$1 $LINE&amp;quot;		&lt;br /&gt;
			else&lt;br /&gt;
				# use stderr for all messages&lt;br /&gt;
				echo $LINE &amp;gt;&amp;amp;2&lt;br /&gt;
				#echo $3 &amp;quot;$2&amp;quot; &amp;gt;&amp;amp;2&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
	fi&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
dbg ()&lt;br /&gt;
{&lt;br /&gt;
	if [ $DEBUG -eq $TRUE ]; then&lt;br /&gt;
		msg &amp;quot;$@&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# read password from console or with plymouth&lt;br /&gt;
# usage: readpass &amp;quot;prompt&amp;quot;&lt;br /&gt;
readpass ()&lt;br /&gt;
{&lt;br /&gt;
	if [ $# -gt 0 ]; then&lt;br /&gt;
		if [ $PLYMOUTH -eq $TRUE ]; then&lt;br /&gt;
			PASS=`/bin/plymouth ask-for-password --prompt=&amp;quot;$1&amp;quot;`&lt;br /&gt;
		else&lt;br /&gt;
			[ $STTY -ne $TRUE ] &amp;amp;&amp;amp; msg &amp;quot;WARNING stty not found, password will be visible&amp;quot;&lt;br /&gt;
			echo -n &amp;quot;$1&amp;quot; &amp;gt;&amp;amp;2&lt;br /&gt;
			$STTYCMD -echo&lt;br /&gt;
			read -s PASS &amp;lt;/dev/console &amp;gt;/dev/null&lt;br /&gt;
			[ $STTY -eq $TRUE ] &amp;amp;&amp;amp; echo &amp;gt;&amp;amp;2&lt;br /&gt;
			$STTYCMD echo&lt;br /&gt;
		fi&lt;br /&gt;
	fi&lt;br /&gt;
	echo -n &amp;quot;$PASS&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# flag tracking header availability&lt;br /&gt;
OPENED=$FALSE&lt;br /&gt;
&lt;br /&gt;
# remoteheader configured so try to find a header&lt;br /&gt;
if [ ! -z &amp;quot;$REMOTEHEADER_DISKID&amp;quot; ]; then&lt;br /&gt;
	dbg &amp;quot;Checking devices for decryption header ...&amp;quot;&lt;br /&gt;
	# Is the USB driver loaded?&lt;br /&gt;
	cat /proc/modules | busybox grep usb_storage &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
	USBLOAD=0$?&lt;br /&gt;
	if [ $USBLOAD -gt 0 ]; then&lt;br /&gt;
		dbg &amp;quot;Loading driver &amp;#039;usb_storage&amp;#039;&amp;quot;&lt;br /&gt;
		modprobe usb_storage &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
	fi&lt;br /&gt;
	# Is the mmc_block driver loaded?&lt;br /&gt;
	cat /proc/modules | busybox grep mmc &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
	MMCLOAD=0$?&lt;br /&gt;
	if [ $MMCLOAD -gt 0 ]; then&lt;br /&gt;
		dbg &amp;quot;Loading drivers for &amp;#039;mmc&amp;#039;&amp;quot;&lt;br /&gt;
		modprobe mmc_core &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
		modprobe ricoh_mmc &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
		modprobe mmc_block &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
		modprobe sdhci &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	# give the system time to settle and open the devices&lt;br /&gt;
	sleep 5&lt;br /&gt;
&lt;br /&gt;
	for REMOTEHEADER_ID in $REMOTEHEADER_DISKID ; do&lt;br /&gt;
		REMOTEHEADER_FILE=&amp;quot;/dev/disk/by-id/$REMOTEHEADER_ID&amp;quot;&lt;br /&gt;
		dbg &amp;quot;Trying $REMOTEHEADER_FILE ...&amp;quot;&lt;br /&gt;
		if [ -e $REMOTEHEADER_FILE ] ; then&lt;br /&gt;
			dbg &amp;quot; found $REMOTEHEADER_FILE ...&amp;quot;&lt;br /&gt;
			OPENED=$TRUE&lt;br /&gt;
			break&lt;br /&gt;
		fi&lt;br /&gt;
		REMOTEHEADER_FILE=&amp;quot;&amp;quot;&lt;br /&gt;
	done&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
if [ $OPENED -eq $TRUE ]; then&lt;br /&gt;
	dbg &amp;quot;Copying header&amp;quot;&lt;br /&gt;
	/bin/dd if=$REMOTEHEADER_FILE of=/etc/remoteheader/header bs=$REMOTEHEADER_BLOCKSIZE skip=$REMOTEHEADER_SKIPBLOCKS count=$REMOTEHEADER_READBLOCKS 2&amp;gt;/dev/null &amp;amp;&amp;amp; &lt;br /&gt;
	/sbin/cryptsetup luksOpen $REMOTEHEADER_DEVICENAME_ENCRYPTED --header /etc/remoteheader/header $REMOTEHEADER_DEVICENAME_DECRYPTED &amp;amp;&amp;amp; &lt;br /&gt;
	/sbin/vgchange -ay	&lt;br /&gt;
	if [ $? -eq 0 ] ; then&lt;br /&gt;
		dbg &amp;quot;Opened devices.&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		msg &amp;quot;FAILED to decrypt using &amp;#039;$REMOTEHEADER_FILE&amp;#039; ...&amp;quot;&lt;br /&gt;
		OPENED=$FALSE&lt;br /&gt;
	fi&lt;br /&gt;
	# remove header independent of success:&lt;br /&gt;
	# at kernel upgrade the script will be executed with failure to open&lt;br /&gt;
	# luks device (already opened) and you don&amp;#039;t want to leave the header&lt;br /&gt;
	# on permanent storage&lt;br /&gt;
	rm -f /etc/remoteheader/header 2&amp;gt;/dev/null&lt;br /&gt;
fi&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Codecivil</name></author>
		
	</entry>
</feed>