]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
Merge remote-tracking branch 'origin/seventeen' into seventeen
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 26 Oct 2014 19:11:57 +0000 (20:11 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 26 Oct 2014 19:11:57 +0000 (20:11 +0100)
Conflicts:
make.sh

14 files changed:
config/rootfiles/common/installer
doc/language_issues.tr
langs/tr/cgi-bin/tr.pl
lfs/installer
src/installer/Makefile.am
src/installer/configure.ac
src/installer/downloadsource.sh
src/installer/dracut-module/70-dhcpcd.exe
src/installer/dracut-module/module-setup.sh
src/installer/execute-postinstall.sh [new file with mode: 0644]
src/installer/hw.c
src/installer/hw.h
src/installer/main.c
src/installer/start-networking.sh

index 71b537dd3355915abd3c94258b921300317406f4..a0cb093434f75794bab247a158419483e10711ca 100644 (file)
@@ -1,4 +1,5 @@
 #usr/bin/downloadsource.sh
+#usr/bin/execute-postinstall.sh
 #usr/bin/start-networking.sh
 #usr/bin/installer
 #usr/lib/dracut/modules.d/99installer
index cb16a44805c336756c8e17259ef0801433c82b38..f50f01d47da6a91af0605b288c0037a4cc23565c 100644 (file)
@@ -663,12 +663,6 @@ WARNING: translation string unused: year-graph
 WARNING: translation string unused: yearly firewallhits
 WARNING: untranslated string: Scan for Songs
 WARNING: untranslated string: bytes
-WARNING: untranslated string: fwdfw err concon
-WARNING: untranslated string: fwdfw err ratecon
-WARNING: untranslated string: fwdfw limitconcon
-WARNING: untranslated string: fwdfw maxconcon
-WARNING: untranslated string: fwdfw numcon
-WARNING: untranslated string: fwdfw ratelimit
 WARNING: untranslated string: fwhost err hostip
 WARNING: untranslated string: route config changed
 WARNING: untranslated string: routing config added
index 90eed2d121082c75f06f7d8dbc7d2682bd030ae4..ca199bfad715c31c9b953220d9fe3485166815ef 100644 (file)
@@ -99,9 +99,9 @@
 'addons' => 'Eklentiler',
 'admin user password has been changed' => 'Yönetici kullanıcı şifresi değiştirildi.',
 'admin users' => 'Yetkili kullanıcı hakları ile kullanıcı',
-'administrator password' => 'Admin parolası',
+'administrator password' => 'Yönetici parolası',
 'administrator user password' => 'Admin kullanıcı parolası:',
-'administrator username' => 'Admin kullanıcısı',
+'administrator username' => 'Yönetici kullanıcı adı',
 'adsl settings' => 'ADSL ayarları',
 'advanced' => 'Gelişmiş',
 'advanced server' => 'Gelişmiş Sunucu Seçenekleri',
 'advproxy AUTH method ldap' => 'LDAP',
 'advproxy AUTH method ncsa' => 'Yerel',
 'advproxy AUTH method none' => 'Yok',
-'advproxy AUTH method ntlm' => 'Windows',
+'advproxy AUTH method ntlm' => 'Windows NT4 Alan Adı',
 'advproxy AUTH method ntlm auth' => 'Windows Aktif Dizini',
 'advproxy AUTH method radius' => 'RADIUS',
 'advproxy AUTH no auth' => 'Kimlik doğrulaması olmayan hedefler (her satırda bir tane)',
 'advproxy back to main page' => 'Ana Sayfaya Geri Dön',
 'advproxy banned ip clients' => 'Yasaklanan IP adresleri (her satırda bir tane)',
 'advproxy banned mac clients' => 'Yasaklanan MAC adresleri (her satırda bir tane)',
-'advproxy basic authentication' => 'Temel HTTP kimlik doğrulama izni',
+'advproxy basic authentication' => 'Temel HTTP kimlik doğrulamasına izin ver',
 'advproxy cache management' => 'Önbellek yönetimi',
 'advproxy cache replacement policy' => 'Önbellek değiştirme kuralı',
 'advproxy cache-digest' => 'Önbellek-özeti üretimini aktifleştir',
 'details' => 'Detaylar',
 'device' => 'Aygıt',
 'devices on blue' => 'Mavi üzerindeki aygıtlar',
-'dh' => 'Anahtar değişim parametreleri',
-'dh key move failed' => 'Anahtar değişim parametreleri taşınması başarısız.',
-'dh key warn' => '1024 veya 2048 bit uzunluğunda anahtar değişim paremetrelerini oluşturma birkaç dakika sürer. 3072 veya 4096 bit uzunluğundaki anahtar oluşturma ise birkaç saat sürebilir. Lütfen sabırlı olun.',
-'dh key warn1' => 'Küçük entropi veya zayıf sistemler için yükleme fonksiyonu kullanımı ile uzun anahtar değişim parametreleri yüklemesi tavsiye edilir.',
-'dh name is invalid' => 'Geçersiz ad. Lütfen "dh1024.pem" biçiminde ad kullanın.',
-'dh parameter' => 'Anahtar değişim parametreleri',
+'dh' => 'Diffie-Hellman parametreleri',
+'dh key move failed' => 'Diffie-Hellman parametreleri taşınamadı.',
+'dh key warn' => '1024 veya 2048 bit uzunluğundaki Diffie-Hellman parametrelerini oluşturma birkaç dakika sürebilir. 3072 veya 4096 bit uzunluğundaki parametreleri oluşturmak ise birkaç saate ihtiyaç olabilir. Lütfen sabırlı olun.',
+'dh key warn1' => 'Zayıf veya entropileri küçük olan sistemler için bu yükleme fonksiyonun kullanımı ile uzun Diffie-Hellman parametrelerini yükleme tavsiye edilir.',
+'dh name is invalid' => 'Geçersiz ad, lütfen "dh1024.pem" şeklinde kullanın.',
+'dh parameter' => 'Diffie-Hellman parametreleri',
 'dhcp advopt add' => 'DHCP seçeneği ekle',
 'dhcp advopt added' => 'DHCP seçeneği eklendi',
 'dhcp advopt blank value' => 'DHCP seçeneği değeri boş olamaz.',
 'dnsforward entries' => 'Güncel kayıtlar:',
 'dnsforward forward_server' => 'Ad sunucusu',
 'dnsforward zone' => 'Bölge',
-'dnssec aware' => 'DNSSEC Duyarlılığı',
+'dnssec aware' => 'DNSSEC Farkındalığı',
 'dnssec information' => 'DNSSEC Bilgisi',
 'dnssec not supported' => 'DNSSEC desteklenmiyor',
-'dnssec validating' => 'DNSSEC Doğrulama',
+'dnssec validating' => 'DNSSEC doğrulanıyor',
 'do not log this port list' => 'Otorumdan hemen önce bu bağlantı noktaları listesini bırak (günlük boyutunu küçültür)',
 'dod' => 'Çevirmeli bağlantı üzerinden talep et',
 'dod for dns' => 'DNS için çevirmeli bağlantı üzerinden talep et:',
 'download' => 'İndir',
 'download ca certificate' => 'CA sertifikası indir',
 'download certificate' => 'Sertifika indir',
-'download dh parameter' => 'Anahtar değişimi parametrelerini indir',
+'download dh parameter' => 'Diffie-Hellman parametrelerini indir',
 'download host certificate' => 'Ana bilgisayar belgesi indir',
 'download new ruleset' => 'Yeni Kural Kümesi İndir',
 'download pkcs12 file' => 'PKCS12 dosyasını indir',
 'firewall log' => 'Güvenlik duvarı günlüğü',
 'firewall log viewer' => 'Güvenlik Duvarı Günlük Görüntüleyicisi',
 'firewall logs' => 'Güvenlik Duvarı Günlükleri',
-'firewall logs country' => 'Fw günlük grafikleri (Ülke)',
+'firewall logs country' => 'Fw-Günlük Grafikleri (Ülke)',
 'firewall logs ip' => 'Gd-Günlük Grafikleri (IP)',
 'firewall logs port' => 'Gd-Günlük Grafikleri (Port)',
 'firewall rules' => 'Güvenlik Duvarı Kuralları',
 'fwdfw dnat porterr' => 'NAT için tek bir bağlantı noktası veya bağlantı noktası aralığı (tcp/udp) seçmek zorundasınız.',
 'fwdfw dnat porterr2' => 'Hiçbir hedef bağlantı noktası tanımlamdan harici bir bağlantı noktası (NAT) kullanamazsınız.',
 'fwdfw edit' => 'Düzenle',
+'fwdfw err concon' => 'Eş zamanlı bağlantı için geçersiz sayı',
 'fwdfw err nosrc' => 'Bir kaynak seçilmedi.',
 'fwdfw err nosrcip' => 'Lütfen bir kaynak IP adresi belirtin.',
 'fwdfw err notgt' => 'Bir hedef seçilmedi.',
 'fwdfw err notgtip' => 'Lütfen bir hedef IP adresi belirtin.',
 'fwdfw err prot_port' => 'Seçilen kuuralla kaynak veya hedef bağlantı noktasına izin verilmez',
 'fwdfw err prot_port1' => 'TCP veya UDP kuralı için kaynak veya hedef bağlantı noktası kullanırken seçmek zorunda',
+'fwdfw err ratecon' => 'Limit hızı bağlantıları için geçersiz değer',
 'fwdfw err remark' => 'Açıklama içinde geçersiz karakterler.',
 'fwdfw err ruleexists' => 'Bu kural zaten var.',
 'fwdfw err same' => 'Kaynak ve hedef aynı.',
 'fwdfw hint mac' => 'Kod oluşturma sırasında görmezden gelinecek MAC adresleri.',
 'fwdfw iface' => 'Arayüz',
 'fwdfw ipsec network' => 'IPsec ağları:',
+'fwdfw limitconcon' => 'IP adresi başına eş zamanlı bağlantıyı sınırla',
 'fwdfw log' => 'Günlük',
 'fwdfw log rule' => 'Günlük kuralı',
 'fwdfw man port' => 'Bağlantı noktası:',
 'fwdfw many' => 'Çok',
+'fwdfw maxconcon' => 'Maksimum eş zamanlı bağlantı',
 'fwdfw menu' => 'Güvenlik Duvarı Kuralları',
 'fwdfw movedown' => 'Aşağı taşı',
 'fwdfw moveup' => 'Yukarı taşı',
 'fwdfw natport used' => 'NAPT için verilen bağlantı noktası başka bir DNAT kural tarafından zaten kullanılıyor.',
 'fwdfw newrule' => 'Yeni Kural',
+'fwdfw numcon' => 'Bağlantı sayısı',
 'fwdfw p2p txt' => 'P2P ağlarına erişim izni Ver/Verme.',
 'fwdfw pol allow' => 'İzin Verildi',
 'fwdfw pol block' => 'Engellendi',
 'fwdfw pol title' => 'Varsayılan güvenlik duvarı davranışı',
 'fwdfw prot41' => 'IPv6 Kuşatması (Kural 41)',
 'fwdfw prot41 short' => 'IPv6 Kuşatması',
+'fwdfw ratelimit' => 'Yeni bağlantı hız sınırı',
 'fwdfw red' => 'KIRMIZI',
 'fwdfw reread' => 'Değişiklikleri Uygula',
 'fwdfw rule action' => 'Eylem kuralı:',
 'g.lite' => 'KALDIRILACAK',
 'gateway' => 'Ağ geçidi',
 'gateway ip' => 'Ağ Geçidi IP Adresi',
-'gen dh' => 'Yeni anahtar değişimi parametrelerini oluştur',
+'gen dh' => 'Yeni Diffie-Hellman parametrelerini oluşturun',
 'gen static key' => 'Statik bir anahtar oluştur',
 'generate' => 'Yönetici/Sunucu Sertifikası Oluştur',
 'generate a certificate' => 'Sertifika oluştur:',
-'generate dh key' => 'Anahtar değişimi parametrelerini oluştur',
+'generate dh key' => 'Diffie-Hellman parametrelerini oluşturun',
 'generate iso' => 'ISO oluştur',
 'generate root/host certificates' => 'Yönetici/Sunucu Sertifikası Oluştur',
 'generate tripwire keys and init' => 'tripwire anahtarları ve init oluştur',
 'marked' => 'İşaretli',
 'masquerade blue' => 'MAVİ gizli',
 'masquerade green' => 'YEŞİL gizli',
-'masquerade orange' => 'TURUNCU gizil',
+'masquerade orange' => 'TURUNCU gizli',
 'masquerading' => 'Gizle',
 'masquerading disabled' => 'Gizlemeyi kapat',
 'masquerading enabled' => 'Gizlemeyi aç',
 'modem' => 'Modem',
 'modem configuration' => 'Modem yapılandırması',
 'modem hardware details' => 'Modem Donanımı',
-'modem information' => 'Modem Bilgisi',
+'modem information' => 'Modem bilgisi',
 'modem network bit error rate' => 'Bit hata oranı',
 'modem network information' => 'Ağ bilgisi',
-'modem network mode' => 'Ağ Yöntemi',
-'modem network operator' => 'Ağ Oparatörü',
-'modem network registration' => 'Ağ Kaydı',
-'modem network signal quality' => 'Sinyal Kalitesi',
-'modem no connection' => 'Bağlantı Yok',
-'modem no connection message' => 'Modemle bağlantı kurulamadı.',
+'modem network mode' => 'Ağ yöntemi',
+'modem network operator' => 'Ağ oparatörü',
+'modem network registration' => 'Ağ kaydı',
+'modem network signal quality' => 'Sinyal kalitesi',
+'modem no connection' => 'Bağlantı yok',
+'modem no connection message' => 'Modemle herhangi bir bağlantı kurulamadı.',
 'modem on com1' => 'COM1 üzerindeki modem',
 'modem on com2' => 'COM2 üzerindeki modem',
 'modem on com3' => 'COM3 üzerindeki modem',
 'modem on com4' => 'COM4 üzerindeki modem',
 'modem on com5' => 'COM5 üzerindeki modem',
 'modem settings have errors' => 'Modem ayarları hatalı',
-'modem sim information' => 'SIM Bilgisi',
+'modem sim information' => 'SIM bilgisi',
 'modem speaker on' => 'Modem üzerindeki hoparlör:',
-'modem status' => 'Modem Durumu',
+'modem status' => 'Modem durumu',
 'modify' => 'Düzenle',
 'modulation' => 'Geçiş',
 'monday' => 'Pazartesi',
-'monitor interface' => 'Ekran Arabirimi',
+'monitor interface' => 'Ekran ara birimi',
 'month' => 'Ay',
 'month-graph' => 'ay',
 'monthly firewallhits' => 'aylık güvenlik duvarı kaydı',
 'name is invalid' => 'Geçersiz ad',
 'name must only contain characters' => 'Ad sadece karakter içermelidir.',
 'name too long' => 'Kullanıcının tam adı veya sistem ana bilgisayar adı çok uzun',
-'nameserver' => 'Sunucu adı',
+'nameserver' => 'Alan adı sunucusu',
 'nat-traversal' => 'Nat Geçişi:',
 'needreboot' => 'Bu güncelleştirmeden sonra yeniden başlatmak gerekir',
 'net' => 'Ağ',
 'nonetworkname' => 'Ağ adı girilmedi',
 'noservicename' => 'Hizmet adı girilmedi',
 'not a valid ca certificate' => 'Geçerli bir CA sertifikası değil.',
-'not a valid dh key' => 'Geçerli bir anahtar değişim parametre dosyası yok. 1024, 2048, 3072 veya 4096 bit uzunluğunda ve PKCS#3 biçimini kullanın.',
+'not a valid dh key' => 'Geçerli bir Diffie-Hellman parametre dosyası yok. 1024, 2048, 3072 veya 4096 bit uzunluğunda ve PKCS#3 biçimini kullanın.',
 'not enough disk space' => 'Yeterli disk alanı yok',
 'not present' => 'Mevcut <b>değil</b>',
 'not running' => 'çalışmıyor',
 'ovpn config' => 'OVPN-Yapılandırması',
 'ovpn crypt options' => 'Şifreleme seçenekleri',
 'ovpn device' => 'OpenVPN aygıtı:',
-'ovpn dh' => 'Anahtar değişim uzunluğu parametreleri',
-'ovpn dh new key' => 'Yeni anahtar değişimi parametreleri oluşturun',
-'ovpn dh parameters' => 'Anahtar değişimi parametre seçenekleri',
-'ovpn dh upload' => 'Yeni anahtar değişimi parametrelerini yükle',
+'ovpn dh' => 'Diffie-Hellman parametre uzunluğu',
+'ovpn dh new key' => 'Yeni Diffie-Hellman parametrelerini oluşturun',
+'ovpn dh parameters' => 'Diffie-Hellman parametre seçenekleri',
+'ovpn dh upload' => 'Yeni Diffie-Hellman parametreleri yükle',
 'ovpn dl' => 'OVPN-Yapılandırması İndir',
-'ovpn engines' => 'kripto motoru',
+'ovpn engines' => 'Şifreleme motoru',
 'ovpn errmsg green already pushed' => 'Yeşil ağ için her zaman bir yol ayarla',
 'ovpn errmsg invalid ip or mask' => 'Geçersiz ağ adresi veya alt ağ maskesi',
-'ovpn generating the root and host certificates' => 'Root ve ana bilgisayar belge üretimi uzun zaman alabilir.',
-'ovpn ha' => 'Hash algoritması',
+'ovpn generating the root and host certificates' => 'Root ve ana bilgisayar sertifika üretimi uzun zaman alabilir.',
+'ovpn ha' => 'Hash algorithması',
 'ovpn hmac' => 'HMAC seçenekleri',
 'ovpn log' => 'OVPN-Günlük',
 'ovpn mgmt in root range' => 'Bağlantı noktası numarası 1024 ya da daha yüksek bir numara olmalıdır.',
 'ovpn on orange' => 'TURUNCU üzerindeki OpenVPN',
 'ovpn on red' => 'KIRMIZI üzerindeki OpenVPN',
 'ovpn port in root range' => '1024 ya da daha yüksek bir bağlantı noktası numarası gereklidir..',
-'ovpn reneg sec' => 'Oturum anahtarının kullanım süresi:',
+'ovpn reneg sec' => 'Oturum anahtarı kullanım süresi:',
 'ovpn routes push' => 'Yollar (her satırda bir tane) örneğin 192.168.10.0/255.255.255.0 192.168.20.0/24',
 'ovpn routes push options' => 'Yol baskı seçenekleri',
 'ovpn server status' => 'Güncel OpenVPN sunucu durumu:',
 'running' => 'ÇALIŞIYOR',
 'safe removal of umounted device' => 'Bağlantısı kesilen aygıtı güvenli bir şekilde kaldırabilirsiniz',
 'samba' => 'Samba',
-'samba join a domain' => 'Bir etki alanına katılın',
-'samba join domain' => 'Etki alanına üyelik',
+'samba join a domain' => 'Bir etki alanına katıl',
+'samba join domain' => 'Etki alanına katıl',
 'samba status' => 'Samba durumu',
 'saturday' => 'Cumartesi',
 'save' => 'Kaydet',
 'show ca certificate' => 'CA sertifikalarını göster',
 'show certificate' => 'Sertifika göster',
 'show crl' => 'Sertifika İptal Listesini Göster',
-'show dh' => 'Anahtar değişimi parametrelerini göster',
+'show dh' => 'Diffie-Hellman parametrelerini göster',
 'show host certificate' => 'Ana bilgisayar sertifikalarını göster',
 'show last x lines' => 'Son x satırlarını göster',
 'show lines' => 'Satırları göster',
 'source ip' => 'Kaynak IP',
 'source ip and port' => 'Kaynak IP: Bağlantı noktası numarası',
 'source ip bad' => 'Geçersiz bir IP adresi ya da ağ adresi.',
-'source ip country' => 'Kaynak Ip ülke',
+'source ip country' => 'Ülke IP kaynağı',
 'source ip in use' => 'Kullanılan kaynak IP:',
 'source ip or net' => 'Kaynak IP veya Ağ',
 'source net' => 'Kaynak Ağ',
 'system log viewer' => 'Sistem Günlük Görüntüleyicisi',
 'system logs' => 'Sistem Günlükleri',
 'system status information' => 'Sistem Durum Bilgisi',
-'ta key' => 'Tls kimlik doğrulama anahtarı',
+'ta key' => 'TLS Kimlik Doğrulama Anahtarı',
 'telephone not set' => 'Telefon ayarlanmamış.',
 'template' => 'Ön Ayar',
 'template warning' => 'QoS kurmak için iki seçeneğiniz vardır. İlk olarak kaydet düğmesine basıp kendi sınıf ve kurallarınızı oluşturabilirsiniz. İkinci olarak ise ön ayar düğmesine basıp sınıf ve kurallar için bir şablonun kurulmasını sağlayın. ',
-'teovpn_fragment' => 'Fragment boyutu',
+'teovpn_fragment' => 'Bölümleme boyutu',
 'test' => 'test',
 'test email could not be sent' => 'Test e-posta gönderilemedi',
 'test email was sent' => 'Test e-posta başarıyla gönderildi.',
 'upload a certificate' => 'Sertifika yükle:',
 'upload a certificate request' => 'Sertifika isteği yükle:',
 'upload ca certificate' => 'CA Sertifikası Yükle',
-'upload dh key' => 'Anahtar değişimi parametrelerini yükle',
+'upload dh key' => 'Diffie-Hellman parametreleri yükle',
 'upload fcdsl.o' => 'KALDIRILACAK',
 'upload file' => 'Dosya yükle',
 'upload new ruleset' => 'Yeni kurallar yükle',
index 7f73222c1b87170742141379b46e50115896a564..3364a4d7fd9849790821521554737c0d0be09a8a 100644 (file)
@@ -31,6 +31,7 @@ DIR_APP    = $(DIR_SRC)/$(THISAPP)
 TARGET     = $(DIR_INFO)/$(THISAPP)
 
 SLOGAN     = An Open Source Firewall Solution
+DOWNLOAD_URL = http://downloads.ipfire.org/releases/ipfire-2.x/$(VERSION)-core$(CORE)/$(SNAME)-$(VERSION).$(MACHINE)-full-core$(CORE).iso
 
 ###############################################################################
 # Top-level Rules
@@ -58,12 +59,11 @@ $(TARGET) :
                --with-distro-name="$(NAME)" \
                --with-distro-sname="$(SNAME)" \
                --with-distro-slogan="$(SLOGAN)" \
-               --with-config-root="$(CONFIG_ROOT)"
+               --with-config-root="$(CONFIG_ROOT)" \
+               --with-download-url="$(DOWNLOAD_URL)"
+
        cd $(DIR_APP) && make $(MAKETUNING)
        cd $(DIR_APP) && make install
 
-       #Patch ISO Name for download ...
-       #sed -i -e "s|ipfire.iso|download.ipfire.org/releases/ipfire-2.x/$(VERSION)-core$(CORE)/$(SNAME)-$(VERSION).$(MACHINE)-full-core$(CORE).iso|g" \
-       #                       /usr/bin/downloadsource.sh
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)
index f52a5940ac474e2f413016bbae9e3b0ca02c7dc8..d0e52dc187aaa9b6c697bfd1d13c9b266e31b177 100644 (file)
@@ -34,6 +34,7 @@ bin_PROGRAMS = \
 
 bin_SCRIPTS = \
        downloadsource.sh \
+       execute-postinstall.sh \
        start-networking.sh
 
 #- installer -------------------------------------------------------------------
@@ -44,6 +45,7 @@ installer_SOURCES = \
        main.c
 
 installer_CFLAGS = \
+       $(AM_CFLAGS) \
        $(BLKID_CFLAGS) \
        $(LIBSMOOTH_CFLAGS) \
        $(PCI_CFLAGS) \
index da968f637f009085b390a63cf8f952efbb2224c0..85c5c5cb8c95a2c6f56680e5c541e9b889bb9234 100644 (file)
@@ -39,6 +39,16 @@ AC_PROG_CC
 AC_PROG_CC_C99
 AC_PROG_CC_C_O
 
+CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
+       "-Wformat=2 -Wformat-security -Wformat-nonliteral" \
+       -Werror=overflow \
+       -fno-strict-aliasing \
+       -fstack-protector \
+       -fstack-protector-strong \
+       -fPIE \
+       --param=ssp-buffer-size=4])
+AC_SUBST([OUR_CFLAGS], "$with_cflags")
+
 AC_PATH_PROG([M4], [m4])
 
 # Gettext
@@ -84,6 +94,11 @@ AC_ARG_WITH([config-root],
        AC_DEFINE_UNQUOTED([CONFIG_ROOT], "$withval", [The config-root]),
        AC_MSG_ERROR([*** you need to set CONFIG_ROOT with --with-config-root=]))
 
+AC_ARG_WITH([download-url],
+       AS_HELP_STRING([--with-download-url] [The default download URL]),
+       AC_DEFINE_UNQUOTED([DOWNLOAD_URL], "$withval", [The default download URL]),
+       AC_MSG_ERROR([*** you need to set DOWNLOAD_URL with --with-download-url=]))
+
 AC_CONFIG_FILES([
        Makefile
        po/Makefile.in
index 7504c198fd8325cd0f856a44d40717f3fc7ba5f6..4a48686ea9453560065f80bf3a5d945f37f3f525 100644 (file)
 #                                                                             #
 ###############################################################################
 
-#lfs change the url while build!
-IPFireISO=ipfire.iso
-#
-
-#Get user defined download from boot cmdline
-grep "netinstall=" /proc/cmdline > /dev/null && CMDLINE=1
-if ( [ "$CMDLINE" == "1" ]); then
-       read CMDLINE < /proc/cmdline
-       POS=${CMDLINE%%netinstall*}
-       POS=${#POS}
-       IPFireISO=`echo ${CMDLINE:POS} | cut -d"=" -f2 | cut -d" " -f1`
+function download() {
+       wget -U "IPFire-NetInstall/2.x" "$@"
+}
+
+if [ $# -lt 2 ]; then
+       echo "$0: Insufficient number of arguments" >&2
+       exit 2
+fi
+
+OUTPUT="${1}"
+URL="${2}"
+
+echo "Downloading ${URL}..."
+if ! download -O "${OUTPUT}" "${URL}"; then
+       echo "Download failed" >&2
+
+       rm -f "${OUTPUT}"
+       exit 1
 fi
 
-echo "Download with wget..."
-wget $IPFireISO -O /tmp/download.iso -t3 -U IPFire_NetInstall/2.x
-wget $IPFireISO.md5 -O /tmp/download.iso.md5 -t3 -U IPFire_NetInstall/2.x
-echo
-echo "Checking download..."
-md5_file=`md5sum /tmp/download.iso | cut -d" " -f1`
-md5_down=`cat /tmp/download.iso.md5 | cut -d" " -f1`
-if [ "$md5_file" == "$md5_down" ]; then
-       echo -n "/tmp/download.iso" > /tmp/source_device
-       exit 0
+# Download went well. Checking for MD5 sum
+if download -O "${OUTPUT}.md5" "${URL}.md5" &>/dev/null; then
+       # Read downloaded checksum
+       read -r md5sum rest < "${OUTPUT}.md5"
+       rm -f "${OUTPUT}.md5"
+
+       # Compute checkum of downloaded image file
+       read -r md5sum_image rest <<< "$(md5sum "${OUTPUT}")"
+
+       if [ "${md5sum}" != "${md5sum_image}" ]; then
+               echo "MD5 sum mismatch: ${md5sum} != ${md5sum_image}" >&2
+               exit 2
+       fi
 fi
-echo "Error - SKIP"
-exit 10
+
+exit 0
index 4100fc957061a7d8cc89b8554cd0d8043c73e08b..660f269410ce135467e5e98c55b73fe67053d35d 100755 (executable)
 #
 ########################################################################
 
-dhcpcd_up()
-{
-       set | grep "^new_" | sed "s|^new_||g" | \
-       sed "s|'||g" | \
-       sort > /var/ipfire/dhcpc/dhcpcd-$interface.info
+LEASE_FILE="/var/ipfire/dhcpc/dhcpcd-${interface}.info"
 
-       DNS=`grep "domain_name_servers" /var/ipfire/dhcpc/dhcpcd-$interface.info | cut -d"=" -f2`
-       DNS1=`echo $DNS | cut -d" " -f1`
-       DNS2=`echo $DNS | cut -d" " -f2`
+export_lease() {
+       set | grep "^new_" | sed "s|^new_||g" | \
+       sed "s|'||g" | sort > ${LEASE_FILE}
+}
 
-       echo "nameserver $DNS1" > /etc/resolv.conf
-       echo "nameserver $DNS2" >> /etc/resolv.conf
+make_resolvconf() {
+       local DNS="$(grep 'domain_name_servers' ${LEASE_FILE} | cut -d'=' -f2)"
+       local DNS1="$(echo ${DNS} | cut -d' ' -f1)"
+       local DNS2="$(echo ${DNS} | cut -d' ' -f2)"
 
+       (
+               echo "nameserver ${DNS1}"
+               echo "nameserver ${DNS2}"
+       ) > /etc/resolv.conf
 }
 
-case "$reason" in
-BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC)       dhcpcd_up;;
+case "${reason}" in
+       PREINIT)
+               # Configure MTU
+               if [ -n "${new_interface_mtu}" ] && [ ${new_interface_mtu} -gt 576 ]; then
+                       echo "Setting MTU to ${new_interface_mtu}"
+                       ip link set "${interface}" mtu "${new_interface_mtu}"
+               fi
+               ;;
+
+       BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC)
+               # Export all information about the newly received lease
+               # to file
+               export_lease
+
+               # Create system configuration files
+               make_resolvconf
+               ;;
+
+       EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP)
+               rm -f "${LEASE_FILE}"
+               ;;
 esac
+
+exit 0
index 31caa5489d3c9c3bcf9c5286883f272aa051dd84..187b12eb15e86470035f5c1c253013402f53aed0 100755 (executable)
@@ -18,6 +18,7 @@ install() {
     inst /etc/system-release
     inst /usr/bin/installer
     inst /usr/bin/downloadsource.sh
+    inst /usr/bin/execute-postinstall.sh
     inst /usr/local/bin/iowrap
 
     # Kernel drivers
@@ -35,17 +36,18 @@ install() {
     inst_multiple tar gzip lzma xz
 
     # Networking
-    inst_multiple dhcpcd ethtool hostname ip ping wget
+    inst_multiple dhcpcd ethtool hostname ip ping sort wget
     inst /usr/bin/start-networking.sh
-    inst /var/ipfire/dhcpc/dhcpcd-run-hooks
     inst /var/ipfire/dhcpc/dhcpcd.conf
-    for file in /var/ipfire/dhcpc/dhcpcd-hooks/*; do
-        inst "${file}"
-    done
+    inst /var/ipfire/dhcpc/dhcpcd-run-hooks
     inst "$moddir/70-dhcpcd.exe" "/var/ipfire/dhcpc/dhcpcd-hooks/70-dhcpcd.exe"
 
+    inst /etc/host.conf /etc/hosts /etc/protocols
+    inst /etc/nsswitch.conf /etc/resolv.conf
+    inst_libdir_file "libnss_dns.so.*"
+
     # Misc. tools
-    inst_multiple cut grep eject killall md5sum touch
+    inst_multiple chmod cut grep eject id killall md5sum touch
     inst_multiple -o fdisk cfdisk df ps top
 
     # Hardware IDs
diff --git a/src/installer/execute-postinstall.sh b/src/installer/execute-postinstall.sh
new file mode 100644 (file)
index 0000000..695f1b5
--- /dev/null
@@ -0,0 +1,65 @@
+#!/bin/sh
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2014  IPFire Team  <info@ipfire.org>                          #
+#                                                                             #
+# 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, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT 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, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+function download() {
+       wget -U "IPFire-NetInstall/2.x" "$@"
+}
+
+if [ $# -lt 2 ]; then
+       echo "$0: Insufficient number of arguments" >&2
+       exit 2
+fi
+
+DESTINATION="${1}"
+DOWNLOAD_URL="${2}"
+
+DOWNLOAD_TARGET="/tmp/post-install.exe"
+
+if download -O "${DESTINATION}${DOWNLOAD_TARGET}" "${DOWNLOAD_URL}"; then
+       echo "Downloading post-install script from ${DOWNLOAD_URL}..."
+
+       # Make it executable
+       chmod a+x "${DESTINATION}${DOWNLOAD_TARGET}"
+
+       # Replace /etc/resolv.conf so that we will have
+       cp -fb /etc/resolv.conf ${DESTINATION}/etc/resolv.conf
+       for i in /dev /proc /sys; do
+               mount --bind "${i}" "${DESTINATION}${i}"
+       done
+
+       # Execute the downloaded script
+       chroot "${DESTINATION}" sh --login -c "${DOWNLOAD_TARGET}"
+       retval=$?
+
+       # Cleanup the environment
+       mv -f ${DESTINATION}/etc/resolv.conf{~,}
+       for i in /dev /proc /sys; do
+               umount "${DESTINATION}${i}"
+       done
+       rm -f "${DESTINATION}${DOWNLOAD_TARGET}"
+
+       exit ${retval}
+
+# In case the download failed
+else
+       echo "Could not download the post-install script" >&2
+       exit 1
+fi
index 9b9a2d00291ae7b6911bd5eb10848e7c31c444a9..d74526050037e48a1458fa04403430b631903221 100644 (file)
 #include <blkid/blkid.h>
 #include <fcntl.h>
 #include <libudev.h>
+#include <linux/loop.h>
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/ioctl.h>
 #include <sys/mount.h>
+#include <sys/stat.h>
 #include <sys/swap.h>
 #include <sys/sysinfo.h>
 #include <unistd.h>
@@ -82,11 +84,56 @@ static int strstartswith(const char* a, const char* b) {
        return (strncmp(a, b, strlen(b)) == 0);
 }
 
+static char loop_device[STRING_SIZE];
+
+static int setup_loop_device(const char* source, const char* device) {
+       int file_fd = open(source, O_RDWR);
+       if (file_fd < 0)
+               goto ERROR;
+
+       int device_fd = -1;
+       if ((device_fd = open(device, O_RDWR)) < 0)
+               goto ERROR;
+
+       if (ioctl(device_fd, LOOP_SET_FD, file_fd) < 0)
+               goto ERROR;
+
+       close(file_fd);
+       close(device_fd);
+
+       return 0;
+
+ERROR:
+       if (file_fd >= 0)
+               close(file_fd);
+
+       if (device_fd >= 0) {
+               ioctl(device_fd, LOOP_CLR_FD, 0);
+               close(device_fd);
+       }
+
+       return -1;
+}
+
 int hw_mount(const char* source, const char* target, const char* fs, int flags) {
+       const char* loop_device = "/dev/loop0";
+
        // Create target if it does not exist
        if (access(target, X_OK) != 0)
                mkdir(target, S_IRWXU|S_IRWXG|S_IRWXO);
 
+       struct stat st;
+       stat(source, &st);
+
+       if (S_ISREG(st.st_mode)) {
+               int r = setup_loop_device(source, loop_device);
+               if (r == 0) {
+                       source = loop_device;
+               } else {
+                       return -1;
+               }
+       }
+
        return mount(source, target, fs, flags, NULL);
 }
 
@@ -293,7 +340,7 @@ void hw_free_disks(struct hw_disk** disks) {
        free(disks);
 }
 
-unsigned int hw_count_disks(struct hw_disk** disks) {
+unsigned int hw_count_disks(const struct hw_disk** disks) {
        unsigned int ret = 0;
 
        while (*disks++)
@@ -306,7 +353,7 @@ struct hw_disk** hw_select_disks(struct hw_disk** disks, int* selection) {
        struct hw_disk** ret = hw_create_disks();
        struct hw_disk** selected_disks = ret;
 
-       unsigned int num_disks = hw_count_disks(disks);
+       unsigned int num_disks = hw_count_disks((const struct hw_disk**)disks);
 
        for (unsigned int i = 0; i < num_disks; i++) {
                if (!selection || selection[i]) {
@@ -393,7 +440,7 @@ static int hw_device_has_p_suffix(const struct hw_destination* dest) {
        return 0;
 }
 
-static int hw_calculate_partition_table(struct hw_destination* dest) {
+static int hw_calculate_partition_table(struct hw_destination* dest, int disable_swap) {
        char path[DEV_SIZE];
        int part_idx = 1;
 
@@ -446,9 +493,14 @@ static int hw_calculate_partition_table(struct hw_destination* dest) {
        }
 
        dest->size_boot = hw_boot_size(dest);
-       dest->size_swap = hw_swap_size(dest);
        dest->size_root = hw_root_size(dest);
 
+       // Should we use swap?
+       if (disable_swap)
+               dest->size_swap = 0;
+       else
+               dest->size_swap = hw_swap_size(dest);
+
        // Determine the size of the data partition.
        unsigned long long used_space = dest->size_bootldr + dest->size_boot
                + dest->size_swap + dest->size_root;
@@ -493,7 +545,7 @@ static int hw_calculate_partition_table(struct hw_destination* dest) {
        return 0;
 }
 
-struct hw_destination* hw_make_destination(int part_type, struct hw_disk** disks) {
+struct hw_destination* hw_make_destination(int part_type, struct hw_disk** disks, int disable_swap) {
        struct hw_destination* dest = malloc(sizeof(*dest));
 
        if (part_type == HW_PART_TYPE_NORMAL) {
@@ -513,7 +565,7 @@ struct hw_destination* hw_make_destination(int part_type, struct hw_disk** disks
        // Is this a RAID device?
        dest->is_raid = (part_type > HW_PART_TYPE_NORMAL);
 
-       int r = hw_calculate_partition_table(dest);
+       int r = hw_calculate_partition_table(dest, disable_swap);
        if (r)
                return NULL;
 
@@ -982,12 +1034,13 @@ static char* hw_get_uuid(const char* dev) {
        return uuid;
 }
 
+#define FSTAB_FMT "UUID=%s %-8s %-4s %-10s %d %d\n"
+
 int hw_write_fstab(struct hw_destination* dest) {
        FILE* f = fopen(DESTINATION_MOUNT_PATH "/etc/fstab", "w");
        if (!f)
                return -1;
 
-       const char* fmt = "UUID=%s %-8s %-4s %-10s %d %d\n";
        char* uuid = NULL;
 
        // boot
@@ -995,7 +1048,7 @@ int hw_write_fstab(struct hw_destination* dest) {
                uuid = hw_get_uuid(dest->part_boot);
 
                if (uuid) {
-                       fprintf(f, fmt, uuid, "/boot", "auto", "defaults", 1, 2);
+                       fprintf(f, FSTAB_FMT, uuid, "/boot", "auto", "defaults", 1, 2);
                        free(uuid);
                }
        }
@@ -1005,7 +1058,7 @@ int hw_write_fstab(struct hw_destination* dest) {
                uuid = hw_get_uuid(dest->part_swap);
 
                if (uuid) {
-                       fprintf(f, fmt, uuid, "swap", "swap", "defaults,pri=1", 0, 0);
+                       fprintf(f, FSTAB_FMT, uuid, "swap", "swap", "defaults,pri=1", 0, 0);
                        free(uuid);
                }
        }
@@ -1013,7 +1066,7 @@ int hw_write_fstab(struct hw_destination* dest) {
        // root
        uuid = hw_get_uuid(dest->part_root);
        if (uuid) {
-               fprintf(f, fmt, uuid, "/", "auto", "defaults", 1, 1);
+               fprintf(f, FSTAB_FMT, uuid, "/", "auto", "defaults", 1, 1);
                free(uuid);
        }
 
@@ -1022,7 +1075,7 @@ int hw_write_fstab(struct hw_destination* dest) {
                uuid = hw_get_uuid(dest->part_data);
 
                if (uuid) {
-                       fprintf(f, fmt, uuid, "/var", "auto", "defaults", 1, 1);
+                       fprintf(f, FSTAB_FMT, uuid, "/var", "auto", "defaults", 1, 1);
                        free(uuid);
                }
        }
index 41ff093ad23b38661523edcc56d2d01d7c17c2b9..f16b39cb6a04a0b86e50ec73573166092f62a3ea 100644 (file)
@@ -107,11 +107,12 @@ char* hw_find_source_medium(struct hw* hw);
 
 struct hw_disk** hw_find_disks(struct hw* hw, const char* sourcedrive);
 void hw_free_disks(struct hw_disk** disks);
-unsigned int hw_count_disks(struct hw_disk** disks);
+unsigned int hw_count_disks(const struct hw_disk** disks);
 struct hw_disk** hw_select_disks(struct hw_disk** disks, int* selection);
 struct hw_disk** hw_select_first_disk(const struct hw_disk** disks);
 
-struct hw_destination* hw_make_destination(int part_type, struct hw_disk** disks);
+struct hw_destination* hw_make_destination(int part_type, struct hw_disk** disks,
+       int disable_swap);
 
 unsigned long long hw_memory();
 
@@ -131,6 +132,8 @@ int hw_write_fstab(struct hw_destination* dest);
 char* hw_find_backup_file(const char* output, const char* search_path);
 int hw_restore_backup(const char* output, const char* backup_path, const char* destination);
 
+int hw_start_networking(const char* output);
+
 void hw_sync();
 
 #endif /* HEADER_HW_H */
index 36f8dfec8110a48bb6fb1f73c07c35350503550a..ad388e6a910cf512d891d5dd1610dc2c3bb17ec0 100644 (file)
@@ -7,6 +7,7 @@
  * Contains main entry point, and misc functions.6
  * 
  */
+#define _GNU_SOURCE
 
 #include <assert.h>
 #include <errno.h>
@@ -23,7 +24,6 @@
 #define _(x) dgettext("installer", x)
 
 #define INST_FILECOUNT 21000
-#define UNATTENDED_CONF "/cdrom/boot/unattended.conf"
 #define LICENSE_FILE   "/cdrom/COPYING"
 #define SOURCE_TEMPFILE "/tmp/downloaded-image.iso"
 
@@ -163,7 +163,7 @@ static int newtLicenseBox(const char* title, const char* text, int width, int he
        return ret;
 }
 
-int write_lang_configs(const char *lang) {
+int write_lang_configs(char* lang) {
        struct keyvalue *kv = initkeyvalues();
 
        /* default stuff for main/settings. */
@@ -207,7 +207,7 @@ static char* center_string(const char* str, int width) {
 }
 
 #define DEFAULT_LANG "English"
-#define NUM_LANGS 8
+#define NUM_LANGS 10
 
 static struct lang {
        const char* code;
@@ -226,6 +226,80 @@ static struct lang {
        { NULL, NULL },
 };
 
+static struct config {
+       int unattended;
+       int serial_console;
+       int require_networking;
+       int perform_download;
+       int disable_swap;
+       char download_url[STRING_SIZE];
+       char postinstall[STRING_SIZE];
+} config = {
+       .unattended = 0,
+       .serial_console = 0,
+       .require_networking = 0,
+       .perform_download = 0,
+       .disable_swap = 0,
+       .download_url = DOWNLOAD_URL,
+       .postinstall = "\0",
+};
+
+static void parse_command_line(struct config* c) {
+       char buffer[STRING_SIZE];
+       char cmdline[STRING_SIZE];
+
+       FILE* f = fopen("/proc/cmdline", "r");
+       if (!f)
+               return;
+
+       int r = fread(&cmdline, 1, sizeof(cmdline) - 1, f);
+       if (r > 0) {
+               char* token = strtok(cmdline, " ");
+
+               while (token) {
+                       strncpy(buffer, token, sizeof(buffer));
+                       char* val = buffer;
+                       char* key = strsep(&val, "=");
+
+                       // serial console
+                       if (strcmp(token, "console=ttyS0") == 0)
+                               c->serial_console = 1;
+
+                       // enable networking?
+                       else if (strcmp(token, "installer.net") == 0)
+                               c->require_networking = 1;
+
+                       // unattended mode
+                       else if (strcmp(token, "installer.unattended") == 0)
+                               c->unattended = 1;
+
+                       // disable swap
+                       else if (strcmp(token, "installer.disable-swap") == 0)
+                               c->disable_swap = 1;
+
+                       // download url
+                       else if (strcmp(key, "installer.download-url") == 0) {
+                               strncpy(c->download_url, val, sizeof(c->download_url));
+                               c->perform_download = 1;
+
+                               // Require networking for the download
+                               c->require_networking = 1;
+
+                       // postinstall script
+                       } else if (strcmp(key, "installer.postinstall") == 0) {
+                               strncpy(c->postinstall, val, sizeof(c->postinstall));
+
+                               // Require networking for the download
+                               c->require_networking = 1;
+                       }
+
+                       token = strtok(NULL, " ");
+               }
+       }
+
+       fclose(f);
+}
+
 int main(int argc, char *argv[]) {
        struct hw* hw = hw_init();
        const char* logfile = NULL;
@@ -243,17 +317,10 @@ int main(int argc, char *argv[]) {
        char message[STRING_SIZE];
        char title[STRING_SIZE];
        int allok = 0;
-       FILE *handle, *cmdfile, *copying;
-       char line[STRING_SIZE];
-               
-       int unattended = 0;
-       int serialconsole = 0;
-       int require_networking = 0;
-       struct keyvalue *unattendedkv = initkeyvalues();
-       char restore_file[STRING_SIZE] = "";
+       FILE *copying;
 
-       setlocale (LC_ALL, "");
-       sethostname( SNAME , 10);
+       setlocale(LC_ALL, "");
+       sethostname(SNAME, 10);
 
        /* Log file/terminal stuff. */
        FILE* flog = NULL;
@@ -283,33 +350,18 @@ int main(int argc, char *argv[]) {
 
        snprintf(title, sizeof(title), "%s - %s", NAME, SLOGAN);
 
-       if (! (cmdfile = fopen("/proc/cmdline", "r"))) {
-               fprintf(flog, "Couldn't open commandline: /proc/cmdline\n");
-       } else {
-               fgets(line, STRING_SIZE, cmdfile);
-
-               // check if we have to make an unattended install
-               if (strstr(line, "installer.unattended") != NULL) {
-                   splashWindow(title, _("Warning: Unattended installation will start in 10 seconds..."), 10);
-                   unattended = 1;
-               }
+       // Parse parameters from the kernel command line
+       parse_command_line(&config);
 
-               // check if the installer should start networking
-               if (strstr(line, "installer.net") != NULL) {
-                       require_networking = 1;
-               }
-
-               // check if we have to patch for serial console
-               if (strstr (line, "console=ttyS0") != NULL) {
-                   serialconsole = 1;
-               }
+       if (config.unattended) {
+               splashWindow(title, _("Warning: Unattended installation will start in 10 seconds..."), 10);
        }
 
        // Load common modules
        mysystem(logfile, "/sbin/modprobe vfat"); // USB key
        hw_stop_all_raid_arrays(logfile);
 
-       if (!unattended) {
+       if (!config.unattended) {
                // Language selection
                char* langnames[NUM_LANGS + 1];
 
@@ -327,7 +379,7 @@ int main(int argc, char *argv[]) {
                assert(choice <= NUM_LANGS);
 
                fprintf(flog, "Selected language: %s (%s)\n", languages[choice].name, languages[choice].code);
-               snprintf(language, sizeof(language), languages[choice].code);
+               snprintf(language, sizeof(language), "%s", languages[choice].code);
 
                setenv("LANGUAGE", language, 1);
                setlocale(LC_ALL, language);
@@ -336,7 +388,7 @@ int main(int argc, char *argv[]) {
        char* helpline = center_string(_("<Tab>/<Alt-Tab> between elements | <Space> selects | <F12> next screen"), screen_cols);
        newtPushHelpLine(helpline);
 
-       if (!unattended) {
+       if (!config.unattended) {
                snprintf(message, sizeof(message),
                        _("Welcome to the %s installation program.\n\n"
                        "Selecting Cancel on any of the following screens will reboot the computer."), NAME);
@@ -345,16 +397,21 @@ int main(int argc, char *argv[]) {
 
        /* Search for a source drive that holds the right
         * version of the image we are going to install. */
-       sourcedrive = hw_find_source_medium(hw);
-       fprintf(flog, "Source drive: %s\n", sourcedrive);
+       if (!config.perform_download) {
+               sourcedrive = hw_find_source_medium(hw);
+               fprintf(flog, "Source drive: %s\n", sourcedrive);
+       }
 
        /* If we could not find a source drive, we will try
         * downloading the install image */
-       if (!sourcedrive) {
-               if (!unattended) {
+       if (!sourcedrive)
+               config.perform_download = 1;
+
+       if (config.perform_download) {
+               if (!config.unattended) {
                        // Show the right message to the user
                        char reason[STRING_SIZE];
-                       if (require_networking) {
+                       if (config.perform_download) {
                                snprintf(reason, sizeof(reason),
                                        _("The installer will now try downloading the installation image."));
                        } else {
@@ -373,11 +430,12 @@ int main(int argc, char *argv[]) {
                                goto EXIT;
                }
 
-               require_networking = 1;
+               // Make sure that we enable networking before download
+               config.require_networking = 1;
        }
 
        // Try starting the networking if we require it
-       if (require_networking) {
+       if (config.require_networking) {
                while (1) {
                        statuswindow(60, 4, title, _("Trying to start networking (DHCP)..."));
 
@@ -401,20 +459,31 @@ int main(int argc, char *argv[]) {
                }
 
                // Download the image if required
-               while (!sourcedrive) {
-                       snprintf(commandstring, sizeof(commandstring), "/usr/bin/downloadsource.sh %s", SOURCE_TEMPFILE);
-                       runcommandwithstatus(commandstring, title, _("Downloading installation image..."), logfile);
-
-                       FILE* f = fopen(SOURCE_TEMPFILE, "r");
-                       if (f) {
-                               sourcedrive = SOURCE_TEMPFILE;
-                               fclose(f);
-                       } else {
-                               rc = newtWinOkCancel(title, _("The installation image could not be downloaded."),
-                                       60, 8, _("Retry"), _("Cancel"));
+               if (config.perform_download) {
+                       fprintf(flog, "Download URL: %s\n", config.download_url);
+                       snprintf(commandstring, sizeof(commandstring), "/usr/bin/downloadsource.sh %s %s",
+                               SOURCE_TEMPFILE, config.download_url);
+
+                       while (!sourcedrive) {
+                               rc = runcommandwithstatus(commandstring, title, _("Downloading installation image..."), logfile);
+
+                               FILE* f = fopen(SOURCE_TEMPFILE, "r");
+                               if (f) {
+                                       sourcedrive = SOURCE_TEMPFILE;
+                                       fclose(f);
+                               } else {
+                                       char reason[STRING_SIZE] = "-";
+                                       if (rc == 2)
+                                               snprintf(reason, sizeof(STRING_SIZE), _("MD5 checksum mismatch"));
 
-                               if (rc)
-                                       goto EXIT;
+                                       snprintf(message, sizeof(message),
+                                               _("The installation image could not be downloaded.\n  Reason: %s\n\n%s"),
+                                               reason, config.download_url);
+
+                                       rc = newtWinOkCancel(title, message, 75, 12, _("Retry"), _("Cancel"));
+                                       if (rc)
+                                               goto EXIT;
+                               }
                        }
                }
        }
@@ -423,24 +492,17 @@ int main(int argc, char *argv[]) {
 
        int r = hw_mount(sourcedrive, SOURCE_MOUNT_PATH, "iso9660", MS_RDONLY);
        if (r) {
-               fprintf(flog, "Could not mount %s to %s\n", sourcedrive, SOURCE_MOUNT_PATH);
-               fprintf(flog, strerror(errno));
-               exit(1);
-       }
-
-       /* load unattended configuration */
-       if (unattended) {
-           fprintf(flog, "unattended: Reading unattended.conf\n");
-
-           (void) readkeyvalues(unattendedkv, UNATTENDED_CONF);
-           findkey(unattendedkv, "RESTORE_FILE", restore_file);
+               snprintf(message, sizeof(message), _("Could not mount %s to %s:\n  %s\n"),
+                       sourcedrive, SOURCE_MOUNT_PATH, strerror(errno));
+               errorbox(message);
+               goto EXIT;
        }
 
-       if (!unattended) {
+       if (!config.unattended) {
                // Read the license file.
                if (!(copying = fopen(LICENSE_FILE, "r"))) {
                        sprintf(discl_msg, "Could not open license file: %s\n", LICENSE_FILE);
-                       fprintf(flog, discl_msg);
+                       fprintf(flog, "%s", discl_msg);
                } else {
                        fread(discl_msg, 1, 40000, copying);
                        fclose(copying);
@@ -463,7 +525,7 @@ int main(int argc, char *argv[]) {
 
        // Check how many disks have been found and what
        // we can do with them.
-       unsigned int num_disks = hw_count_disks(disks);
+       unsigned int num_disks = hw_count_disks((const struct hw_disk**)disks);
 
        while (1) {
                // no harddisks found
@@ -474,8 +536,8 @@ int main(int argc, char *argv[]) {
                // exactly one disk has been found
                // or if we are running in unattended mode, we will select
                // the first disk and go with that one
-               } else if ((num_disks == 1) || (unattended && num_disks >= 1)) {
-                       selected_disks = hw_select_first_disk(disks);
+               } else if ((num_disks == 1) || (config.unattended && num_disks >= 1)) {
+                       selected_disks = hw_select_first_disk((const struct hw_disk**)disks);
 
                // more than one usable disk has been found and
                // the user needs to choose what to do with them
@@ -484,7 +546,7 @@ int main(int argc, char *argv[]) {
                        int disk_selection[num_disks];
 
                        for (unsigned int i = 0; i < num_disks; i++) {
-                               disk_names[i] = &disks[i]->description;
+                               disk_names[i] = disks[i]->description;
                                disk_selection[i] = 0;
                        }
 
@@ -512,10 +574,10 @@ int main(int argc, char *argv[]) {
 
                // Don't print the auto-selected harddisk setup in
                // unattended mode.
-               if (unattended)
+               if (config.unattended)
                        break;
 
-               num_selected_disks = hw_count_disks(selected_disks);
+               num_selected_disks = hw_count_disks((const struct hw_disk**)selected_disks);
 
                if (num_selected_disks == 1) {
                        snprintf(message, sizeof(message),
@@ -554,7 +616,7 @@ int main(int argc, char *argv[]) {
 
        hw_free_disks(disks);
 
-       struct hw_destination* destination = hw_make_destination(part_type, selected_disks);
+       struct hw_destination* destination = hw_make_destination(part_type, selected_disks, config.disable_swap);
 
        if (!destination) {
                errorbox(_("Your harddisk is too small."));
@@ -570,19 +632,21 @@ int main(int argc, char *argv[]) {
        fprintf(flog, "Memory   : %lluMB\n", BYTES2MB(hw_memory()));
 
        // Warn the user if there is not enough space to create a swap partition
-       if (!unattended && !*destination->part_swap) {
-               rc = newtWinChoice(title, _("OK"), _("Cancel"),
-                       _("Your harddisk is very small, but you can continue without a swap partition."));
+       if (!config.unattended) {
+               if (!config.disable_swap && !*destination->part_swap) {
+                       rc = newtWinChoice(title, _("OK"), _("Cancel"),
+                               _("Your harddisk is very small, but you can continue without a swap partition."));
 
-               if (rc != 1)
-                       goto EXIT;
+                       if (rc != 1)
+                               goto EXIT;
+               }
        }
 
        // Filesystem selection
-       if (!unattended) {
+       if (!config.unattended) {
                struct filesystems {
                        int fstype;
-                       const char* description;
+                       char* description;
                } filesystems[] = {
                        { HW_FS_EXT4,            _("ext4 Filesystem") },
                        { HW_FS_EXT4_WO_JOURNAL, _("ext4 Filesystem without journal") },
@@ -686,7 +750,7 @@ int main(int argc, char *argv[]) {
        statuswindow(60, 4, title, _("Installing the bootloader..."));
 
        /* Serial console ? */
-       if (serialconsole) {
+       if (config.serial_console) {
                /* grub */
                FILE* f = fopen(DESTINATION_MOUNT_PATH "/etc/default/grub", "a");
                if (!f) {
@@ -725,7 +789,7 @@ int main(int argc, char *argv[]) {
        char* backup_file = hw_find_backup_file(logfile, SOURCE_MOUNT_PATH);
        if (backup_file) {
                rc = 0;
-               if (!unattended) {
+               if (!config.unattended) {
                        rc = newtWinOkCancel(title, _("A backup file has been found on the installation image.\n\n"
                                "Do you want to restore the backup?"), 50, 10, _("Yes"), _("No"));
                }
@@ -752,10 +816,21 @@ int main(int argc, char *argv[]) {
        // Umount source drive and eject
        hw_umount(SOURCE_MOUNT_PATH);
 
+       // Download and execute the postinstall script
+       if (*config.postinstall) {
+               snprintf(commandstring, sizeof(commandstring),
+                       "/usr/bin/execute-postinstall.sh %s %s", DESTINATION_MOUNT_PATH, config.postinstall);
+
+               if (runcommandwithstatus(commandstring, title, _("Running post-install script..."), logfile)) {
+                       errorbox(_("Post-install script failed."));
+                       goto EXIT;
+               }
+       }
+
        snprintf(commandstring, STRING_SIZE, "/usr/bin/eject %s", sourcedrive);
        mysystem(logfile, commandstring);
 
-       if (!unattended) {
+       if (!config.unattended) {
                snprintf(message, sizeof(message), _(
                        "%s was successfully installed!\n\n"
                        "Please remove any installation mediums from this system and hit the reboot button. "
index faeeb17237fef60adfd854934be5acd108aaec4b..3cb7a2172e6e6ae3190ddbc481c7880beae12e13 100644 (file)
@@ -56,6 +56,10 @@ function main() {
                fi
 
                echo "Successfully started on ${interface}"
+
+               # Wait until everything is settled
+               sleep 15
+
                return 0
        done