mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-11-12 00:19:15 +00:00
Add confirmation before drive format
This commit is contained in:
parent
661ac4a95a
commit
c180add8be
|
@ -67,6 +67,12 @@ proc createMyNodeFsOnBlockDevice {blockDevice} {
|
|||
}
|
||||
|
||||
if [catch {
|
||||
puts "Waiting on format confirmation..."
|
||||
runCommand echo "drive_format_confirm" > /mnt/hdd/mynode/.mynode_status
|
||||
while { [file exists "/tmp/format_ok"] == 0 } {
|
||||
after 500
|
||||
}
|
||||
|
||||
puts "Creating new partition table on ${blockDevice}"
|
||||
runCommand echo "drive_formatting" > /mnt/hdd/mynode/.mynode_status
|
||||
runCommand /usr/bin/format_drive.sh ${blockDevice}
|
||||
|
|
|
@ -83,7 +83,7 @@ do
|
|||
# Clear status
|
||||
rm -f $MYNODE_DIR/.mynode_status
|
||||
mount_drive.tcl || true
|
||||
sleep 10
|
||||
sleep 5
|
||||
done
|
||||
|
||||
|
||||
|
|
|
@ -49,13 +49,14 @@ app.register_blueprint(mynode_vpn)
|
|||
app.register_blueprint(mynode_settings)
|
||||
|
||||
### Definitions
|
||||
STATE_DRIVE_MISSING = "drive_missing"
|
||||
STATE_DRIVE_FORMATTING = "drive_formatting"
|
||||
STATE_DRIVE_MOUNTED = "drive_mounted"
|
||||
STATE_QUICKSYNC_DOWNLOAD = "quicksync_download"
|
||||
STATE_QUICKSYNC_COPY = "quicksync_copy"
|
||||
STATE_QUICKSYNC_RESET = "quicksync_reset"
|
||||
STATE_STABLE = "stable"
|
||||
STATE_DRIVE_MISSING = "drive_missing"
|
||||
STATE_DRIVE_CONFIRM_FORMAT = "drive_format_confirm"
|
||||
STATE_DRIVE_FORMATTING = "drive_formatting"
|
||||
STATE_DRIVE_MOUNTED = "drive_mounted"
|
||||
STATE_QUICKSYNC_DOWNLOAD = "quicksync_download"
|
||||
STATE_QUICKSYNC_COPY = "quicksync_copy"
|
||||
STATE_QUICKSYNC_RESET = "quicksync_reset"
|
||||
STATE_STABLE = "stable"
|
||||
|
||||
MYNODE_DIR = "/mnt/hdd/mynode"
|
||||
BITCOIN_DIR = "/mnt/hdd/mynode/bitcoin"
|
||||
|
@ -137,6 +138,17 @@ def index():
|
|||
"ui_settings": read_ui_settings()
|
||||
}
|
||||
return render_template('state.html', **templateData)
|
||||
elif status == STATE_DRIVE_CONFIRM_FORMAT:
|
||||
if request.args.get('format'):
|
||||
os.system("touch /tmp/format_ok")
|
||||
time.sleep(1)
|
||||
return redirect("/")
|
||||
|
||||
templateData = {
|
||||
"title": "myNode Confirm Drive Format",
|
||||
"ui_settings": read_ui_settings()
|
||||
}
|
||||
return render_template('confirm_drive_format.html', **templateData)
|
||||
elif status == STATE_DRIVE_FORMATTING:
|
||||
templateData = {
|
||||
"title": "myNode Drive Formatting",
|
||||
|
|
|
@ -509,6 +509,21 @@ a:active {
|
|||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.format_div {
|
||||
width: 800px;
|
||||
color: #444444;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.format_button {
|
||||
width: 500px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#download-handle {
|
||||
width: 6em;
|
||||
height: 1.6em;
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html lang="en">
|
||||
<head>
|
||||
<title>{{ title }}</title>
|
||||
{% include 'includes/head.html' %}
|
||||
<meta http-equiv="refresh" content="30">
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#format-confirm").on("click", function() {
|
||||
window.location.href="/?format=1"
|
||||
});
|
||||
$("#reboot-device").on("click", function() {
|
||||
window.location.href="/settings/reboot-device"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% include 'includes/logo_header.html' %}
|
||||
|
||||
<div class="state_header">Drive Found</div>
|
||||
|
||||
<div class="format_div">
|
||||
<p>A new drive has been detected! This drive will be formatted for use by myNode.</p>
|
||||
<p><i>Note: All existing data will be lost. If this is not OK, remove the drive now and click Reboot.</i></p>
|
||||
<br/>
|
||||
<button id="format-confirm" value="Login" class="ui-button ui-widget ui-corner-all format_button">Format Drive</button>
|
||||
<br/><br/>
|
||||
<button id="reboot-device" value="Login" class="ui-button ui-widget ui-corner-all format_button">Reboot</button>
|
||||
|
||||
<br/><br/>
|
||||
</div>
|
||||
|
||||
<div style="height: 40px;"> </div>
|
||||
{% include 'includes/footer.html' %}
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user