Commit c78de815 authored by Yuanle Song's avatar Yuanle Song
Browse files

v0.5.1.0 apply GPLv3 license

parent 7b94212b
This diff is collapsed.
// Copyright (C) 2019 Yuanle Song <root@emacsos.com>
//
// This file is part of mbackup-for-windows.
//
// mbackup-for-windows is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// mbackup-for-windows is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along with
// mbackup-for-windows. If not, see <http://www.gnu.org/licenses/>.
module Mbackup.ConfigParser
open System
......
# Copyright (C) 2019 Yuanle Song <root@emacsos.com>
#
# This file is part of mbackup-for-windows.
#
# mbackup-for-windows is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# mbackup-for-windows is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# mbackup-for-windows. If not, see <http:#www.gnu.org/licenses/>.
[xml]$FSPROJ = Get-Content mbackup.fsproj
Write-Output $FSPROJ.Project.PropertyGroup.Version
// Copyright (C) 2019 Yuanle Song <root@emacsos.com>
//
// This file is part of mbackup-for-windows.
//
// mbackup-for-windows is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// mbackup-for-windows is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along with
// mbackup-for-windows. If not, see <http://www.gnu.org/licenses/>.
module Mbackup.Lib
open System
......
// Learn more about F# at http://fsharp.org
// Copyright (C) 2019 Yuanle Song <root@emacsos.com>
//
// This file is part of mbackup-for-windows.
//
// mbackup-for-windows is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// mbackup-for-windows is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along with
// mbackup-for-windows. If not, see <http://www.gnu.org/licenses/>.
//
// - mbackup config file
// %programdata%/mbackup/mbackup-config.txt
......@@ -254,7 +270,7 @@ let main argv =
let rsyncCmd =
let localExcludeFile = userConfigDir + MbackupFileName.LocalExclude
if File.Exists localExcludeFile then
let convertAbsPathToMingwStyle (line: string) =
let convertAbsPathToMingwStyle (line: string) =
if Regex.IsMatch(line, "[a-z]:", RegexOptions.IgnoreCase) then
toMingwPath line
else
......
mbackup for windows
====================
Intro
------
mbackup is a file backup tool based on [rsync](https://rsync.samba.org/).
It supports backup a list of files and dirs to local dir or remote ssh node.
Difference with rsync: rsync doesn't have an official windows build. rsync
doesn't support windows style path in source, target, and file lists. You can
run rsync in cygwin or msys2 shell. But usually it's painful to run it in
windows cmd or powershell directly. Mbackup is a thin wrapper around rsync,
with support for windows style path and bundled openssh client.
Installation
-------------
mbackup is written in F# and C# in dotnet core 3.
To install mbackup, get .NET Core Installer and .NET Core Desktop Installer
from [dotnet core 3](https://dotnet.microsoft.com/download/dotnet-core/3.0)
and install both.
Get mbackup msi installer from
https://emacsos.com/software/mbackup-for-windows and run it. I don't have a
key to sign the exe, you should verify sha256sum if you worry about file
integrity.
Backup List and Exclude lists
------------------------------
By default, the following files are backed up by mbackup:
- C:\ProgramData\mbackup
- C:\Docs
- D:\Docs
- <User>\Documents
- <User>\Desktop
- <User>\Downloads
- <User>\Pictures\Saved Pictures\
- <User>\<dot files>
By default, some files are ignored, such as iso, rar, zip, exe etc. mbackup is
designed to backup user created contents, not downloaded contents. That's why
archives and executables are excluded by default.
You can add more dirs to backup in %programdata%\mbackup\local-list.txt
Here are the backup list files and exclude pattern files:
- backup file list
%programdata%\mbackup\default-list.txt
%programdata%\mbackup\user-default-list.txt
%programdata%\mbackup\local-list.txt (managed by user)
- exclude pattern
%programdata%\mbackup\default-exclude.txt
%programdata%\mbackup\local-exclude.txt (managed by user)
local-list.txt and local-exclude.txt are managed by user and mbackup will not
modify those files when it is uninstalled or upgraded. The other lists are
shipped with mbackup and will be removed/overwritten when
uninstalling/upgrading mbackup.
To learn more about file list and exclude patterns, read rsync man page
https://download.samba.org/pub/rsync/rsync.html --files-from option,
--exclude-from option, and INCLUDE/EXCLUDE PATTERN RULES section.
How to Invoke mbackup
----------------------
mbackup for windows is designed to run automatically in the background via
Windows Task Scheduler (Win+R taskschd.msc). You can also run in from windows
cmd or powershell to trigger a backup immediately.
For the automatic backup to work, you need to specify a target in mbackup
config file.
Open mbackup config file %programdata%\mbackup\mbackup-config.txt,
To backup to local disk, add config
target=D:\backup
Replace D:\backup with the dir you want to save backup files to.
To backup to remote ssh node, add config
target=user@somehost.example.com:/path/to/dir
ssh-key=D:\path\to\id_rsa
Replace ssh-key path with your ssh private key. Since mbackup is designed to
run in the background, only ssh key based authentication (with no passphrase)
is supported. If you use password to login your server, you may learn
[how to set up ssh keys](https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2).
Save mbackup-config.txt file, now auto backup will work. The default scheduler
runs mbackup a few minutes after user logon and every 2 hours during
daytime. You can open Task Scheduler to check the scheduler.
Here is how to run it in cmd or powershell:
%programfiles%\mbackup\publish\mbackup.exe --help
%programfiles%\mbackup\publish\mbackup.exe
You can also drag the mbackup shortcut to cmd window:
C:\Users\Public\Desktop\mbackup.lnk --help
C:\Users\Public\Desktop\mbackup.lnk
You can also click mbackup.exe shortcut on desktop or start menu. The downside
is the window will auto close after mbackup finishes.
You can check mbackup run log in %localappdata%\mbackup\mbackup.log
License
--------
Copyright (C) 2019 Yuanle Song <sylecn@gmail.com>
This file is part of mbackup-for-windows.
mbackup-for-windows is free software: you can redistribute
it and/or modify it under the terms of the GNU General
Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any
later version.
mbackup-for-windows is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public
License along with this program. If not, see
<https://www.gnu.org/licenses/>.
<Project Sdk="Microsoft.NET.Sdk">
<!-- Copyright (C) 2019 Yuanle Song <root@emacsos.com> -->
<!-- This file is part of mbackup-for-windows. -->
<!-- mbackup-for-windows is free software: you can redistribute it and/or modify -->
<!-- it under the terms of the GNU General Public License as published by the -->
<!-- Free Software Foundation, either version 3 of the License, or (at your -->
<!-- option) any later version. -->
<!-- mbackup-for-windows is distributed in the hope that it will be useful, but -->
<!-- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -->
<!-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -->
<!-- more details. -->
<!-- You should have received a copy of the GNU General Public License along with -->
<!-- mbackup-for-windows. If not, see <http://www.gnu.org/licenses/>. -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
......@@ -6,7 +23,7 @@
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
<RootNamespace>Mbackup</RootNamespace>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>0.5.0.0</Version>
<Version>0.5.1.0</Version>
</PropertyGroup>
<ItemGroup>
......
<?xml version="1.0"?>
<!-- Copyright (C) 2019 Yuanle Song <root@emacsos.com> -->
<!-- This file is part of mbackup-for-windows. -->
<!-- mbackup-for-windows is free software: you can redistribute it and/or modify -->
<!-- it under the terms of the GNU General Public License as published by the -->
<!-- Free Software Foundation, either version 3 of the License, or (at your -->
<!-- option) any later version. -->
<!-- mbackup-for-windows is distributed in the hope that it will be useful, but -->
<!-- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -->
<!-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -->
<!-- more details. -->
<!-- You should have received a copy of the GNU General Public License along with -->
<!-- mbackup-for-windows. If not, see <http://www.gnu.org/licenses/>. -->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="3030B91E-5E3E-4151-9A69-B53B72690430" Version="$(var.Version)" Language="1033" Name="mbackup" Manufacturer="Yuanle Song">
<Package InstallScope="perMachine" InstallerVersion="300" Compressed="yes"/>
......
namespace mbackupw
// Copyright (C) 2019 Yuanle Song <root@emacsos.com>
//
// This file is part of mbackup-for-windows.
//
// mbackup-for-windows is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// mbackup-for-windows is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along with
// mbackup-for-windows. If not, see <http://www.gnu.org/licenses/>.
namespace mbackupw
{
partial class Form1
{
......
using System;
// Copyright (C) 2019 Yuanle Song <root@emacsos.com>
//
// This file is part of mbackup-for-windows.
//
// mbackup-for-windows is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// mbackup-for-windows is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along with
// mbackup-for-windows. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
......
// Copyright (C) 2019 Yuanle Song <root@emacsos.com>
//
// This file is part of mbackup-for-windows.
//
// mbackup-for-windows is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// mbackup-for-windows is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along with
// mbackup-for-windows. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Generic;
using System.Linq;
......
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<!-- Copyright (C) 2019 Yuanle Song <root@emacsos.com> -->
<!-- This file is part of mbackup-for-windows. -->
<!-- mbackup-for-windows is free software: you can redistribute it and/or modify -->
<!-- it under the terms of the GNU General Public License as published by the -->
<!-- Free Software Foundation, either version 3 of the License, or (at your -->
<!-- option) any later version. -->
<!-- mbackup-for-windows is distributed in the hope that it will be useful, but -->
<!-- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -->
<!-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -->
<!-- more details. -->
<!-- You should have received a copy of the GNU General Public License along with -->
<!-- mbackup-for-windows. If not, see <http://www.gnu.org/licenses/>. -->
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
......
......@@ -3,6 +3,22 @@
Time-stamp: <2019-11-18>
#+STARTUP: content
* notes :entry:
** 2019-11-12 mbackup for windows :featurereq:
- features
- DONE windows installer.
bundles mingw rsync and ssh.
they are NOT installed to PATH. so it will not affect other ssh programs.
- DONE backup file list;
user file list;
default exclude file list;
user exclude file list;
etc
They have different value compared to mbackup for linux.
- DONE script designed to run via windows scheduled task.
no service installed. no auto starts.
taskschd.msc
** 2019-11-13 how to run it in dev env?
dotnet run -- --dry-run --itemize-changes --target d:\backup
dotnet run -- -n -i --target d:\backup
......@@ -226,8 +242,40 @@ vscode should at least always indent using space for F#.
* current :entry:
**
** 2019-11-18 add dockerfile to create rsync mingw64 distribution,
then update Makefile and wix xml files to use that.
** 2019-11-18 TODO can I target .net fw instead of .net core?
this way windows 10 users should not require install any dependencies.
Does develop for .net fw require installing visual studio IDE?
Are there any code change required?
** 2019-11-18 add log rotate for %localappdata%\mbackup\mbackup.log
* done :entry:
** 2019-11-18 apply gpl.
rsync is gplv3. I will apply gplv3.
** 2019-11-12 make code work in a specific dir. then create an installer.
- bundle dotnet core 3 with installer.
- WONTFIX bundle dotnet core 3 with installer.
https://dotnet.microsoft.com/download/dotnet-core/3.0
Run apps - Runtime
.NET Core Desktop Installer: x64
The .NET Core Desktop Runtime is dependent on the .NET Core Runtime. Make
sure that .NET Core Runtime 3.0.0 is also installed.
That's 50MiB dependency.
- problems
- TODO will windows 10 apply security fixes for dotnet core 3 in windows
updates? this will decide whether bundle it is a good idea.
- in wix config, can I require dotnet core 3 and alert user to install it
first? open the dotnet core 3 download url.
search: wix require dotnet core 3
-
- DONE install binary files to %programfiles%
- DONE install mbackup config files to %programdata%
- DONE install scheduled tasks as admin. task will run as normal user.
......@@ -423,30 +471,6 @@ vscode should at least always indent using space for F#.
-
** 2019-11-12 mbackup for windows :featurereq:
- features
- windows installer.
bundles mingw rsync and ssh.
they are NOT installed to PATH. so it will not affect other ssh programs.
- backup file list;
user file list;
default exclude file list;
user exclude file list;
etc
They have different value compared to mbackup for linux.
- script designed to run via windows scheduled task.
no service installed. no auto starts.
taskschd.msc
- implementation.
- there is rsync running on B75I3.
exported tasksched.msc config as xml.
that XML is not portable.
it contains hostname.
-
* done :entry:
** 2019-11-12 how to test it? test it in a win 10 VM?
- search: lite weight win 10 VM
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment