Giter VIP home page Giter VIP logo

Comments (4)

n8marti avatar n8marti commented on July 21, 2024

Is the goal to backup these folders?

  • `AppData/Local/Logos/Data//
  • `AppData/Local/Logos/Documents//
  • `AppData/Local/Logos/Users//

And then maybe restore them by passing a new to the restore command to properly set the destination? Or, assuming Logos is already installed, the restore command could just find the (or could be saved as part of the config file, as I think @thw26 has already suggested)?

from logoslinuxinstaller.

thw26 avatar thw26 commented on July 21, 2024

Here is the relevant bash code:

https://github.com/ferion11/LogosLinuxInstaller/blob/a794912d7efdae86c7dc381a060fe32f09a9d019/Launcher-Template.sh#L178-L282

You need to find the Logos User, too, which is earlier in the code:

LOGOS_USER="\$(find "\${HERE}"/data/wine64_bottle/drive_c/users/*/AppData/Local/Logos -name Data | sed -r "s@\${HERE}/data/wine64_bottle/drive_c/users/(.*)/AppData/Local/Logos/Data@\1@")"; export LOGOS_USER;

Notice particularly here:

/drive_c/users/(.*)/AppData/Local/Logos/Data@\1@

This sed replaces the (.*) with \1, for clarity.

This UID is only available after logging in once.

The reason you need this is that the LOGOS_USER field is a random ID created on install, and therefore different every time. If you restore in an existing install, you need to restore to the same ID, but if you do a new install, that number changes.

So we could just back up the data files you linked, but how do we know which account to restore them to if we don't have the right UID?

The code does this:

  • You can see in the bash code that we first determine if the user has logged in (so that we have a working UID, likely placed in some local SQL database).
  • Then we set our source and destination dirs, using the Logos UID.
  • Then we determine the disk space and ask the user to confirm.
  • Then we sync.

If I could make this better, I would want to have our backups be timestamped and possibly set up rotation as well as hardlinks between backups, so as to minimize disk usage.

Then, ideally, we need to figure out someway of handling the Logos UID problem.

from logoslinuxinstaller.

n8marti avatar n8marti commented on July 21, 2024

On a new Logos install, if those 3 folders (and their contents) are present from a previous installation before Logos launches the first time, then Logos will start immediately rather than present the login window. So the randomly-named folder just under Data/, Documents/, and Users/ (called $LOGOS_UID in the bash script) can be reused across (re-)installations. Put another way, on a clean installation of Logos, the user doesn't have to first log in before we can restore those folders; they can be restored before login, and then the user will already be logged in when the app runs because the backed up files include the relevant account information. NOTE: This assumes that the backup set only includes files for a single Logos user.

We exploit this in the logos10-unofficial snap, where we allow Logos user data to be stored outside of Logo's wine folder tree (partly to solve the problem of data loss if the WINEPREFIX has to be reinstalled), but then just after Logos installation and just before it launches the first time, we create symlinks for those folders from that outside location (~/logos-data/) into where they should be in the wine folder tree:

# If ~/logos-data exists, ask user if they want to link to it.
if [[ -n "$SNAP_NAME" ]]; then
    home="$SNAP_REAL_HOME"
else
    home="$HOME"
fi
LOGOS_DATA="${home}/logos-data"
LOGOS_INSTALL_DIR=$(dirname "$LOGOS_EXE")
if [[ -d "$LOGOS_DATA" || -L "$LOGOS_DATA" ]]; then
    yad --title="Use existing Logos data folder?" --width=400 --center --auto-kill \
        --button=gtk-no:1 --button=gtk-yes:0 --borders=15 \
        --text="You have a Logos data folder at $LOGOS_DATA. Do you want to link this installation to it?"
    use_logos_data=$?
    if [[ $use_logos_data -eq 0 ]]; then
        # Symlink to $LOGOS_DATA.
        content_dirs=( "Data" "Documents" "Users" )
        for d in "${content_dirs[@]}"; do
            rm -rf "${LOGOS_INSTALL_DIR:?}/${d}"
            ln -s "$LOGOS_DATA/${d}" "${LOGOS_INSTALL_DIR}/${d}"
        done
    fi
fi

https://github.com/wasta-linux/logos10-snap/blob/5142180210d9e0cc47b1b7a5d47737e493b95ad3/hooks/post-install#L40C1-L61C3

The user runs logos10-unofficial, it prompts them about using data stored in ~/logos-data, if the user accepts, then those symlinks are made, Logos starts, and it opens right into the main app rather than the login window.

I don't personally know what happens if multiple Logos accounts are present on a single Logos installation. I assume that there would be multiple $LOGOS_UID folders within Data/, etc. But if we're only concerned about a single Logos account at a time, then I think we can ignore both $LOGOS_USER and $LOGOS_UID.

But maybe handling multiple accounts is important? You can find the $LOGOS_UID and user "Display Name" in Users/UserMetadata as JSON. So that would be the place to look first if someone has multiple accounts.

from logoslinuxinstaller.

thw26 avatar thw26 commented on July 21, 2024

So there is no need for an initial login? Interesting.

If the restore routine you have in place for the snap has been working, then let's just mirror it. I'm glad you have a symlink setup, too, as that saves a lot of disk.

from logoslinuxinstaller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.