Skip to content
operational 52.6 KiB
Newer Older
Yuanle Song's avatar
Yuanle Song committed
* COMMENT -*- mode: org -*-
#+Date: 2019-11-12
Time-stamp: <2019-11-18>
Yuanle Song's avatar
Yuanle Song committed
#+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
Yuanle Song's avatar
Yuanle Song committed
dotnet run -- -n --target d:\backup
Yuanle Song's avatar
Yuanle Song committed
try an ssh run:

dotnet run -- -n --target root@sylecn01.emacsos.com:/data/backup/PC-backup/B75I3/
it works.

file list works.
ssh transfer works.
remote logging works.

Yuanle Song's avatar
Yuanle Song committed
read target from config file works. now I can just run
dotnet run -- -i

** 2019-11-12 docs                                                :documents:
- rsync
  https://www.samba.org/ftp/rsync/rsync.html
- Basic Editing in Visual Studio Code
  https://code.visualstudio.com/docs/editor/codebasics

  Get Started with F# in Visual Studio Code | Microsoft Docs
  https://docs.microsoft.com/en-us/dotnet/fsharp/get-started/get-started-vscode
  install Ionide-fsharp extension.
- Argu
  http://fsprojects.github.io/Argu/
  Tutorial
  http://fsprojects.github.io/Argu/tutorial.html
  --help doesn't work, need error handler.
  Argu/Program.fs at master · fsprojects/Argu · GitHub
  https://github.com/fsprojects/Argu/blob/master/samples/Argu.Samples.LS/Program.fs
- F#
  F# Language Reference - F# | Microsoft Docs
  https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/
  F# Collection Types - F# | Microsoft Docs
  https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/fsharp-collection-types
  Modules - F# | Microsoft Docs
  https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/modules
  https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/namespaces
  fsharp-cheatsheet
  https://dungpa.github.io/fsharp-cheatsheet/
  Literals - F# | Microsoft Docs
  https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/literals
  [|' '|] is an array of character, length is 1.
  F# list is not the same as array. You can convert array to list via Array.toList
Yuanle Song's avatar
Yuanle Song committed
  String Class (System) | Microsoft Docs
  https://docs.microsoft.com/en-us/dotnet/api/system.string?view=netframework-4.8
  Environment.SpecialFolder
  https://docs.microsoft.com/en-us/dotnet/api/system.environment.specialfolder?view=netframework-4.8
  ApplicationData
  LocalApplicationData
  MyDocuments
  MyPictures
  DesktopDirectory
  Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
  DateTime.ToString Method (System) | Microsoft Docs
  https://docs.microsoft.com/en-us/dotnet/api/system.datetime.tostring?view=netframework-4.8
  Standard Date and Time Format Strings | Microsoft Docs
  https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings?view=netframework-4.8
Yuanle Song's avatar
Yuanle Song committed
  The Option type | F# for fun and profit
  https://fsharpforfunandprofit.com/posts/the-option-type/
  Pattern Matching - F# | Microsoft Docs
  https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/pattern-matching
Yuanle Song's avatar
Yuanle Song committed
- FSharpLint
  http://fsprojects.github.io/FSharpLint/
  http://fsprojects.github.io/FSharpLint/index.html
- FSharp.Configuration
  http://fsprojects.github.io/FSharp.Configuration/
  dotnet add package FSharp.Configuration --version 1.5.0
  http://fsprojects.github.io/FSharp.Configuration/IniTypeProvider.html
  I will use the ini provider.
  user don't need to escape string or pay attension to spaces in ini file.
  this lib doesn't work with dotnet core 3.
- Formatted text using printf | F# for fun and profit
  https://fsharpforfunandprofit.com/posts/printf/
- Wix: a tool to create msi file
  WiX Toolset
  https://wixtoolset.org/
  Windows Installer XML (WiX)
  https://wixtoolset.org/documentation/manual/v3/main/

  To learn the basics, do read the WiX Tutorial.
  https://www.firegiant.com/wix/tutorial/
  https://www.firegiant.com/wix/tutorial/getting-started/

  Then you can follow the how-tos.
  How To Guides
  https://wixtoolset.org/documentation/manual/v3/howtos/

  How To: Implement a Major Upgrade In Your Installer
  https://wixtoolset.org/documentation/manual/v3/howtos/updates/major_upgrade.html
  Shortcut Element
  https://wixtoolset.org/documentation/manual/v3/xsd/wix/shortcut.html
  xml - Wix - ICE60 and ICE69 warnings - Stack Overflow
  https://stackoverflow.com/questions/21320334/wix-ice60-and-ice69-warnings/31192979
  From MSI to WiX, Part 10 – Shortcuts – Alex Shevchuk
  https://blogs.technet.microsoft.com/alexshev/2008/02/20/from-msi-to-wix-part-10-shortcuts/
  ICE errors
  https://docs.microsoft.com/en-us/windows/win32/msi/ice90
  https://docs.microsoft.com/en-us/windows/win32/msi/ice69

  CustomAction Element
  https://wixtoolset.org/documentation/manual/v3/xsd/wix/customaction.html

** 2019-11-13 install dir layout.
C:\Program Files\mbackup\rsync-w64\usr\bin\rsync.exe
C:\Program Files\mbackup\rsync-w64\usr\bin\ssh.exe
C:\Program Files\mbackup\publish\mbackup.exe
C:\Program Files\mbackup\publish\mbackup.dll

C:\ProgramData\mbackup\default-exclude.txt
C:\ProgramData\mbackup\default-list.txt
C:\ProgramData\mbackup\user-default-list.txt
C:\ProgramData\mbackup\mbackup-config.txt

C:\ProgramData\mbackup\local-list.txt
C:\ProgramData\mbackup\local-exclude.txt
Yuanle Song's avatar
Yuanle Song committed

- optional user configs
  C:\ProgramData\mbackup\local-list.txt
  C:\ProgramData\mbackup\local-exclude.txt
  - auto create these two files if they do not exist on target node.
    never overwrite existing file.

  - add shortcut to 3 files in start menu dir.
    mbackup/mbackup.exe
    mbackup/local-list.txt
    mbackup/local-exclude.txt
    mbackup/mbackup-config.txt
** 2019-11-14 notes                                             :development:
- Argu optional param support.

  if option Target is optional, when try to get its value, you should use

  results.TryGetResult Target
  or
  results.GetResult(Target, defaultValue = xxx)
Yuanle Song's avatar
Yuanle Song committed
- WiX wxs file
  <Package InstallerVersion="300" Compressed="yes" Platform="x64"/>
  Platform="x64" has the same meaning as candle -arch x64.

- Wix for creating installer for 64bit app, you need to add in <Component> attribute
  Win64="yes"

  use candle -arch x64 can add Win64="yes" automatically if there is no Win64 attribute specified in Component.
  wix3.6 - WiX Heat tool, create Component with Win64 attribute - Stack Overflow
  https://stackoverflow.com/questions/11981498/wix-heat-tool-create-component-with-win64-attribute
- Wix to install file in another name, add Name attribute in <File>.
  <File Id="mbackup.exe" Name="mbackup.exe" Source="bin\Release\netcoreapp3.0\win10-x64\mbackup-for-windows.exe" KeyPath="yes" Checksum="yes"/>
Yuanle Song's avatar
Yuanle Song committed
- vscode powershell integrated console is not the same as powershell.
  it doesn't read $profile, and can't run ". $profile" command.
  it's best to press + to create a regular powershell terminal.
Yuanle Song's avatar
Yuanle Song committed
* later                                                               :entry:
** TODO 2019-11-15 additionally support <My Documents>/mbackup/local-list.txt file.
This file is easier to open and backup.

no. programdata should be good enough.
but this is per user extra config file.
each user could have their own local file to backup.
one user don't want to manage all other user's local backup list.

yes. I should support this.

Both local.list and local.exclude.

- 2019-11-16 local.list is difficult to open in windows.
  use txt file instead for all file lists and ignore lists.

  like ~/.mbackup/ in linux
  <My Documents>/mbackup/local-list.txt
  <My Documents>/mbackup/local-exclude.txt

  If <My Documents>/mbackup/local-*.txt exists, it's merged to system level
Loading full blame...