summaryrefslogtreecommitdiff
path: root/tools/migration-scripts
diff options
authorBrandon Schaefer <brandon.schaefer@canonical.com>2014-08-26 16:17:51 -0700
committerBrandon Schaefer <brandon.schaefer@canonical.com>2014-08-26 16:17:51 -0700
commit4ef1eef9480ebfd5cc710b82d8d4968b84a0ed32 (patch)
tree923f1bbe58485093f6a24f503def992f1cd05f91 /tools/migration-scripts
parent4451e3a6d44d5fb287804a994b2a376ac0bc7e17 (diff)
* Create a migration script to move the old stamp to the new location
(bzr r3860.4.2)
Diffstat (limited to 'tools/migration-scripts')
-rwxr-xr-xtools/migration-scripts/03_unity_first_run_stamp_move35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/migration-scripts/03_unity_first_run_stamp_move b/tools/migration-scripts/03_unity_first_run_stamp_move
new file mode 100755
index 000000000..a2ecdf5f2
--- /dev/null
+++ b/tools/migration-scripts/03_unity_first_run_stamp_move
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2014 Canonical
+#
+# Authors:
+# Brandon Schaefer <brandon.schaefer@canonical.com>
+#
+# This program 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; version 3.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUTa
+# 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, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+from gi.repository import GLib
+from os import path, rename, mkdir
+
+old_first_run_path = GLib.get_user_cache_dir() + "/unity/first_run.stamp"
+new_first_run_path = GLib.get_user_config_dir() + "/unity"
+
+# If we have the old first_run.stamp file, we must move it to the new location
+if path.isfile(old_first_run_path):
+
+ # make sure the new dir exists before attempting to move
+ if not path.isdir(new_first_run_path):
+ mkdir(new_first_run_path)
+
+ new_first_run_path += "/first_run.stamp"
+ rename(old_first_run_path, new_first_run_path)