From: xf0r3m Date: Thu, 3 Aug 2023 09:38:38 +0000 (+0200) Subject: tests.sh - gotowe do testów X-Git-Url: https://gitweb.morketsmerke.org/?a=commitdiff_plain;h=14ed7fda40192b94c331a1033972e5a6c7d75a1b;p=immudex-testing.git tests.sh - gotowe do testów --- diff --git a/tests.sh b/tests.sh index 42b59f7..2be5865 100644 --- a/tests.sh +++ b/tests.sh @@ -15,6 +15,11 @@ function is_running() { return $?; } +function is_package_installed() { + apt list --installed | grep -q $1; + return $? +} + function is_immudex_lightdm_wallpaper() { value="background = /usr/share/images/desktop-base/lightdm_wallpaper.jpg"; file="/etc/lightdm/lightdm-gtk-greeter.conf"; @@ -318,4 +323,189 @@ function is_immudex_xfce4_notes_autostart() { value1="/home/xf0r3m/.config/autostart/autostart-x4notes.desktop"; result=$(is_file_correct $value $value1); return $result; -} +} + +function is_immudex_tool_create_media_ok() { + value="~/immudex-testing/files/106/create_media"; + value1="/usr/local/bin/create_media"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_immudex_hostname_ok() { + value="~/immudex-testing/files/106/immudex_hostname"; + value1="/usr/local/bin/immudex_hostname"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_pl_ok() { + value="~/immudex-testing/files/105/pl"; + value1="/usr/local/bin/pl"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_newsfeed_ok() { + value="~/immudex-testing/files/103/newsfeed"; + value1="/usr/local/bin/newsfeed"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_immudex_addons_ok() { + value="~/immudex-testing/files/101/immudex_addons"; + value1="/usr/local/bin/immudex_addons"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_autostart-x4notes_ok() { + value="~/immudex-testing/files/100/autostart-x4notes_ok"; + value1="/usr/local/bin/autostart-x4notes"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_immudex_branch_ok() { + value="~/immudex-testing/files/100/immudex_branch"; + value1="/usr/local/bin/immudex_branch"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_immudex_crypt_ok() { + value="~/immudex-testing/files/100/immudex_crypt"; + value1="/usr/local/bin/immudex_crypt"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_immudex_install_ok() { + value="~/immudex-testing/files/100/immudex_install"; + value1="/usr/local/bin/immudex_install"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_immudex_upgrade_ok() { + value="~/immudex-testing/files/100/immudex_upgrade"; + value1="/usr/local/bin/immudex_upgrade"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_import_gpgkeys_ok() { + value="~/immudex-testing/files/100/import_gpgkeys"; + value1="/usr/local/bin/import_gpgkeys"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_import_sshkeys_ok() { + value="~/immudex-testing/files/100/import_sshkeys"; + value1="/usr/local/bin/import_sshkeys"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_library_ok() { + value="~/immudex-testing/files/100/library.sh"; + value1="/usr/local/bin/library.sh"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_meteo_ok() { + value="~/immudex-testing/files/100/meteo"; + value1="/usr/local/bin/meteo"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_morketsmerke_ok() { + value="~/immudex-testing/files/100/morketsmerke"; + value1="/usr/local/bin/morketsmerke"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_motd2_ok() { + value="~/immudex-testing/files/100/motd2"; + value1="/usr/local/bin/motd2"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_notifier_ok() { + value="~/immudex-testing/files/100/notifier"; + value1="/usr/local/bin/notifier"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_padlock_ok() { + value="~/immudex-testing/files/100/padlock"; + value1="/usr/local/bin/padlock"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_secured-firefox_ok() { + value="~/immudex-testing/files/100/secured-firefox"; + value1="/usr/local/bin/secured-firefox"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_shoutcasts_ok() { + value="~/immudex-testing/files/100/shoutcasts"; + value1="/usr/local/bin/shoutcasts"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_sync_ok() { + value="~/immudex-tesitng/files/100/sync.sh"; + value1="/usr/local/bin/sync.sh"; + result=$(is_file_correct $value $value1); + return $result; +} + +function is_immudex_tool_ytplay_ok() { + value="~/immudex-testing/files/100/ytplay"; + value1="/usr/local/bin/ytplay"; + result=$(is_file_correct $value $value1); + return $result; +} + +list="live-boot systemd-sysv tzdata locales keyboard-configuration console-setup firejail ufw cryptsetup lsof extlinux grub-efi-amd64 efibootmgr bash-completion etherwake wakeonlan cifs-utils wget figlet mpv youtube-dl vim-gtk3 redshift irssi nmap nfs-common remmina python3-pip ffmpeg debootstrap squashfs-tools xorriso syslinux-efi grub-pc-bin grub-efi-amd64-bin mtools dosfstools chrony python3-venv isolinux rsync mutt gimp openvpn netselect-apt gvfs-backends dnsutils"; + +function check_packages() { + for i in $1; do + echo -n "Zainstalowano $i ..."; + if is_package_installed $1; then + echo -e "[ \e[32mOK\e[0m ]"; + else + echo -e "[ \e[31mFail\e[0m ]"; + fi + + done +} + + +flist="is_immudex_lightdm_wallpaper is_immudex_lightdm_default_user_image is_immudex_lightdm_theme is_immudex_default_wallpaper_set is_immudex_panel_whiskermenu_ok is_immudex_panel_activator_1_ok is_immudex_panel_activator_2_ok is_immudex_panel_activatior_3_ok is_immudex_widget_connky_running is_immudex_conky_file_ok is_immudex_keyboard_shortcut_config_ok is_immudex_check_terminal_config is_immudex_xfce_notes_config is_immudex_irssi_config_file_ok is_immudex_irssi_default_theme_ok is_immudex_libreoffice_config_dir is_immudex_firejail_config_ok is_immudex_notifier_distro_autostart_file_ok is_immudex_notifier_packages_autostart_file_ok is_immudex_redshift_config_ok is_immudex_redshift_autostart_file_ok is_immudex_user_defined_mime_ok is_immudex_sync_sh_share_dir is_immudex_hostname_service_file_ok is_immudex_right_firefox_profile is_immudex_apply_image_ok is_immudex_rss_image_ok is_immudex_notes_background_image_ok isnt_immudex_notrespass_backgroung_file is_immudex_hostname_service_enabled is_immudex_motd2_enabled is_immudex_chhome_alias is_immudex_ping_command_has_setuid is_immudex_is_default_hostname is_immudex_has_resolv_in_etc_hosts is_immudex_user_is_in_sudoers_file is_immudex_xf0r3m_is_in_sudoers_file is_immudex_dot_bashrc_user_file is_immudex_user_profile_image is_immudex_user_profile_image_icon is_immudex_user_fonts_dir is_immudex_user_dot_profile_file is_immudex_user_dot_vimrc_file is_immudex_xfce4_notes_autostart is_immudex_tool_create_media_ok is_immudex_tool_immudex_hostname_ok is_immudex_tool_pl_ok is_immudex_tool_newsfeed_ok is_immudex_tool_immudex_addons_ok is_immudex_tool_autostart-x4notes_ok is_immudex_tool_immudex_branch_ok is_immudex_tool_immudex_crypt_ok is_immudex_tool_immudex_install_ok is_immudex_tool_immudex_upgrade_ok is_immudex_tool_import_gpgkeys_ok is_immudex_tool_import_sshkeys_ok is_immudex_tool_library_ok is_immudex_tool_meteo_ok is_immudex_tool_morketsmerke_ok is_immudex_tool_motd2_ok is_immudex_tool_notifier_ok is_immudex_tool_padlock_ok is_immudex_tool_secured-firefox_ok is_immudex_tool_shoutcasts_ok is_immudex_tool_sync_ok is_immudex_tool_ytplay_ok"; + +function tests() { + for fn in $1; do + echo -n "Test: $fn ... "; + if $fn; then + echo -e "[ \e[32mOK\e[0m ]"; + else + echo -e "[ \e[31mFail\e[0m ]"; + fi + done +} + +check_packages $list; +tests $flist;