Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
papweb [2011/06/20 08:28] saitMoh créée |
papweb [2023/07/18 23:11] (Version actuelle) |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ==== Configuration d'un Point d' | + | ====== Configuration d'un Point d' |
- | === Objectifs === | + | ===== Objectifs |
Mettre à la disposition du public des lieux publics (MPT, MJC, Associations, | Mettre à la disposition du public des lieux publics (MPT, MJC, Associations, | ||
Recycler des ordinateurs anciens en installant une distribution légère de GNU/Linux qui proposera aux utilisateurs **un seul logiciel : le navigateur Web((le web n'est pas Internet)) ** | Recycler des ordinateurs anciens en installant une distribution légère de GNU/Linux qui proposera aux utilisateurs **un seul logiciel : le navigateur Web((le web n'est pas Internet)) ** | ||
- | === Installation de l'OS === | + | ===== Installation de l' |
- | Comme OS on part sur une base de Debian/ | + | Comme OS on part sur une base de Debian/ |
On fera 4 partitions((en principe 3 devrait suffire si on externalise le proxy et les logs)): | On fera 4 partitions((en principe 3 devrait suffire si on externalise le proxy et les logs)): | ||
- | * le swap | + | |
- | * la racine (/) | + | * la racine (/) |
- | * le home (/home) | + | * le home (/home) |
- | * les logs et autre données du système (/data) | + | * les logs et autre données du système (/data) |
On peut créer ou pas l' | On peut créer ou pas l' | ||
- | == Configuration de l'OS == | + | ==== Configuration de l' |
<code bash> | <code bash> | ||
# mkdir /data/log | # mkdir /data/log | ||
Ligne 23: | Ligne 23: | ||
</ | </ | ||
- | Copiez vos clés id_rsa.pub dans le fichier / | + | Copiez vos clés id_rsa.pub dans le fichier / |
< | < | ||
PasswordAuthentication no | PasswordAuthentication no | ||
Ligne 47: | Ligne 47: | ||
iface eth0 inet dhcp | iface eth0 inet dhcp | ||
</ | </ | ||
- | Attention au fichier / | + | //Attention au fichier / |
On complète le fichier / | On complète le fichier / | ||
Ligne 61: | Ligne 61: | ||
</ | </ | ||
- | En fonction du matériel | + | En fonction du matériel |
<code bash> | <code bash> | ||
# apt-get install firmware-linux | # apt-get install firmware-linux | ||
</ | </ | ||
- | Si d' | + | Si d' |
<code bash> | <code bash> | ||
# apt-cache search --names-only firmware | # apt-cache search --names-only firmware | ||
Ligne 75: | Ligne 75: | ||
</ | </ | ||
- | Editez le fichier / | + | Editez le fichier / |
- | == installation du proxy == | + | ==== installation du proxy ==== |
Le proxy ainsi que l' | Le proxy ainsi que l' | ||
<code bash> | <code bash> | ||
Ligne 88: | Ligne 88: | ||
au fichier / | au fichier / | ||
- | === Configuration de l' | + | ===== Configuration de l' |
Créez l' | Créez l' | ||
<code bash> | <code bash> | ||
Ligne 100: | Ligne 100: | ||
</ | </ | ||
- | == Choix du navigateur == | + | ==== Choix du navigateur |
- | C'est ce qui pose le plus problème car on ne peut pas installer n' | + | C'est ce qui pose le plus problème car on ne peut pas installer n' |
- | * pas d' | + | * pas d' |
- | * pas d' | + | * pas d' |
- | * support des onglets | + | * support des onglets |
- | * support de l' | + | * support de l' |
- | * support optionnel des plugins pour avoir flash, la lecture de fichier pdf ou autres | + | * support optionnel des plugins pour avoir flash, la lecture de fichier pdf ou autres |
- | Actuellement, | + | Actuellement, |
- | Pour faire une démo de l' | + | Pour faire une démo de l' |
<code shell> | <code shell> | ||
# apt-get install libwebkit-1.0-2 | # apt-get install libwebkit-1.0-2 | ||
</ | </ | ||
- | |||
En principe la compilation du programme doit ce faire sur une autre machine et on a besoin des paquets suivants | En principe la compilation du programme doit ce faire sur une autre machine et on a besoin des paquets suivants | ||
Ligne 121: | Ligne 120: | ||
</ | </ | ||
- | et du code source de GtkLauncher: | + | et du code source de GtkLauncher |
- | <code c> | + | |
- | /* | + | |
- | * Copyright (C) 2006, 2007 Apple Inc. | + | |
- | * Copyright (C) 2007 Alp Toker < | + | |
- | * | + | |
- | * Redistribution and use in source and binary forms, with or without | + | |
- | * modification, | + | |
- | * are met: | + | |
- | * 1. Redistributions of source code must retain the above copyright | + | |
- | | + | |
- | * 2. Redistributions in binary form must reproduce the above copyright | + | |
- | | + | |
- | | + | |
- | * | + | |
- | * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' | + | |
- | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | + | |
- | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | + | |
- | * PURPOSE ARE DISCLAIMED. | + | |
- | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | + | |
- | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | + | |
- | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | + | |
- | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | + | |
- | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | + | |
- | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | + | |
- | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | + | |
- | * | + | |
- | * Modification pour la démo: | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | */ | + | |
- | #include < | ||
- | #include < | ||
- | |||
- | static gint windowCount = 0; | ||
- | |||
- | static GtkWidget* createWindow(WebKitWebView** outWebView); | ||
- | |||
- | static void activateUriEntryCb(GtkWidget* entry, gpointer data) | ||
- | { | ||
- | WebKitWebView *webView = g_object_get_data(G_OBJECT(entry), | ||
- | const gchar* uri = gtk_entry_get_text(GTK_ENTRY(entry)); | ||
- | g_assert(uri); | ||
- | webkit_web_view_load_uri(webView, | ||
- | } | ||
- | |||
- | static void updateTitle(GtkWindow* window, WebKitWebView* webView) | ||
- | { | ||
- | GString *string = g_string_new(webkit_web_view_get_title(webView)); | ||
- | gdouble loadProgress = webkit_web_view_get_progress(webView) * 100; | ||
- | g_string_append(string, | ||
- | if (loadProgress < 100) | ||
- | g_string_append_printf(string, | ||
- | gchar *title = g_string_free(string, | ||
- | gtk_window_set_title(window, | ||
- | g_free(title); | ||
- | } | ||
- | |||
- | static void linkHoverCb(WebKitWebView* page, const gchar* title, const gchar* link, GtkStatusbar* statusbar) | ||
- | { | ||
- | guint statusContextId = | ||
- | GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(statusbar), | ||
- | /* underflow is allowed */ | ||
- | gtk_statusbar_pop(statusbar, | ||
- | if (link) | ||
- | gtk_statusbar_push(statusbar, | ||
- | } | ||
- | |||
- | static void notifyTitleCb(WebKitWebView* webView, GParamSpec* pspec, GtkWidget* window) | ||
- | { | ||
- | updateTitle(GTK_WINDOW(window), | ||
- | } | ||
- | |||
- | static void notifyLoadStatusCb(WebKitWebView* webView, GParamSpec* pspec, GtkWidget* uriEntry) | ||
- | { | ||
- | if (webkit_web_view_get_load_status(webView) == WEBKIT_LOAD_COMMITTED) { | ||
- | WebKitWebFrame *frame = webkit_web_view_get_main_frame(webView); | ||
- | const gchar *uri = webkit_web_frame_get_uri(frame); | ||
- | if (uri) | ||
- | gtk_entry_set_text(GTK_ENTRY(uriEntry), | ||
- | } | ||
- | } | ||
- | |||
- | static void notifyProgressCb(WebKitWebView* webView, GParamSpec* pspec, GtkWidget* window) | ||
- | { | ||
- | updateTitle(GTK_WINDOW(window), | ||
- | } | ||
- | |||
- | static void destroyCb(GtkWidget* widget, GtkWidget* window) | ||
- | { | ||
- | if (g_atomic_int_dec_and_test(& | ||
- | gtk_main_quit(); | ||
- | } | ||
- | |||
- | static void closeCb(GtkWidget* widget, | ||
- | { | ||
- | gtk_main_quit(); | ||
- | } | ||
- | |||
- | static void goBackCb(GtkWidget* widget, | ||
- | { | ||
- | webkit_web_view_go_back(webView); | ||
- | } | ||
- | |||
- | static void goForwardCb(GtkWidget* widget, WebKitWebView* webView) | ||
- | { | ||
- | webkit_web_view_go_forward(webView); | ||
- | } | ||
- | |||
- | static WebKitWebView* | ||
- | createWebViewCb(WebKitWebView* webView, WebKitWebFrame* web_frame, GtkWidget* window) | ||
- | { | ||
- | WebKitWebView *newWebView; | ||
- | createWindow(& | ||
- | return newWebView; | ||
- | } | ||
- | |||
- | static gboolean webViewReadyCb(WebKitWebView* webView, GtkWidget* window) | ||
- | { | ||
- | gtk_widget_grab_focus(GTK_WIDGET(webView)); | ||
- | gtk_widget_show_all(window); | ||
- | return FALSE; | ||
- | } | ||
- | |||
- | static gboolean closeWebViewCb(WebKitWebView* webView, GtkWidget* window) | ||
- | { | ||
- | gtk_widget_destroy(window); | ||
- | return TRUE; | ||
- | } | ||
- | |||
- | static useProxy(void) | ||
- | { | ||
- | SoupSession* session = webkit_get_default_session(); | ||
- | if(session) { | ||
- | | ||
- | | ||
- | g_object_set(session, | ||
- | soup_uri_free(uri); | ||
- | } | ||
- | } | ||
- | } | ||
- | |||
- | static GtkWidget* createBrowser(GtkWidget* window, GtkWidget* uriEntry, GtkWidget* statusbar, WebKitWebView* webView) | ||
- | { | ||
- | GtkWidget *scrolledWindow = gtk_scrolled_window_new(NULL, | ||
- | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledWindow), | ||
- | |||
- | gtk_container_add(GTK_CONTAINER(scrolledWindow), | ||
- | |||
- | g_signal_connect(webView, | ||
- | g_signal_connect(webView, | ||
- | g_signal_connect(webView, | ||
- | g_signal_connect(webView, | ||
- | g_signal_connect(webView, | ||
- | g_signal_connect(webView, | ||
- | g_signal_connect(webView, | ||
- | |||
- | useProxy(); | ||
- | |||
- | return scrolledWindow; | ||
- | } | ||
- | |||
- | static GtkWidget* createStatusbar() | ||
- | { | ||
- | GtkStatusbar *statusbar = GTK_STATUSBAR(gtk_statusbar_new()); | ||
- | guint statusContextId = gtk_statusbar_get_context_id(statusbar, | ||
- | g_object_set_data(G_OBJECT(statusbar), | ||
- | GUINT_TO_POINTER(statusContextId)); | ||
- | |||
- | return GTK_WIDGET(statusbar); | ||
- | } | ||
- | |||
- | static GtkWidget* createToolbar(GtkWidget* uriEntry, WebKitWebView* webView) | ||
- | { | ||
- | GtkWidget *toolbar = gtk_toolbar_new(); | ||
- | |||
- | #if GTK_CHECK_VERSION(2, | ||
- | gtk_orientable_set_orientation(GTK_ORIENTABLE(toolbar), | ||
- | #else | ||
- | gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar), | ||
- | #endif | ||
- | gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), | ||
- | |||
- | GtkToolItem *item; | ||
- | |||
- | /* the back button */ | ||
- | item = gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK); | ||
- | g_signal_connect(G_OBJECT(item), | ||
- | gtk_toolbar_insert(GTK_TOOLBAR(toolbar), | ||
- | |||
- | /* The forward button */ | ||
- | item = gtk_tool_button_new_from_stock(GTK_STOCK_GO_FORWARD); | ||
- | g_signal_connect(G_OBJECT(item), | ||
- | gtk_toolbar_insert(GTK_TOOLBAR(toolbar), | ||
- | |||
- | /* The URL entry */ | ||
- | item = gtk_tool_item_new(); | ||
- | gtk_tool_item_set_expand(item, | ||
- | gtk_container_add(GTK_CONTAINER(item), | ||
- | g_signal_connect(G_OBJECT(uriEntry), | ||
- | gtk_toolbar_insert(GTK_TOOLBAR(toolbar), | ||
- | |||
- | /* The go button */ | ||
- | g_object_set_data(G_OBJECT(uriEntry), | ||
- | item = gtk_tool_button_new_from_stock(GTK_STOCK_OK); | ||
- | g_signal_connect_swapped(G_OBJECT(item), | ||
- | gtk_toolbar_insert(GTK_TOOLBAR(toolbar), | ||
- | |||
- | item = gtk_tool_button_new_from_stock(GTK_STOCK_CLOSE); | ||
- | g_signal_connect_swapped(G_OBJECT(item), | ||
- | gtk_toolbar_insert(GTK_TOOLBAR(toolbar), | ||
- | |||
- | return toolbar; | ||
- | } | ||
- | |||
- | static GtkWidget* createWindow(WebKitWebView** outWebView) | ||
- | { | ||
- | WebKitWebView *webView; | ||
- | GtkWidget *vbox; | ||
- | GtkWidget *window; | ||
- | GtkWidget *uriEntry; | ||
- | GtkWidget *statusbar; | ||
- | |||
- | g_atomic_int_inc(& | ||
- | |||
- | window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | ||
- | gtk_window_set_default_size(GTK_WINDOW(window), | ||
- | gtk_widget_set_size_request(window, | ||
- | gtk_widget_set_name(window, | ||
- | |||
- | webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); | ||
- | uriEntry = gtk_entry_new(); | ||
- | |||
- | vbox = gtk_vbox_new(FALSE, | ||
- | statusbar = createStatusbar(webView); | ||
- | gtk_box_pack_start(GTK_BOX(vbox), | ||
- | gtk_box_pack_start(GTK_BOX(vbox), | ||
- | gtk_box_pack_start(GTK_BOX(vbox), | ||
- | |||
- | gtk_container_add(GTK_CONTAINER(window), | ||
- | |||
- | g_signal_connect(window, | ||
- | |||
- | gtk_window_set_resizable(GTK_WINDOW(window), | ||
- | |||
- | if (outWebView) | ||
- | *outWebView = webView; | ||
- | |||
- | return window; | ||
- | } | ||
- | |||
- | static gchar* filenameToURL(const char* filename) | ||
- | { | ||
- | if (!g_file_test(filename, | ||
- | return 0; | ||
- | |||
- | GFile *gfile = g_file_new_for_path(filename); | ||
- | gchar *fileURL = g_file_get_uri(gfile); | ||
- | g_object_unref(gfile); | ||
- | |||
- | return fileURL; | ||
- | } | ||
- | |||
- | #ifndef GTK_API_VERSION_2 | ||
- | static void disablePlugin(const char* pluginName) | ||
- | { | ||
- | WebKitWebPluginDatabase *database = webkit_get_web_plugin_database(); | ||
- | GSList *plugins = webkit_web_plugin_database_get_plugins(database); | ||
- | GSList *p; | ||
- | |||
- | for (p = plugins; p; p = g_slist_next(p)) { | ||
- | WebKitWebPlugin *plugin = WEBKIT_WEB_PLUGIN(p-> | ||
- | |||
- | if (!g_strcmp0(webkit_web_plugin_get_name(plugin), | ||
- | webkit_web_plugin_set_enabled(plugin, | ||
- | } | ||
- | |||
- | webkit_web_plugin_database_plugins_list_free(plugins); | ||
- | } | ||
- | #endif | ||
- | int main(int argc, char* argv[]) | ||
- | { | ||
- | WebKitWebView *webView; | ||
- | GtkWidget *main_window; | ||
- | |||
- | gtk_init(& | ||
- | if (!g_thread_supported()) | ||
- | g_thread_init(NULL); | ||
- | |||
- | #ifndef GTK_API_VERSION_2 | ||
- | disablePlugin(" | ||
- | #endif | ||
- | |||
- | main_window = createWindow(& | ||
- | |||
- | gchar *uri =(gchar*)(argc > 1 ? argv[1] : " | ||
- | gchar *fileURL = filenameToURL(uri); | ||
- | |||
- | webkit_web_view_load_uri(webView, | ||
- | g_free(fileURL); | ||
- | |||
- | gtk_widget_grab_focus(GTK_WIDGET(webView)); | ||
- | gtk_widget_show_all(main_window); | ||
- | gtk_main(); | ||
- | |||
- | return 0; | ||
- | } | ||
- | |||
- | </ | ||
- | |||
- | et du Makefile | ||
- | <code make> | ||
- | all: GtkLauncher | ||
- | |||
- | GtkLauncher: | ||
- | gcc -DGTK_API_VERSION_2 -o GtkLauncher main.c `pkg-config --cflags --libs webkit-1.0` | ||
- | |||
- | |||
- | install: GtkLauncher | ||
- | install GtkLauncher /opt/ | ||
- | |||
- | clean: | ||
- | rm -f GtkLauncher | ||
- | </ | ||
- | |||
que l'on installe avec la commande | que l'on installe avec la commande | ||
<code bash> | <code bash> | ||
Ligne 455: | Ligne 127: | ||
</ | </ | ||
- | == configuration de la session == | + | ==== configuration de la session |
On configure nodm pour se connecter directement sur le compte linuxquimper en éditant le fichier / | On configure nodm pour se connecter directement sur le compte linuxquimper en éditant le fichier / | ||
Ligne 512: | Ligne 184: | ||
Puis on peut lancer la session utilisateur avec / | Puis on peut lancer la session utilisateur avec / | ||
- | === fin de la configuration === | + | ===== fin de la configuration |
- | Il faut sécuriser l' | + | Il faut sécuriser l' |
<code bash> | <code bash> | ||
#!/bin/sh | #!/bin/sh | ||
Ligne 526: | Ligne 198: | ||
</ | </ | ||
- | Pour avoir un boot graphique on peut installer plymouth et ajouter | + | Pour avoir un boot graphique on peut installer plymouth et ajouter |
<code bash> | <code bash> | ||
# apt-get install plymouth plymouth-themes-solar | # apt-get install plymouth plymouth-themes-solar | ||
Ligne 570: | Ligne 242: | ||
</ | </ | ||
- | on termine on mettant toutes les partions | + | on termine on mettant toutes les partitions |
< | < | ||
# /etc/fstab: static file system information. | # /etc/fstab: static file system information. | ||
Ligne 592: | Ligne 264: | ||
tmpfs / | tmpfs / | ||
- | ## Pas de device | + | ## Pas de device |
#/ | #/ | ||
</ | </ | ||
- | Aprés | + | Maintenant |