/alcasar.sh |
---|
589,6 → 589,9 |
IP_SETTING=`grep BOOTPROTO /etc/sysconfig/network-scripts/ifcfg-$EXTIF|cut -d"=" -f2` # test static or dynamic |
if [ $IP_SETTING == "dhcp" ] |
then |
DHCP_DNS_servers=`cat /var/lib/dhclient/dhclient--$EXTIF.lease |grep domain-name-servers|sed -n "1 p"| rev|cut -d" " -f1|rev|tr -d ';'` |
DNS1=`echo $DHCP_DNS_servers | cut -d"," -f1` |
DNS2=`echo $DHCP_DNS_servers | cut -d"," -f2` |
echo "PUBLIC_IP=dhcp" >> $CONF_FILE |
echo "GW=dhcp" >> $CONF_FILE |
else |
/iso/README.md |
---|
22,12 → 22,13 |
Usage : build-iso.sh |
This script can be run several times (the needed rpms are downloaded only one time) |
What can be done |
---------------- |
The ISO image seems to be already as light as it can be. With all the necessary packages, it weighs around 800 Mo. |
The ISO image seems to be already as light as it can be. With all the necessary packages, it weighs around 900 Mo. |
Here is a list of interesting functionalities: |
- if a needed RPM has not been updated, copy it from the Mageia iso file instead of download it from repository |
- Use DrakX to install and configure Alcasar graphically |
- Propose an automatic partition table suitable for Alcasar |
/iso/build-iso.sh |
---|
80,7 → 80,8 |
[ -d $directory ] || mkdir -p $directory |
done |
printBold "Mageiar will be build with Mageia-$MAGEIA_VERSION-$ARCH and $ALCASAR_EXTRACTED_DIR" |
# remove some rpm (if this script has been already run) |
# Update the system. Keep only RPMs needed to create ALCASAR rpmslist |
urpmi --auto-update --auto 2>/dev/null |
urpme $ISO_RPM_LIST --auto-orphans --force 2>/dev/null |
urpmi $BASE_RPM_LIST --force --auto 2>/dev/null |
# Retrieve list of installed RPM (without those that will be installed with the alcasar install script) |
130,9 → 131,13 |
for rpm in ${RPM_LIST}; do |
let percent="${count} * 100 / ${total}" |
full_rpm_name=`rpm -q $rpm` |
if [ `ls $urpmi_cache/* | grep $full_rpm_name | wc -l` -eq 0 ] ; then # rpm not already downloaded |
# dnf download --downloaddir $coreDirNew $rpm 1> /dev/null || errorExit "could not download $rpm" |
urpmi --no-install --replacepkgs -q $rpm 2> /dev/null || urpmi --no-install -q --force $rpm 2> /dev/null || echo "could not download $rpm" |
if [ `ls $urpmi_cache/$full_rpm_name* 2>/dev/null | wc -l` -ne 1 ] ; then # rpm isn't already in $urpmi_cache |
if [ `ls $coreDir/$full_rpm_name* 2>/dev/null | wc -l` -eq 1 ] ; then # rpm is in official ISO file |
cp $coreDir/$full_rpm_name* $urpmi_cache/ |
else # rpm must be downloaded |
# dnf download --downloaddir $coreDirNew $rpm 1> /dev/null || errorExit "could not download $rpm" |
urpmi --no-install --replacepkgs -q $rpm 2> /dev/null || urpmi --no-install -q --force $rpm 2> /dev/null || echo "could not download $rpm" |
fi |
fi |
printProgress ${percent} |
count=$(expr ${count} + 1) |
199,4 → 204,5 |
[ -d $directory ] && rm -rf $directory |
done |
rm -f "$AUTO_INSTALL_CFG" |
echo "All RPM are always in '/var/cache/urpmi/rpms'Done. Remove them if nedded." |
echo "All RPM are always in $urpmi_cache. Remove them if nedded." |
echo "The ISO file is here : ${TMP_DIR}/${newIsoName}" |
/scripts/alcasar-conf.sh |
---|
219,6 → 219,9 |
if [[ "$PUBLIC_IP_MASK" == "dhcp" ]] |
then |
PUBLIC_GATEWAY="dhcp" |
DHCP_DNS_servers=`cat /var/lib/dhclient/dhclient--$EXTIF.lease |grep domain-name-servers|sed -n "1 p"| rev|cut -d" " -f1|rev|tr -d ';'` |
DNS1=`echo $DHCP_DNS_servers | cut -d"," -f1` |
DNS2=`echo $DHCP_DNS_servers | cut -d"," -f2` |
else |
if ! echo $PUBLIC_IP_MASK | egrep -q $PTN |
then |
233,19 → 236,19 |
echo "Syntax error for the Gateway IP ($PUBLIC_GATEWAY)" |
exit 0 |
fi |
DNS1=`grep ^DNS1= $CONF_FILE|cut -d"=" -f2` |
if ! echo $DNS1 | egrep -q $PTN |
then |
echo "Syntax error for the IP address of the first DNS server ($DNS1)" |
exit 0 |
fi |
DNS2=`grep ^DNS2= $CONF_FILE|cut -d"=" -f2` |
if ! echo $DNS2 | egrep -q $PTN |
then |
echo "Syntax error for the IP address of the second DNS server ($DNS2)" |
exit 0 |
fi |
fi |
DNS1=`grep ^DNS1= $CONF_FILE|cut -d"=" -f2` |
if ! echo $DNS1 | egrep -q $PTN |
then |
echo "Syntax error for the IP address of the first DNS server ($DNS1)" |
exit 0 |
fi |
DNS2=`grep ^DNS2= $CONF_FILE|cut -d"=" -f2` |
if ! echo $DNS2 | egrep -q $PTN |
then |
echo "Syntax error for the IP address of the second DNS server ($DNS2)" |
exit 0 |
fi |
PRIVATE_IP=`echo $PRIVATE_IP_MASK | cut -d"/" -f1` |
PRIVATE_NETMASK=`/bin/ipcalc -m $PRIVATE_IP_MASK | cut -d"=" -f2` |
private_network_calc |
266,9 → 269,9 |
# Set the local DNS (or not) |
if [ "$INT_DNS_mode" = "on" ] || [ "$INT_DNS_mode" = "On" ] || [ "$INT_DNS_mode" = "ON" ] |
then |
$DIR_BIN/alcasar-dns-local.sh --on |
$DIR_BIN/alcasar-dns-local.sh --on-without-restart |
else |
$DIR_BIN/alcasar-dns-local.sh --off |
$DIR_BIN/alcasar-dns-local.sh --off-without-restart |
fi |
# Set the pure ip option (or not) |
if [ "$BL_PUREIP" = "off" ] || [ "$BL_PUREIP" = "Off" ] || [ "$BL_PUREIP" = "OFF" ] |
/scripts/alcasar-dns-local.sh |
---|
35,6 → 35,7 |
function restart_dns(){ |
for dns in unbound unbound-blacklist unbound-whitelist dnsmasq-whitelist unbound-blackhole |
do |
echo "Restarting $dns. Please wait..." |
systemctl restart $dns |
done |
} |
99,10 → 100,15 |
rm -f $LOCAL_DOMAIN_CONF_FILE |
$SED "s?^INT_DNS_ACTIVE.*?INT_DNS_ACTIVE=off?g" $ALCASAR_CONF_FILE |
restart_dns |
# Reload firewall |
/usr/local/bin/alcasar-iptables.sh |
;; |
--off-without-restart|-off-without-restart) # disable DNS redirector |
#$SED "s?^#filterwin2k.*?filterwin2k?g" $DNSMASQ_CONF_FILE |
rm -f $LOCAL_DOMAIN_CONF_FILE |
$SED "s?^INT_DNS_ACTIVE.*?INT_DNS_ACTIVE=off?g" $ALCASAR_CONF_FILE |
restart_dns |
/usr/local/bin/alcasar-iptables.sh |
;; |
--on|-on) # enable DNS redirector |
#$SED "s?^filterwin2k.*?#filterwin2k?g" $DNSMASQ_CONF_FILE |
cat > $LOCAL_DOMAIN_CONF_FILE << EOF |
113,10 → 119,20 |
forward-addr: $INT_DNS_IP |
EOF |
$SED "s?^INT_DNS_ACTIVE.*?INT_DNS_ACTIVE=on?g" $ALCASAR_CONF_FILE |
restart_dns |
# Reload firewall |
/usr/local/bin/alcasar-iptables.sh |
;; |
--on-without-restart|-on-without-restart) # enable DNS redirector |
#$SED "s?^filterwin2k.*?#filterwin2k?g" $DNSMASQ_CONF_FILE |
cat > $LOCAL_DOMAIN_CONF_FILE << EOF |
server: |
local-zone: "$INT_DNS_DOMAIN." transparent |
forward-zone: |
name: "$INT_DNS_DOMAIN." |
forward-addr: $INT_DNS_IP |
EOF |
$SED "s?^INT_DNS_ACTIVE.*?INT_DNS_ACTIVE=on?g" $ALCASAR_CONF_FILE |
/usr/local/bin/alcasar-iptables.sh |
;; |
*) |
echo "Argument inconnu : $1"; |
echo "$usage" |