Skip to content

Commit

Permalink
Automatically Locate Casper Directory (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmstick authored and danirabbit committed Oct 22, 2019
1 parent 1fceff2 commit 33345f3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
2 changes: 0 additions & 2 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
option('supported_languages', type : 'string', value : 'aa;ab;ae;af;ak;am;an;ar;as;ast;av;ay;az;ba;be;bg;bh;bi;bm;bn;bo;br;bs;ca;ce;ch;ckb;co;cr;cs;cu;cv;cy;da;de;de_CH;de_DE;dv;dz;ee;el;en;en_US;en_AU;en_CA;en_GB;eo;es;et;eu;fa;ff;fi;fj;fo;fr;fr_BE;fr_CA;fr_FR;fy;ga;gd;gl;gn;gu;gv;ha;he;hi;ho;hr;ht;hu;hy;hz;ia;id;ie;ig;ii;ik;io;is;it;iu;ja;jv;ka;kab;kg;ki;kj;kk;kl;km;kn;ko;kr;ks;ku;kv;kw;ky;la;lb;lg;li;ln;lo;lt;lu;lv;mg;mh;mi;mk;ml;mn;mo;mr;ms;mt;my;na;nb;nd;ne;ng;nl;nn;no;nr;nv;ny;oc;oj;om;or;os;pa;pi;pl;ps;pt;pt_PT;pt_BR;qu;rm;rn;ro;ru;rue;rw;sa;sc;sd;se;sg;si;sk;sl;sm;sma;sn;so;sq;sr;ss;st;su;sv;sw;szl;ta;te;tg;th;ti;tk;tl;tn;to;tr;ts;tt;tw;ty;udm;ug;uk;ur;uz;ve;vi;vo;wa;wo;xh;yi;yo;za;zh;zh_CN;zh_HK;zh_TW;zu', description : 'The list of supported languages')
option('preferred_languages', type : 'string', value : 'en;zh;es;fr;pt;ru;de', description : 'A prioritized list of languages')
option('squashfs_path', type : 'string', value : '/cdrom/casper/filesystem.squashfs', description : 'The path to the squashfs file to install')
option('manifest_remove_path', type : 'string', value : '/cdrom/casper/filesystem.manifest-remove', description : 'The path to the file listing packages to remove')
2 changes: 0 additions & 2 deletions src/Config.vala.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ namespace Build {
public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@";
public const string LANG_LIST = "@LANG_LIST@";
public const string PREFERRED_LANG_LIST = "@PREFERRED_LANG_LIST@";
public const string SQUASHFS_PATH = "@SQUASHFS_PATH@";
public const string MANIFEST_REMOVE_PATH = "@MANIFEST_REMOVE_PATH@";
}
27 changes: 25 additions & 2 deletions src/Views/ProgressView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,27 @@ public class ProgressView : AbstractInstallerView {
return terminal_view.buffer.text;
}

private string casper_dir () {
const string CDROM = "/cdrom";

try {
var cdrom_dir = File.new_for_path (CDROM);
var iter = cdrom_dir.enumerate_children (FileAttribute.STANDARD_NAME, 0);

FileInfo info;
while ((info = iter.next_file ()) != null) {
unowned string name = info.get_name ();
if (name.has_prefix ("casper")) {
return GLib.Path.build_filename (CDROM, name);
}
}
} catch (GLib.Error e) {
critical ("failed to find casper dir automatically: %s\n", e.message);
}

return GLib.Path.build_filename (CDROM, "casper");
}

public void start_installation () {
if (Installer.App.test_mode) {
new Thread<void*> (null, () => {
Expand All @@ -99,8 +120,10 @@ public class ProgressView : AbstractInstallerView {
config.flags = Distinst.MODIFY_BOOT_ORDER;
config.hostname = "elementary-os";
config.lang = "en_US.UTF-8";
config.remove = Build.MANIFEST_REMOVE_PATH;
config.squashfs = Build.SQUASHFS_PATH;

var casper = casper_dir ();
config.remove = GLib.Path.build_filename (casper, "filesystem.manifest-remove");
config.squashfs = GLib.Path.build_filename (casper, "filesystem.squashfs");

unowned Configuration current_config = Configuration.get_default ();

Expand Down
2 changes: 0 additions & 2 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ configuration_data = configuration_data()
configuration_data.set('GETTEXT_PACKAGE', meson.project_name())
configuration_data.set('LANG_LIST', get_option('supported_languages'))
configuration_data.set('PREFERRED_LANG_LIST', get_option('preferred_languages'))
configuration_data.set('SQUASHFS_PATH', get_option('squashfs_path'))
configuration_data.set('MANIFEST_REMOVE_PATH', get_option('manifest_remove_path'))

config_file = configure_file(
input: 'Config.vala.in',
Expand Down

0 comments on commit 33345f3

Please sign in to comment.