package init

This commit is contained in:
tubalu 2019-12-14 14:47:41 +08:00
parent c231563a93
commit fdd8518752
6 changed files with 165 additions and 75 deletions

View File

@ -1,36 +0,0 @@
# gnome-initial-setup
#### Description
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

View File

@ -1,39 +0,0 @@
# gnome-initial-setup
#### 介绍
{**以下是码云平台说明,您可以替换此简介**
码云是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN。专为开发者提供稳定、高效、安全的云端软件开发协作平台
无论是个人、团队、或是企业,都能够用码云实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 码云特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

Binary file not shown.

74
gnome-initial-setup.spec Normal file
View File

@ -0,0 +1,74 @@
Name: gnome-initial-setup
Version: 3.30.0
Release: 2
Summary: A easy way to prepare a new system
License: GPLv2+
URL: https://wiki.gnome.org/Design/OS/InitialSetup
Source0: https://download.gnome.org/sources/gnome-initial-setup/3.30/gnome-initial-setup-%{version}.tar.xz
Source1: vendor.conf
Patch0000: honor-firstboot-disabled.patch
BuildRequires: krb5-devel desktop-file-utils intltool libpwquality-devel
BuildRequires: pkgconfig(libnm) >= 1.2 pkgconfig(gstreamer-1.0)
BuildRequires: pkgconfig(libnma) >= 1.0 pkgconfig(cheese)
BuildRequires: pkgconfig(accountsservice) pkgconfig(fontconfig)
BuildRequires: pkgconfig(gnome-desktop-3.0) pkgconfig(gweather-3.0)
BuildRequires: pkgconfig(cheese-gtk) >= 3.3.5 pkgconfig(goa-1.0)
BuildRequires: pkgconfig(geocode-glib-1.0) pkgconfig(goa-backend-1.0)
BuildRequires: pkgconfig(gtk+-3.0) >= 3.11.3 pkgconfig(glib-2.0) >= 2.53.0
BuildRequires: pkgconfig(gio-2.0) >= 2.53.0 pkgconfig(gio-unix-2.0) >= 2.53.0
BuildRequires: pkgconfig(gdm) pkgconfig(iso-codes) krb5-devel
BuildRequires: pkgconfig(libgeoclue-2.0) >= 2.3.1 pkgconfig(packagekit-glib2)
BuildRequires: pkgconfig(webkit2gtk-4.0) ibus-devel rest-devel polkit-devel
BuildRequires: libsecret-devel autoconf gnome-common
Requires: gdm geoclue2-libs >= 2.3.1 glib2 >= 2.53.0 polkit-js-engine libgnomekbd
Requires(pre): shadow-utils
Provides: user(%name)
%description
After acquiring or installing a new system there are a few essential things to
set up before use. It would be nice if GNOME had a simple, easy, and safe way to
prepare a new system.
%prep
%autosetup -p1
%build
autoreconf -i
%configure --enable-software-sources --with-vendor-conf-file=%{_datadir}/gnome-initial-setup/vendor.conf
%make_build
%install
%make_install
%delete_la
desktop-file-validate %{buildroot}%{_sysconfdir}/xdg/autostart/gnome-initial-setup-copy-worker.desktop
desktop-file-validate %{buildroot}%{_datadir}/gdm/greeter/applications/gnome-initial-setup.desktop
desktop-file-validate %{buildroot}%{_datadir}/gdm/greeter/applications/setup-shell.desktop
install -d %{buildroot}%{_datadir}/gnome-initial-setup
cp %{SOURCE1} %{buildroot}%{_datadir}/gnome-initial-setup/
%find_lang gnome-initial-setup
%pre
useradd -rM -d /run/gnome-initial-setup/ -s /sbin/nologin %{name} &>/dev/null || :
%files -f gnome-initial-setup.lang
%doc README COPYING
%{_libexecdir}/gnome-initial-setup*
%{_libexecdir}/gnome-welcome-tour
%{_sysconfdir}/xdg/autostart/*.desktop
%{_datadir}/gdm/greeter/applications/*.desktop
%{_datadir}/gnome-session/sessions/gnome-initial-setup.session
%{_datadir}/gnome-shell/modes/initial-setup.json
%{_datadir}/polkit-1/rules.d/20-gnome-initial-setup.rules
%dir %{_datadir}/gnome-initial-setup
%{_datadir}/gnome-initial-setup/vendor.conf
%changelog
* Wed Dec 11 2019 openEuler Buildteam <buildteam@openeuler.org> - 3.30.0-2
- Package init

View File

@ -0,0 +1,88 @@
From cfa7925f70ec44a976f6d0426133e3b8ba589142 Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Mon, 23 Jan 2017 19:42:44 +0100
Subject: [PATCH] Exit gracefully if we are disabled systemwide
Sysadmins might want to disable any kind of initial setup for their
users, perhaps because they pre-configure their environments. We
should provide an easy way to do it.
At least the anaconda installer provides an option to skip any kind
post-install setup tools so, for now we're only adding support for
that but more might be added in the future.
https://bugzilla.gnome.org/show_bug.cgi?id=777707
---
gnome-initial-setup/Makefile.am | 3 +-
gnome-initial-setup/gnome-initial-setup.c | 34 +++++++++++++++++++++++
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/gnome-initial-setup/Makefile.am b/gnome-initial-setup/Makefile.am
index 6b6d5fb..e6a3e10 100644
--- a/gnome-initial-setup/Makefile.am
+++ b/gnome-initial-setup/Makefile.am
@@ -12,7 +12,8 @@ AM_CPPFLAGS = \
-DUIDIR="\"$(uidir)\"" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DLIBLOCALEDIR=\""$(prefix)/lib/locale"\" \
- -DDATADIR=\""$(datadir)"\"
+ -DDATADIR=\""$(datadir)"\" \
+ -DSYSCONFDIR=\""$(sysconfdir)"\"
libexec_PROGRAMS = gnome-initial-setup gnome-initial-setup-copy-worker
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
index 414ea94..989827b 100644
--- a/gnome-initial-setup/gnome-initial-setup.c
+++ b/gnome-initial-setup/gnome-initial-setup.c
@@ -247,6 +247,31 @@ get_mode (void)
return GIS_DRIVER_MODE_NEW_USER;
}
+static gboolean
+initial_setup_disabled_by_anaconda (void)
+{
+ GKeyFile *key_file;
+ const gchar *file_name = SYSCONFDIR "/sysconfig/anaconda";
+ gboolean disabled = FALSE;
+ GError *error = NULL;
+
+ key_file = g_key_file_new ();
+ if (!g_key_file_load_from_file (key_file, file_name, G_KEY_FILE_NONE, &error)) {
+ if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) &&
+ !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)) {
+ g_warning ("Could not read %s: %s", file_name, error->message);
+ }
+ g_error_free (error);
+ goto out;
+ }
+
+ disabled = g_key_file_get_boolean (key_file, "General",
+ "post_install_tools_disabled", NULL);
+ out:
+ g_key_file_unref (key_file);
+ return disabled;
+}
+
int
main (int argc, char *argv[])
{
@@ -281,6 +306,15 @@ main (int argc, char *argv[])
skipped_pages = g_ptr_array_new_with_free_func ((GDestroyNotify) gtk_widget_destroy);
mode = get_mode ();
+ /* We only do this in existing-user mode, because if gdm launches us
+ * in new-user mode and we just exit, gdm's special g-i-s session
+ * never terminates. */
+ if (initial_setup_disabled_by_anaconda () &&
+ mode == GIS_DRIVER_MODE_EXISTING_USER) {
+ gis_ensure_stamp_files ();
+ exit (EXIT_SUCCESS);
+ }
+
/* When we are running as the gnome-initial-setup user we
* dont have a normal user session and need to initialize
* the keyring manually so that we can pass the credentials
--
2.19.0.rc0

3
vendor.conf Normal file
View File

@ -0,0 +1,3 @@
[pages]
skip=timezone
existing_user_only=language;keyboard