From bfcf8067f371dc1370a787b17b3934e56d35b3bd Mon Sep 17 00:00:00 2001 From: keoma Date: Sat, 9 Feb 2019 12:42:19 +0100 Subject: [PATCH 1/9] removing sudo calls --- scripts/_common.sh | 2 +- scripts/install | 74 +++++++++++++++++++++++----------------------- scripts/remove | 24 +++++++-------- scripts/restore | 2 +- 4 files changed, 51 insertions(+), 51 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 247bd4d..e6a909a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -24,7 +24,7 @@ function ynh_systemctl() local LOCKFILE="/var/run/moulinette_yunohost.lock" # Launch the action - sudo systemctl "$ACTION" "$SERVICE" & + systemctl "$ACTION" "$SERVICE" & local SYSCTLACTION=$! # Save and release the lock... diff --git a/scripts/install b/scripts/install index c252683..a504e0b 100644 --- a/scripts/install +++ b/scripts/install @@ -119,7 +119,7 @@ export DEBIAN_FRONTEND=noninteractive if [[ $firmware_nonfree == yes ]]; then # check if non-free is set on sources.list if ! grep -q non-free /etc/apt/sources.list ; then - sudo sed '/debian/{s/main/& non-free/}' -i /etc/apt/sources.list + sed '/debian/{s/main/& non-free/}' -i /etc/apt/sources.list fi packages=$nonfree_packages @@ -130,15 +130,15 @@ else # https://www.fsf.org/news/ryf-certification-thinkpenguin-usb-with-atheros-chip # https://wiki.debian.org/ath9k_htc/open_firmware mkdir -p /lib/firmware - sudo install -b -o root -g root -m 0644 ../conf/firmware_htc-7010.fw /lib/firmware/htc_7010.fw - sudo install -b -o root -g root -m 0644 ../conf/firmware_htc-9271.fw /lib/firmware/htc_9271.fw + install -b -o root -g root -m 0644 ../conf/firmware_htc-7010.fw /lib/firmware/htc_7010.fw + install -b -o root -g root -m 0644 ../conf/firmware_htc-9271.fw /lib/firmware/htc_9271.fw fi -sudo apt-get --assume-yes --force-yes install ${packages} +apt-get --assume-yes --force-yes install ${packages} if [[ $? -ne 0 ]]; then - sudo apt-get update - sudo apt-get --assume-yes --force-yes install ${packages} + apt-get update + apt-get --assume-yes --force-yes install ${packages} fi #================================================= @@ -196,61 +196,61 @@ ynh_app_setting_set $app vpnclient -v no # INSTALL CUSTOM SCRIPTS #================================================= -sudo install -o root -g root -m 0755 ../conf/iw_multissid /usr/local/bin/ -sudo install -o root -g root -m 0755 ../conf/iw_devices /usr/local/bin/ -sudo install -o root -g root -m 0755 ../conf/iw_ssids /usr/local/bin/ -sudo install -o root -g root -m 0755 ../conf/ipv6_expanded /usr/local/bin/ -sudo install -o root -g root -m 0755 ../conf/ipv6_compressed /usr/local/bin/ +install -o root -g root -m 0755 ../conf/iw_multissid /usr/local/bin/ +install -o root -g root -m 0755 ../conf/iw_devices /usr/local/bin/ +install -o root -g root -m 0755 ../conf/iw_ssids /usr/local/bin/ +install -o root -g root -m 0755 ../conf/ipv6_expanded /usr/local/bin/ +install -o root -g root -m 0755 ../conf/ipv6_compressed /usr/local/bin/ #================================================= # COPY CONFIGS #================================================= -sudo mkdir -pm 0755 /var/log/nginx/ -sudo mkdir -pm 0755 /etc/dnsmasq.dhcpd/ -sudo chown root: /etc/dnsmasq.dhcpd/ +mkdir -pm 0755 /var/log/nginx/ +mkdir -pm 0755 /etc/dnsmasq.dhcpd/ +chown root: /etc/dnsmasq.dhcpd/ -sudo install -b -o root -g root -m 0644 ../conf/hostapd.conf.tpl? /etc/hostapd/ -sudo install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv6.conf.tpl /etc/dnsmasq.dhcpd/dhcpdv6.conf.tpl -sudo install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv4.conf.tpl /etc/dnsmasq.dhcpd/dhcpdv4.conf.tpl -sudo install -b -o root -g root -m 0644 ../conf/nginx_wifiadmin.conf "/etc/nginx/conf.d/${domain}.d/wifiadmin.conf" -sudo install -b -o root -g root -m 0644 ../conf/phpfpm_wifiadmin.conf /etc/php5/fpm/pool.d/wifiadmin.conf +install -b -o root -g root -m 0644 ../conf/hostapd.conf.tpl? /etc/hostapd/ +install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv6.conf.tpl /etc/dnsmasq.dhcpd/dhcpdv6.conf.tpl +install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv4.conf.tpl /etc/dnsmasq.dhcpd/dhcpdv4.conf.tpl +install -b -o root -g root -m 0644 ../conf/nginx_wifiadmin.conf "/etc/nginx/conf.d/${domain}.d/wifiadmin.conf" +install -b -o root -g root -m 0644 ../conf/phpfpm_wifiadmin.conf /etc/php5/fpm/pool.d/wifiadmin.conf #================================================= # COPY WEB SOURCES #================================================= -sudo mkdir -pm 0755 /var/www/wifiadmin/ -sudo cp -a ../sources/* /var/www/wifiadmin/ +mkdir -pm 0755 /var/www/wifiadmin/ +cp -a ../sources/* /var/www/wifiadmin/ -sudo chown -R root: /var/www/wifiadmin/ -sudo chmod -R 0644 /var/www/wifiadmin/* -sudo find /var/www/wifiadmin/ -type d -exec chmod +x {} \; +chown -R root: /var/www/wifiadmin/ +chmod -R 0644 /var/www/wifiadmin/* +find /var/www/wifiadmin/ -type d -exec chmod +x {} \; #================================================= # FIX CONFIGS #================================================= ## hostapd -sudo sed 's|^DAEMON_CONF=$|&/etc/hostapd/hostapd.conf|' -i /etc/init.d/hostapd +sed 's|^DAEMON_CONF=$|&/etc/hostapd/hostapd.conf|' -i /etc/init.d/hostapd ## nginx -sudo sed "s||${path_url}|g" -i "/etc/nginx/conf.d/${domain}.d/wifiadmin.conf" -sudo sed 's||/var/www/wifiadmin/|g' -i "/etc/nginx/conf.d/${domain}.d/wifiadmin.conf" -sudo sed 's||wifiadmin|g' -i "/etc/nginx/conf.d/${domain}.d/wifiadmin.conf" +sed "s||${path_url}|g" -i "/etc/nginx/conf.d/${domain}.d/wifiadmin.conf" +sed 's||/var/www/wifiadmin/|g' -i "/etc/nginx/conf.d/${domain}.d/wifiadmin.conf" +sed 's||wifiadmin|g' -i "/etc/nginx/conf.d/${domain}.d/wifiadmin.conf" ## php-fpm -sudo sed 's||wifiadmin|g' -i /etc/php5/fpm/pool.d/wifiadmin.conf -sudo sed 's||admin|g' -i /etc/php5/fpm/pool.d/wifiadmin.conf -sudo sed 's||admins|g' -i /etc/php5/fpm/pool.d/wifiadmin.conf -sudo sed 's||/var/www/wifiadmin/|g' -i /etc/php5/fpm/pool.d/wifiadmin.conf +sed 's||wifiadmin|g' -i /etc/php5/fpm/pool.d/wifiadmin.conf +sed 's||admin|g' -i /etc/php5/fpm/pool.d/wifiadmin.conf +sed 's||admins|g' -i /etc/php5/fpm/pool.d/wifiadmin.conf +sed 's||/var/www/wifiadmin/|g' -i /etc/php5/fpm/pool.d/wifiadmin.conf # Fix sources -sudo sed "s||${path_url}|g" -i /var/www/wifiadmin/config.php +sed "s||${path_url}|g" -i /var/www/wifiadmin/config.php # Copy init script -sudo install -o root -g root -m 0755 ../conf/ynh-hotspot /usr/local/bin/ -sudo install -o root -g root -m 0644 ../conf/ynh-hotspot.service /etc/systemd/system/ +install -o root -g root -m 0755 ../conf/ynh-hotspot /usr/local/bin/ +install -o root -g root -m 0644 ../conf/ynh-hotspot.service /etc/systemd/system/ # Update firewall for DHCP yunohost firewall allow --no-upnp --ipv6 UDP 547 @@ -267,9 +267,9 @@ systemctl reload nginx # Remove IPv6 address set if there is a VPN installed if [[ $ip6_addr != none ]]; then - sudo ip -6 address show dev tun0 2> /dev/null | grep -q "${ip6_addr}/" + ip -6 address show dev tun0 2> /dev/null | grep -q "${ip6_addr}/" if [[ "$?" -eq 0 ]]; then - sudo ip address delete "${ip6_addr}/128" dev tun0 &> /dev/null + ip address delete "${ip6_addr}/128" dev tun0 &> /dev/null fi fi diff --git a/scripts/remove b/scripts/remove index 7d7c87d..ee05d3e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -39,18 +39,18 @@ firmware_nonfree=$(ynh_app_setting_get $app firmware_nonfree) systemctl stop ynh-hotspot systemctl disable ynh-hotspot yunohost service remove ynh-hotspot -sudo rm -f /etc/systemd/system/ynh-hotspot.service /usr/local/bin/ynh-hotspot -sudo rm -f /tmp/.ynh-hotspot-* +rm -f /etc/systemd/system/ynh-hotspot.service /usr/local/bin/ynh-hotspot +rm -f /tmp/.ynh-hotspot-* # Update firewall for DHCP -sudo yunohost firewall disallow --ipv6 UDP 547 -sudo yunohost firewall disallow UDP 67 +yunohost firewall disallow --ipv6 UDP 547 +yunohost firewall disallow UDP 67 # Remove confs -sudo rm -fr /etc/dnsmasq.dhcpd/ -sudo rm -f /etc/hostapd/hostapd.conf{.tpl?,} -sudo rm -f /etc/nginx/conf.d/${domain}.d/wifiadmin.conf -sudo rm -f /etc/php5/fpm/pool.d/wifiadmin.conf +rm -fr /etc/dnsmasq.dhcpd/ +rm -f /etc/hostapd/hostapd.conf{.tpl?,} +rm -f /etc/nginx/conf.d/${domain}.d/wifiadmin.conf +rm -f /etc/php5/fpm/pool.d/wifiadmin.conf # Remove packages if [[ $firmware_nonfree == yes ]]; then @@ -60,15 +60,15 @@ else # Remove free firmwares if ! dpkg -l firmware-atheros &> /dev/null; then - sudo rm -f /lib/firmware/htc_7010.fw - sudo rm -f /lib/firmware/htc_9271.fw + rm -f /lib/firmware/htc_7010.fw + rm -f /lib/firmware/htc_9271.fw fi fi -sudo apt-get --assume-yes --force-yes remove ${packages} +apt-get --assume-yes --force-yes remove ${packages} # Restart services systemctl restart php5-fpm systemctl reload nginx # Remove sources -sudo rm -rf /var/www/wifiadmin/ +rm -rf /var/www/wifiadmin/ diff --git a/scripts/restore b/scripts/restore index 4af1fd5..c273ba2 100644 --- a/scripts/restore +++ b/scripts/restore @@ -27,4 +27,4 @@ git --work-tree "${tmpdir}/" --git-dir "${tmpdir}/.git/" reset --hard "${gitcomm cd "${tmpdir}/scripts/" bash ./upgrade -sudo rm -r "${tmpdir}/" +rm -r "${tmpdir}/" From e4c80d4c6ba65c5c03482a2bad8ac75a998efc0b Mon Sep 17 00:00:00 2001 From: keoma Date: Sat, 9 Feb 2019 12:51:11 +0100 Subject: [PATCH 2/9] now using ynh_secure_remove helper --- scripts/_common.sh | 2 +- scripts/remove | 18 +++++++++--------- scripts/restore | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index e6a909a..a3841d6 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -29,7 +29,7 @@ function ynh_systemctl() # Save and release the lock... cp $LOCKFILE $LOCKFILE.bkp.$$ - rm $LOCKFILE + ynh_secure_remove $LOCKFILE # Wait for the end of the action wait $SYSCTLACTION diff --git a/scripts/remove b/scripts/remove index ee05d3e..7bec02e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -39,18 +39,18 @@ firmware_nonfree=$(ynh_app_setting_get $app firmware_nonfree) systemctl stop ynh-hotspot systemctl disable ynh-hotspot yunohost service remove ynh-hotspot -rm -f /etc/systemd/system/ynh-hotspot.service /usr/local/bin/ynh-hotspot -rm -f /tmp/.ynh-hotspot-* +ynh_secure_remove /etc/systemd/system/ynh-hotspot.service /usr/local/bin/ynh-hotspot +ynh_secure_remove /tmp/.ynh-hotspot-* # Update firewall for DHCP yunohost firewall disallow --ipv6 UDP 547 yunohost firewall disallow UDP 67 # Remove confs -rm -fr /etc/dnsmasq.dhcpd/ -rm -f /etc/hostapd/hostapd.conf{.tpl?,} -rm -f /etc/nginx/conf.d/${domain}.d/wifiadmin.conf -rm -f /etc/php5/fpm/pool.d/wifiadmin.conf +ynh_secure_remove /etc/dnsmasq.dhcpd/ +ynh_secure_remove /etc/hostapd/hostapd.conf{.tpl?,} +ynh_secure_remove /etc/nginx/conf.d/${domain}.d/wifiadmin.conf +ynh_secure_remove /etc/php5/fpm/pool.d/wifiadmin.conf # Remove packages if [[ $firmware_nonfree == yes ]]; then @@ -60,8 +60,8 @@ else # Remove free firmwares if ! dpkg -l firmware-atheros &> /dev/null; then - rm -f /lib/firmware/htc_7010.fw - rm -f /lib/firmware/htc_9271.fw + ynh_secure_remove /lib/firmware/htc_7010.fw + ynh_secure_remove /lib/firmware/htc_9271.fw fi fi apt-get --assume-yes --force-yes remove ${packages} @@ -71,4 +71,4 @@ systemctl restart php5-fpm systemctl reload nginx # Remove sources -rm -rf /var/www/wifiadmin/ +ynh_secure_remove /var/www/wifiadmin/ diff --git a/scripts/restore b/scripts/restore index c273ba2..a3e9ef8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -27,4 +27,4 @@ git --work-tree "${tmpdir}/" --git-dir "${tmpdir}/.git/" reset --hard "${gitcomm cd "${tmpdir}/scripts/" bash ./upgrade -rm -r "${tmpdir}/" +ynh_secure_remove "${tmpdir}/" From e4ea067b2680945a0c2139882ec7d7ec044f0daf Mon Sep 17 00:00:00 2001 From: keoma Date: Sat, 9 Feb 2019 12:55:45 +0100 Subject: [PATCH 3/9] Revert "now using ynh_secure_remove helper" This reverts commit e4c80d4c6ba65c5c03482a2bad8ac75a998efc0b. --- scripts/_common.sh | 2 +- scripts/remove | 18 +++++++++--------- scripts/restore | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index a3841d6..e6a909a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -29,7 +29,7 @@ function ynh_systemctl() # Save and release the lock... cp $LOCKFILE $LOCKFILE.bkp.$$ - ynh_secure_remove $LOCKFILE + rm $LOCKFILE # Wait for the end of the action wait $SYSCTLACTION diff --git a/scripts/remove b/scripts/remove index 7bec02e..ee05d3e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -39,18 +39,18 @@ firmware_nonfree=$(ynh_app_setting_get $app firmware_nonfree) systemctl stop ynh-hotspot systemctl disable ynh-hotspot yunohost service remove ynh-hotspot -ynh_secure_remove /etc/systemd/system/ynh-hotspot.service /usr/local/bin/ynh-hotspot -ynh_secure_remove /tmp/.ynh-hotspot-* +rm -f /etc/systemd/system/ynh-hotspot.service /usr/local/bin/ynh-hotspot +rm -f /tmp/.ynh-hotspot-* # Update firewall for DHCP yunohost firewall disallow --ipv6 UDP 547 yunohost firewall disallow UDP 67 # Remove confs -ynh_secure_remove /etc/dnsmasq.dhcpd/ -ynh_secure_remove /etc/hostapd/hostapd.conf{.tpl?,} -ynh_secure_remove /etc/nginx/conf.d/${domain}.d/wifiadmin.conf -ynh_secure_remove /etc/php5/fpm/pool.d/wifiadmin.conf +rm -fr /etc/dnsmasq.dhcpd/ +rm -f /etc/hostapd/hostapd.conf{.tpl?,} +rm -f /etc/nginx/conf.d/${domain}.d/wifiadmin.conf +rm -f /etc/php5/fpm/pool.d/wifiadmin.conf # Remove packages if [[ $firmware_nonfree == yes ]]; then @@ -60,8 +60,8 @@ else # Remove free firmwares if ! dpkg -l firmware-atheros &> /dev/null; then - ynh_secure_remove /lib/firmware/htc_7010.fw - ynh_secure_remove /lib/firmware/htc_9271.fw + rm -f /lib/firmware/htc_7010.fw + rm -f /lib/firmware/htc_9271.fw fi fi apt-get --assume-yes --force-yes remove ${packages} @@ -71,4 +71,4 @@ systemctl restart php5-fpm systemctl reload nginx # Remove sources -ynh_secure_remove /var/www/wifiadmin/ +rm -rf /var/www/wifiadmin/ diff --git a/scripts/restore b/scripts/restore index a3e9ef8..c273ba2 100644 --- a/scripts/restore +++ b/scripts/restore @@ -27,4 +27,4 @@ git --work-tree "${tmpdir}/" --git-dir "${tmpdir}/.git/" reset --hard "${gitcomm cd "${tmpdir}/scripts/" bash ./upgrade -ynh_secure_remove "${tmpdir}/" +rm -r "${tmpdir}/" From 8617c23c2bfe08f512f89a09961c44a2d3c3e06f Mon Sep 17 00:00:00 2001 From: keoma Date: Sat, 9 Feb 2019 13:03:20 +0100 Subject: [PATCH 4/9] properly using ynh_secure_remove --- scripts/_common.sh | 2 +- scripts/remove | 25 ++++++++++++++++--------- scripts/restore | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index e6a909a..a3841d6 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -29,7 +29,7 @@ function ynh_systemctl() # Save and release the lock... cp $LOCKFILE $LOCKFILE.bkp.$$ - rm $LOCKFILE + ynh_secure_remove $LOCKFILE # Wait for the end of the action wait $SYSCTLACTION diff --git a/scripts/remove b/scripts/remove index ee05d3e..686375f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -39,18 +39,25 @@ firmware_nonfree=$(ynh_app_setting_get $app firmware_nonfree) systemctl stop ynh-hotspot systemctl disable ynh-hotspot yunohost service remove ynh-hotspot -rm -f /etc/systemd/system/ynh-hotspot.service /usr/local/bin/ynh-hotspot -rm -f /tmp/.ynh-hotspot-* +ynh_secure_remove /etc/systemd/system/ynh-hotspot.service +ynh_secure_remove /usr/local/bin/ynh-hotspot +for FILE in $(ls /tmp/.ynh-hotspot-*) +do + ynh_secure_remove "$FILE" +done # Update firewall for DHCP yunohost firewall disallow --ipv6 UDP 547 yunohost firewall disallow UDP 67 # Remove confs -rm -fr /etc/dnsmasq.dhcpd/ -rm -f /etc/hostapd/hostapd.conf{.tpl?,} -rm -f /etc/nginx/conf.d/${domain}.d/wifiadmin.conf -rm -f /etc/php5/fpm/pool.d/wifiadmin.conf +ynh_secure_remove /etc/dnsmasq.dhcpd/ +ynh_secure_remove /etc/nginx/conf.d/${domain}.d/wifiadmin.conf +ynh_secure_remove /etc/php5/fpm/pool.d/wifiadmin.conf +for FILE in $(ls /etc/hostapd/hostapd.conf{.tpl?,}) +do + ynh_secure_remove "$FILE" +done # Remove packages if [[ $firmware_nonfree == yes ]]; then @@ -60,8 +67,8 @@ else # Remove free firmwares if ! dpkg -l firmware-atheros &> /dev/null; then - rm -f /lib/firmware/htc_7010.fw - rm -f /lib/firmware/htc_9271.fw + ynh_secure_remove /lib/firmware/htc_7010.fw + ynh_secure_remove /lib/firmware/htc_9271.fw fi fi apt-get --assume-yes --force-yes remove ${packages} @@ -71,4 +78,4 @@ systemctl restart php5-fpm systemctl reload nginx # Remove sources -rm -rf /var/www/wifiadmin/ +ynh_secure_remove /var/www/wifiadmin/ diff --git a/scripts/restore b/scripts/restore index c273ba2..a3e9ef8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -27,4 +27,4 @@ git --work-tree "${tmpdir}/" --git-dir "${tmpdir}/.git/" reset --hard "${gitcomm cd "${tmpdir}/scripts/" bash ./upgrade -rm -r "${tmpdir}/" +ynh_secure_remove "${tmpdir}/" From 3f352f89c4af57598229c097683a7cc9104da70c Mon Sep 17 00:00:00 2001 From: keoma Date: Sat, 9 Feb 2019 13:32:28 +0100 Subject: [PATCH 5/9] yep 2.1 - manifest --- manifest.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manifest.json b/manifest.json index b5260f4..5061fda 100644 --- a/manifest.json +++ b/manifest.json @@ -45,6 +45,7 @@ }, { "name": "wifi_ssid", + "type": "string", "ask": { "en": "Choose a wifi name (SSID)", "fr": "Choisissez un nom pour le wifi (SSID)" @@ -63,6 +64,7 @@ }, { "name": "firmware_nonfree", + "type": "boolean", "choice": ["yes", "no"], "ask": { "en": "Install non-free firmwares - in addition to the free ones - for the wifi dongle (yes/no)", From 7d3f8bedc3a13599d14cf0e36510bfc3c1321cbd Mon Sep 17 00:00:00 2001 From: keoma Date: Sat, 9 Feb 2019 13:35:46 +0100 Subject: [PATCH 6/9] replace yunohost app setting by helper --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index a504e0b..e1f62d5 100644 --- a/scripts/install +++ b/scripts/install @@ -150,8 +150,8 @@ if [[ ! -v ip6_net ]]; then # if ip6_net not set ip6_addr=none if [[ -e /tmp/.ynh-vpnclient-started ]]; then - vpnclient_ip6_net=$(sudo yunohost app setting vpnclient ip6_net 2>&1) - vpnclient_ip6_addr=$(sudo yunohost app setting vpnclient ip6_addr 2>&1) + vpnclient_ip6_net=$(sudo ynh_app_setting_set vpnclient ip6_net 2>&1) + vpnclient_ip6_addr=$(sudo ynh_app_setting_set vpnclient ip6_addr 2>&1) if [[ $vpnclient_ip6_net =~ :: && $vpnclient_ip6_addr =~ :: ]]; then ip6_net=${vpnclient_ip6_net} From 898604a772b4143df432f6943cc37c00daa4767f Mon Sep 17 00:00:00 2001 From: keoma Date: Sat, 9 Feb 2019 15:08:00 +0100 Subject: [PATCH 7/9] firmware_nonfree is now a boolean --- check_process | 2 +- manifest.json | 8 +++----- scripts/install | 2 +- scripts/remove | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/check_process b/check_process index 4645a79..672251a 100644 --- a/check_process +++ b/check_process @@ -5,7 +5,7 @@ path="/path" (PATH) wifi_ssid="myNeutralNetwork" wifi_passphrase="VhegT8oev0jZI" (PASSWORD) - firmware_nonfree="no" + firmware_nonfree=0 ; Checks pkg_linter=1 setup_sub_dir=1 diff --git a/manifest.json b/manifest.json index 5061fda..d83c03e 100644 --- a/manifest.json +++ b/manifest.json @@ -65,13 +65,11 @@ { "name": "firmware_nonfree", "type": "boolean", - "choice": ["yes", "no"], "ask": { - "en": "Install non-free firmwares - in addition to the free ones - for the wifi dongle (yes/no)", - "fr": "Installer des firmwares non-libres (en plus des libres) pour la clé USB wifi (yes/no)" + "en": "Install non-free firmwares - in addition to the free ones - for the wifi dongle", + "fr": "Installer des firmwares non-libres (en plus des libres) pour la clé USB wifi" }, - "example": "yes", - "default": "yes" + "default": "false" } ] } diff --git a/scripts/install b/scripts/install index e1f62d5..69b0455 100644 --- a/scripts/install +++ b/scripts/install @@ -116,7 +116,7 @@ export DEBIAN_FRONTEND=noninteractive # Packaged USB Wireless Device firmwares # Based on https://wiki.debian.org/WiFi#USB_Devices -if [[ $firmware_nonfree == yes ]]; then +if [[ $firmware_nonfree -eq 1 ]]; then # check if non-free is set on sources.list if ! grep -q non-free /etc/apt/sources.list ; then sed '/debian/{s/main/& non-free/}' -i /etc/apt/sources.list diff --git a/scripts/remove b/scripts/remove index 686375f..12bbe6a 100644 --- a/scripts/remove +++ b/scripts/remove @@ -60,7 +60,7 @@ do done # Remove packages -if [[ $firmware_nonfree == yes ]]; then +if [[ $firmware_nonfree -eq 1 ]]; then packages=$nonfree_packages else packages=$free_packages From c5c3b33025c8ebf15bbd3ff82437f59918c8f7ac Mon Sep 17 00:00:00 2001 From: keoma Date: Sun, 10 Feb 2019 01:13:04 +0100 Subject: [PATCH 8/9] Revert "firmware_nonfree is now a boolean" This reverts commit 898604a772b4143df432f6943cc37c00daa4767f. --- check_process | 2 +- manifest.json | 8 +++++--- scripts/install | 2 +- scripts/remove | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/check_process b/check_process index 672251a..4645a79 100644 --- a/check_process +++ b/check_process @@ -5,7 +5,7 @@ path="/path" (PATH) wifi_ssid="myNeutralNetwork" wifi_passphrase="VhegT8oev0jZI" (PASSWORD) - firmware_nonfree=0 + firmware_nonfree="no" ; Checks pkg_linter=1 setup_sub_dir=1 diff --git a/manifest.json b/manifest.json index d83c03e..5061fda 100644 --- a/manifest.json +++ b/manifest.json @@ -65,11 +65,13 @@ { "name": "firmware_nonfree", "type": "boolean", + "choice": ["yes", "no"], "ask": { - "en": "Install non-free firmwares - in addition to the free ones - for the wifi dongle", - "fr": "Installer des firmwares non-libres (en plus des libres) pour la clé USB wifi" + "en": "Install non-free firmwares - in addition to the free ones - for the wifi dongle (yes/no)", + "fr": "Installer des firmwares non-libres (en plus des libres) pour la clé USB wifi (yes/no)" }, - "default": "false" + "example": "yes", + "default": "yes" } ] } diff --git a/scripts/install b/scripts/install index 69b0455..e1f62d5 100644 --- a/scripts/install +++ b/scripts/install @@ -116,7 +116,7 @@ export DEBIAN_FRONTEND=noninteractive # Packaged USB Wireless Device firmwares # Based on https://wiki.debian.org/WiFi#USB_Devices -if [[ $firmware_nonfree -eq 1 ]]; then +if [[ $firmware_nonfree == yes ]]; then # check if non-free is set on sources.list if ! grep -q non-free /etc/apt/sources.list ; then sed '/debian/{s/main/& non-free/}' -i /etc/apt/sources.list diff --git a/scripts/remove b/scripts/remove index 12bbe6a..686375f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -60,7 +60,7 @@ do done # Remove packages -if [[ $firmware_nonfree -eq 1 ]]; then +if [[ $firmware_nonfree == yes ]]; then packages=$nonfree_packages else packages=$free_packages From 3386663c0256c6ad0fb8e75a037072effcb4964b Mon Sep 17 00:00:00 2001 From: keoma Date: Sun, 10 Feb 2019 01:13:58 +0100 Subject: [PATCH 9/9] firmware_nonfree as string --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 5061fda..768e335 100644 --- a/manifest.json +++ b/manifest.json @@ -64,7 +64,7 @@ }, { "name": "firmware_nonfree", - "type": "boolean", + "type": "string", "choice": ["yes", "no"], "ask": { "en": "Install non-free firmwares - in addition to the free ones - for the wifi dongle (yes/no)",