removing all file not used for install-station
renamed gbinstall to install-station updated setup.py
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2014, GhostBSD
|
||||
Copyright (c) 2020, GhostBSD
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
gbinstall
|
||||
Install Station
|
||||
===
|
||||
It is a strip down version of gbi and it is the new installer for GhostBSD. It depend on gbi.
|
||||
|
||||
gbinstall is a graphical interface for pc-sysinstall and it is the new installer for GhostBSD.
|
||||
|
||||
To test this code in your environment run "python3.6 setup.py install" as root.
|
||||
Install Station only edit disk, partition and will install GhostBSD. Users and system setup will be done with at the first boot after installation with Setup Station
|
||||
@@ -34,78 +34,6 @@ def datafilelist(installbase, sourcebase):
|
||||
|
||||
prefix = sys.prefix
|
||||
|
||||
lib_gbinstall = [
|
||||
'src/confirm_installation.py',
|
||||
'src/boot_manager.py',
|
||||
'src/create_cfg.py',
|
||||
'src/db_partition.py',
|
||||
'src/end.py',
|
||||
'src/error.py',
|
||||
'src/gbiWindow.py',
|
||||
'src/ghostbsd-style.css',
|
||||
'src/install.png',
|
||||
'src/install.py',
|
||||
'src/installType.py',
|
||||
'src/language.py',
|
||||
'src/logo.png',
|
||||
'src/partition.py',
|
||||
'src/slides.py',
|
||||
'src/sys_handler.py',
|
||||
'src/use_ufs.py',
|
||||
'src/use_zfs.py'
|
||||
]
|
||||
|
||||
slide_images = [
|
||||
'src/slide-images/ghostbsd/browser.png',
|
||||
'src/slide-images/ghostbsd/customize.png',
|
||||
'src/slide-images/ghostbsd/email.png',
|
||||
'src/slide-images/ghostbsd/help.png',
|
||||
'src/slide-images/ghostbsd/G-logo.png',
|
||||
'src/slide-images/ghostbsd/music.png',
|
||||
'src/slide-images/ghostbsd/office.png',
|
||||
'src/slide-images/ghostbsd/photo.png',
|
||||
'src/slide-images/ghostbsd/social.png',
|
||||
'src/slide-images/ghostbsd/software.png',
|
||||
'src/slide-images/ghostbsd/welcome.png'
|
||||
]
|
||||
|
||||
|
||||
backend_query = [
|
||||
'src/backend-query/detect-laptop.sh',
|
||||
'src/backend-query/detect-nics.sh',
|
||||
'src/backend-query/detect-sheme.sh',
|
||||
'src/backend-query/detect-vmware.sh',
|
||||
'src/backend-query/detect-wifi.sh',
|
||||
'src/backend-query/disk-info.sh',
|
||||
'src/backend-query/disk-label.sh',
|
||||
'src/backend-query/disk-list.sh',
|
||||
'src/backend-query/disk-part.sh',
|
||||
'src/backend-query/enable-net.sh',
|
||||
'src/backend-query/list-components.sh',
|
||||
'src/backend-query/list-rsync-backups.sh',
|
||||
'src/backend-query/list-tzones.sh',
|
||||
'src/backend-query/query-langs.sh',
|
||||
'src/backend-query/send-logs.sh',
|
||||
'src/backend-query/setup-ssh-keys.sh',
|
||||
'src/backend-query/sys-mem.sh',
|
||||
'src/backend-query/test-live.sh',
|
||||
'src/backend-query/test-netup.sh',
|
||||
'src/backend-query/update-part-list.sh',
|
||||
'src/backend-query/xkeyboard-layouts.sh',
|
||||
'src/backend-query/xkeyboard-models.sh',
|
||||
'src/backend-query/xkeyboard-variants.sh'
|
||||
|
||||
]
|
||||
|
||||
# '{prefix}/share/man/man1'.format(prefix=sys.prefix), glob('data/*.1')),
|
||||
|
||||
data_files = [
|
||||
(f'{prefix}/share/applications', ['src/gbinstall.desktop']),
|
||||
(f'{prefix}/lib/gbinstall', lib_gbinstall),
|
||||
(f'{prefix}/lib/gbinstall/backend-query', backend_query),
|
||||
(f'{prefix}/lib/gbinstall/slide-images/ghostbsd', slide_images)
|
||||
]
|
||||
|
||||
# data_files.extend(datafilelist('{prefix}/share/locale'.format(prefix=sys.prefix), 'build/mo'))
|
||||
|
||||
# cmdclass ={
|
||||
@@ -114,14 +42,15 @@ data_files = [
|
||||
# "clean": DistUtilsExtra.command.clean_i18n.clean_i18n,
|
||||
# }
|
||||
|
||||
setup(name="gbinstall",
|
||||
version=PROGRAM_VERSION,
|
||||
description="Gbinstall is a GTK front end user interface for pc-sysinstall",
|
||||
license='BSD',
|
||||
author='Eric Turgeon',
|
||||
url='https://github/GhostBSD/gbinstall/',
|
||||
package_dir={'': '.'},
|
||||
data_files=data_files,
|
||||
# install_requires = [ 'setuptools', ],
|
||||
scripts=['gbinstall'],)
|
||||
setup(
|
||||
name="install-station",
|
||||
version=PROGRAM_VERSION,
|
||||
description="install-station is a stripdown version of gbi",
|
||||
license='BSD',
|
||||
author='Eric Turgeon',
|
||||
url='https://github/GhostBSD/install-station/',
|
||||
package_dir={'': '.'},
|
||||
install_requires=['setuptools'],
|
||||
scripts=['install-station']
|
||||
)
|
||||
# cmdclass = cmdclass,
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
dmesgLine=`dmesg | grep "acpi_acad0"`
|
||||
if test "${dmesgLine}" = ""; then
|
||||
echo "laptop: NO"
|
||||
else
|
||||
echo "laptop: YES"
|
||||
fi
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm /tmp/netCards 2>/dev/null
|
||||
touch /tmp/netCards
|
||||
|
||||
config="`ifconfig -l`"
|
||||
|
||||
for i in $config
|
||||
do
|
||||
echo "${i}" | grep -e "lo0" -e "^fwe" -e "^fwip" -e "lo1" -e "^plip" -e "^pfsync" -e "^pflog" -e "^tun" >/dev/null 2>/dev/null
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
IDENT="<`dmesg | grep ^${i} | grep -v "miibus" | grep '<' | cut -d '<' -f 2 | cut -d '>' -f 1 | head -1`>"
|
||||
echo "${i}: $IDENT"
|
||||
fi
|
||||
done
|
||||
@@ -1,52 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2009-2012, GhostBSD. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistribution's of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistribution's in binary form must reproduce the above
|
||||
# copyright notice,this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# 3. Neither then name of GhostBSD Project nor the names of its
|
||||
# contributors maybe used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# /usr/local/etc/gbi/detect-sheme.sh v 0.1 Wed May 1 20:31:52 ADT 2013 Eric Turgeon
|
||||
#
|
||||
# Detect a disk sheme and display them.
|
||||
#
|
||||
|
||||
|
||||
DISK="${1}"
|
||||
TMPDIR=${TMPDIR:-"/tmp"}
|
||||
# Display if this is GPT or MBR formatted
|
||||
gpart show ${1} | grep "GPT" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ] ; then
|
||||
#echo "${1}-format: GPT"
|
||||
TYPE="GPT"
|
||||
else
|
||||
#echo "${1}-format: MBR"
|
||||
TYPE="MBR"
|
||||
fi
|
||||
|
||||
echo ${TYPE}
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
pciconf -lv | grep -i vmware >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
echo "vmware: YES"
|
||||
exit 0
|
||||
else
|
||||
echo "vmware: NO"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
NIC="$1"
|
||||
ifconfig ${NIC} | grep -q "802.11" 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
echo 'yes'
|
||||
else
|
||||
echo 'no'
|
||||
fi
|
||||
@@ -1,72 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Query a disk for partitions and display them
|
||||
#############################
|
||||
|
||||
|
||||
if [ -z "${1}" ]
|
||||
then
|
||||
echo "Error: No disk specified!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e "/dev/${1}" ]
|
||||
then
|
||||
echo "Error: Disk /dev/${1} does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to convert bytes to megabytes
|
||||
convert_byte_to_megabyte()
|
||||
{
|
||||
if [ -z "${1}" ]
|
||||
then
|
||||
echo "Error: No bytes specified!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
expr -e ${1} / 1048576
|
||||
};
|
||||
|
||||
# Function which returns a target disks cylinders
|
||||
get_disk_cyl()
|
||||
{
|
||||
cyl=`diskinfo -v ${1} | grep "# Cylinders" | tr -s ' ' | cut -f 2`
|
||||
export VAL="${cyl}"
|
||||
};
|
||||
DISK="${1}"
|
||||
|
||||
# Function which returns a target disks heads
|
||||
get_disk_heads()
|
||||
{
|
||||
head=`diskinfo -v ${1} | grep "# Heads" | tr -s ' ' | cut -f 2`
|
||||
export VAL="${head}"
|
||||
};
|
||||
|
||||
# Function which returns a target disks sectors
|
||||
get_disk_sectors()
|
||||
{
|
||||
sec=`diskinfo -v ${1} | grep "# Sectors" | tr -s ' ' | cut -f 2`
|
||||
export VAL="${sec}"
|
||||
};
|
||||
|
||||
get_disk_cyl "${DISK}"
|
||||
CYLS="${VAL}"
|
||||
|
||||
get_disk_heads "${DISK}"
|
||||
HEADS="${VAL}"
|
||||
|
||||
get_disk_sectors "${DISK}"
|
||||
SECS="${VAL}"
|
||||
|
||||
#echo "cylinders=${CYLS}"
|
||||
#echo "heads=${HEADS}"
|
||||
#echo "sectors=${SECS}"
|
||||
|
||||
# Now get the disks size in MB
|
||||
KB="`diskinfo -v ${1} | grep 'bytes' | cut -d '#' -f 1 | tr -s '\t' ' ' | tr -d ' '`"
|
||||
MB=$(convert_byte_to_megabyte ${KB})
|
||||
#echo "size=$MB"
|
||||
echo "$MB"
|
||||
# Now get the Controller Type
|
||||
CTYPE="`dmesg | grep "^${1}:" | grep "B <" | cut -d '>' -f 2 | cut -d ' ' -f 3-10`"
|
||||
#echo "type=$CTYPE"
|
||||
@@ -1,87 +0,0 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2018 iXsystems, Inc. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# $FreeBSD: $
|
||||
|
||||
# Query mbr partitions label and display them
|
||||
##############################
|
||||
|
||||
. ${PROGDIR}/backend/functions.sh
|
||||
. ${PROGDIR}/backend/functions-disk.sh
|
||||
|
||||
|
||||
if [ -z "${1}" ]
|
||||
then
|
||||
echo "Error: No partition specified!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e "/dev/${1}" ]
|
||||
then
|
||||
echo "Error: Partition /dev/${1} does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
DISK="${1}"
|
||||
TMPDIR=${TMPDIR:-"/tmp"}
|
||||
# Display if this is GPT or MBR formatted
|
||||
gpart show ${1} | grep "GPT" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ] ; then
|
||||
#echo "${1}-format: GPT"
|
||||
TYPE="GPT"
|
||||
else
|
||||
#echo "${1}-format: MBR"
|
||||
TYPE="MBR"
|
||||
fi
|
||||
|
||||
if [ "$TYPE" = "MBR" ] ; then
|
||||
sp="s"
|
||||
else
|
||||
sp="p"
|
||||
fi
|
||||
|
||||
# Get a listing of partitions on this disk
|
||||
gpart show ${DISK} | grep -v ${DISK} | tr -s '\t' ' ' | cut -d ' ' -f 4,3,5 >${TMPDIR}/disk-${DISK}
|
||||
while read i
|
||||
do
|
||||
|
||||
if [ ! -z "${i}" ] ; then
|
||||
BLOCK="`echo ${i} | cut -d ' ' -f 1`"
|
||||
MB="`expr ${BLOCK} / 2048`MB"
|
||||
fi
|
||||
if [ ! "${MB}" = "0MB" ] ; then
|
||||
LABEL="`echo ${i} | cut -d ' ' -f 3`"
|
||||
SLICE="`echo ${i} | cut -d ' ' -f 2`"
|
||||
if [ "$SLICE" = '-' ] ; then
|
||||
echo "freespace ${MB}"
|
||||
else
|
||||
if [ ! -z "$SLICE" ] ; then
|
||||
echo "${MB} ${LABEL}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
done <${TMPDIR}/disk-${DISK}
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Create our device listing
|
||||
SYSDISK=$(sysctl -n kern.disks)
|
||||
|
||||
# Now loop through these devices, and list the disk drives
|
||||
for i in ${SYSDISK}
|
||||
do
|
||||
|
||||
# Get the current device
|
||||
DEV="${i}"
|
||||
|
||||
# Make sure we don't find any cd devices
|
||||
case "${DEV}" in
|
||||
acd[0-9]*|cd[0-9]*|scd[0-9]*) continue ;;
|
||||
esac
|
||||
|
||||
# Check the dmesg output for some more info about this device
|
||||
NEWLINE=$(dmesg | sed -n "s/^$DEV: .*<\(.*\)>.*$/ <\1>/p" | head -n 1)
|
||||
if [ -z "$NEWLINE" ]; then
|
||||
NEWLINE=" <Unknown Device>"
|
||||
fi
|
||||
|
||||
# Save the disk list
|
||||
if [ ! -z "$DLIST" ]
|
||||
then
|
||||
DLIST="\n${DLIST}"
|
||||
fi
|
||||
|
||||
DLIST="${DEV} ${NEWLINE}${DLIST}"
|
||||
|
||||
done
|
||||
|
||||
# Echo out the found line
|
||||
echo -e "$DLIST" | sort
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Query a disk for partitions and display them
|
||||
#############################
|
||||
|
||||
|
||||
DISK="${1}"
|
||||
TMPDIR=${TMPDIR:-"/tmp"}
|
||||
# Display if this is GPT or MBR formatted
|
||||
gpart show ${1} | grep "GPT" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ] ; then
|
||||
#echo "${1}-format: GPT"
|
||||
TYPE="GPT"
|
||||
else
|
||||
#echo "${1}-format: MBR"
|
||||
TYPE="MBR"
|
||||
fi
|
||||
|
||||
if [ "$TYPE" = "MBR" ] ; then
|
||||
sp="s"
|
||||
else
|
||||
sp="p"
|
||||
fi
|
||||
|
||||
# Get a listing of partitions on this disk
|
||||
gpart show ${DISK} | grep -v ${DISK} | tr -s '\t' ' ' | cut -d ' ' -f 4,3,5 >${TMPDIR}/disk-${DISK}
|
||||
while read i
|
||||
do
|
||||
|
||||
if [ ! -z "${i}" ] ; then
|
||||
BLOCK="`echo ${i} | cut -d ' ' -f 1`"
|
||||
if [ "${BLOCK}" -ge 2048 ] ; then
|
||||
MB="`expr ${BLOCK} / 2048`MB"
|
||||
else
|
||||
MB=1MB
|
||||
fi
|
||||
fi
|
||||
if [ ! "${MB}" = "0MB" ] ; then
|
||||
LABEL="`echo ${i} | cut -d ' ' -f 3`"
|
||||
SLICE="`echo ${i} | cut -d ' ' -f 2`"
|
||||
if [ "$SLICE" = '-' ] ; then
|
||||
if [ ! "${MB}" = "1MB" ] ; then
|
||||
echo "freespace ${MB} none"
|
||||
fi
|
||||
else
|
||||
if [ ! -z "$SLICE" ] ; then
|
||||
echo "${DISK}${sp}${SLICE} ${MB} ${LABEL} "
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done <${TMPDIR}/disk-${DISK}
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Script which enables networking with specified options
|
||||
###########################################################################
|
||||
|
||||
. ${PROGDIR}/backend/functions.sh
|
||||
. ${PROGDIR}/conf/pc-sysinstall.conf
|
||||
. ${BACKEND}/functions-networking.sh
|
||||
. ${BACKEND}/functions-parse.sh
|
||||
|
||||
|
||||
NIC="$1"
|
||||
IP="$2"
|
||||
NETMASK="$3"
|
||||
DNS="$4"
|
||||
GATEWAY="$5"
|
||||
MIRRORFETCH="$6"
|
||||
|
||||
if [ -z "${NIC}" ]
|
||||
then
|
||||
echo "ERROR: Usage enable-net <nic> <ip> <netmask> <dns> <gateway>"
|
||||
exit 150
|
||||
fi
|
||||
|
||||
if [ "$NIC" = "AUTO-DHCP" ]
|
||||
then
|
||||
enable_auto_dhcp
|
||||
else
|
||||
echo "Enabling NIC: $NIC"
|
||||
ifconfig ${NIC} ${IP} ${NETMASK}
|
||||
|
||||
echo "nameserver ${DNS}" >/etc/resolv.conf
|
||||
|
||||
route add default ${GATE}
|
||||
fi
|
||||
|
||||
case ${MIRRORFETCH} in
|
||||
ON|on|yes|YES) fetch -o /tmp/mirrors-list.txt ${MIRRORLIST} >/dev/null 2>/dev/null;;
|
||||
*) ;;
|
||||
esac
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Script which lists the available components for this release
|
||||
###########################################################################
|
||||
|
||||
. ${PROGDIR}/backend/functions.sh
|
||||
|
||||
echo "Available Components:"
|
||||
|
||||
cd ${COMPDIR}
|
||||
for i in `ls -d *`
|
||||
do
|
||||
if [ -e "${i}/component.cfg" -a -e "${i}/install.sh" -a -e "${i}/distfiles" ]
|
||||
then
|
||||
NAME="`grep 'name:' ${i}/component.cfg | cut -d ':' -f 2`"
|
||||
DESC="`grep 'description:' ${i}/component.cfg | cut -d ':' -f 2`"
|
||||
TYPE="`grep 'type:' ${i}/component.cfg | cut -d ':' -f 2`"
|
||||
echo " "
|
||||
echo "name: ${i}"
|
||||
echo "desc:${DESC}"
|
||||
echo "type:${TYPE}"
|
||||
if [ -e "${i}/component.png" ]
|
||||
then
|
||||
echo "icon: ${COMPDIR}/${i}/component.png"
|
||||
fi
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Script which lists the backups present on a server
|
||||
###########################################################################
|
||||
|
||||
. ${PROGDIR}/backend/functions.sh
|
||||
|
||||
SSHUSER=$1
|
||||
SSHHOST=$2
|
||||
SSHPORT=$3
|
||||
|
||||
if [ -z "${SSHHOST}" -o -z "${SSHPORT}" ]
|
||||
then
|
||||
echo "ERROR: Usage list-rsync-backups.sh <user> <host> <port>"
|
||||
exit 150
|
||||
fi
|
||||
|
||||
# Look for full-system backups, needs at minimum a kernel to be bootable
|
||||
FINDCMD="find . -type d -maxdepth 6 -name 'kernel' | grep '/boot/kernel'"
|
||||
|
||||
# Get a listing of the number of full backups saved
|
||||
OLDBACKUPS=`ssh -o 'BatchMode=yes' -p ${SSHPORT} ${SSHUSER}@${SSHHOST} "${FINDCMD}"`
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
for i in ${OLDBACKUPS}
|
||||
do
|
||||
BACKPATH="`echo ${i} | sed 's|/boot/.*||g' | sed 's|^./||g'`"
|
||||
if [ -z "${BACKLIST}" ]
|
||||
then
|
||||
BACKLIST="${BACKPATH}"
|
||||
else
|
||||
BACKLIST="${BACKLIST}:${BACKPATH}"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "${BACKLIST}" ]
|
||||
then
|
||||
echo "NONE"
|
||||
else
|
||||
echo "$BACKLIST"
|
||||
fi
|
||||
|
||||
else
|
||||
echo "FAILED"
|
||||
fi
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm ${TMPDIR}/.tzonetmp >/dev/null 2>/dev/null
|
||||
|
||||
# Backend script which lists all the available timezones for front-ends to display
|
||||
while read line
|
||||
do
|
||||
echo "$line" | grep "^#" >/dev/null 2>/dev/null
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
echo "$line" | tr -s "\t" ":" | cut -d ":" -f 3-4 >>${TMPDIR}/.tzonetmp
|
||||
fi
|
||||
done < /usr/share/zoneinfo/zone.tab
|
||||
|
||||
sort ${TMPDIR}/.tzonetmp
|
||||
rm -f ${TMPDIR}/.tzonetmp >/dev/null 2>/dev/null
|
||||
|
||||
exit 0
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
FOUND="0"
|
||||
|
||||
cat ${PROGDIR}/conf/avail-langs
|
||||
|
||||
exit 0
|
||||
@@ -1,57 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Script which creates a gzipped log and optionally mails it to the specified address
|
||||
############################################################################
|
||||
|
||||
. ${PROGDIR}/backend/functions.sh
|
||||
. ${PROGDIR}/conf/pc-sysinstall.conf
|
||||
. ${BACKEND}/functions-networking.sh
|
||||
. ${BACKEND}/functions-parse.sh
|
||||
|
||||
# Bring up all NICS under DHCP
|
||||
enable_auto_dhcp
|
||||
|
||||
MAILTO="$1"
|
||||
MAILRESULT="0"
|
||||
|
||||
# Set the location of our compressed log
|
||||
TMPLOG="/tmp/pc-sysinstall.log"
|
||||
|
||||
echo "# PC-SYSINSTALL LOG" >${TMPLOG}
|
||||
cat ${LOGOUT} >> ${TMPLOG}
|
||||
|
||||
# Check if we have a GUI generated install cfg
|
||||
if [ -e "/tmp/sys-install.cfg" ]
|
||||
then
|
||||
echo "" >>${TMPLOG}
|
||||
echo "# PC-SYSINSTALL CFG " >>${TMPLOG}
|
||||
cat /tmp/sys-install.cfg >> ${TMPLOG}
|
||||
fi
|
||||
|
||||
# Save dmesg output
|
||||
echo "" >>${TMPLOG}
|
||||
echo "# DMESG OUTPUT " >>${TMPLOG}
|
||||
dmesg >> ${TMPLOG}
|
||||
|
||||
# Get gpart info on all disks
|
||||
for i in `${PROGDIR}/pc-sysinstall disk-list | cut -d ':' -f 1`
|
||||
do
|
||||
echo "" >>${TMPLOG}
|
||||
echo "# DISK INFO $i " >>${TMPLOG}
|
||||
ls /dev/${i}* >>${TMPLOG}
|
||||
gpart show ${i} >> ${TMPLOG}
|
||||
done
|
||||
|
||||
# Show Mounted volumes
|
||||
echo "" >>${TMPLOG}
|
||||
echo "# MOUNT OUTPUT " >>${TMPLOG}
|
||||
mount >> ${TMPLOG}
|
||||
|
||||
echo "Log file saved to ${TMPLOG}"
|
||||
echo "Warning: This file will be lost once the system is rebooted."
|
||||
|
||||
echo "Do you wish to view this logfile now? (Y/N)"
|
||||
read tmp
|
||||
if [ "$tmp" = "Y" -o "$tmp" = "y" ]
|
||||
then
|
||||
more ${TMPLOG}
|
||||
fi
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Script which sets up password-less logins for ssh host
|
||||
###########################################################################
|
||||
|
||||
. ${PROGDIR}/backend/functions.sh
|
||||
|
||||
SSHUSER=$1
|
||||
SSHHOST=$2
|
||||
SSHPORT=$3
|
||||
|
||||
if [ -z "${SSHUSER}" -o -z "${SSHHOST}" -o -z "${SSHPORT}" ]
|
||||
then
|
||||
echo "ERROR: Usage setup-ssh-keys <user> <host> <port>"
|
||||
exit 150
|
||||
fi
|
||||
|
||||
cd ~
|
||||
|
||||
echo "Preparing to setup SSH key authorization..."
|
||||
echo "When prompted, enter your password for ${SSHUSER}@${SSHHOST}"
|
||||
|
||||
if [ ! -e ".ssh/id_rsa.pub" ]
|
||||
then
|
||||
mkdir .ssh >/dev/null 2>/dev/null
|
||||
ssh-keygen -q -t rsa -N '' -f .ssh/id_rsa
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
if [ ! -e ".ssh/id_rsa.pub" ]
|
||||
then
|
||||
echo "ERROR: Failed creating .ssh/id_rsa.pub"
|
||||
exit 150
|
||||
fi
|
||||
|
||||
# Get the .pub key
|
||||
PUBKEY="`cat .ssh/id_rsa.pub`"
|
||||
|
||||
ssh -p ${SSHPORT} ${SSHUSER}@${SSHHOST} "mkdir .ssh ; echo $PUBKEY >> .ssh/authorized_keys; chmod 600 .ssh/authorized_keys ; echo $PUBKEY >> .ssh/authorized_keys2; chmod 600 .ssh/authorized_keys2"
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
MEM=`sysctl hw.realmem | sed "s|hw.realmem: ||g"`
|
||||
MEM=`expr $MEM / 1024`
|
||||
MEM=`expr $MEM / 1024`
|
||||
echo $MEM
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Script which checks if we are running from install media, or real system
|
||||
#############################################################################
|
||||
|
||||
dmesg | grep "md0: Preloaded image" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
echo "INSTALL-MEDIA"
|
||||
exit 0
|
||||
else
|
||||
echo "REAL-DISK"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Script which tests "fetch" when using a network connection, and saves
|
||||
# if we are using direct connect, or need FTP passive mode
|
||||
#############################################################################
|
||||
|
||||
rm ${TMPDIR}/.testftp >/dev/null 2>/dev/null
|
||||
|
||||
ping -c 2 www.pcbsd.org >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
echo "ftp: Up"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ping -c 2 www.freebsd.org >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
echo "ftp: Up"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "ftp: Down"
|
||||
exit 1
|
||||
@@ -1,84 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Need access to a some unmount functions
|
||||
. ${PROGDIR}/backend/functions-unmount.sh
|
||||
|
||||
echo "Running: find-update-parts" >> ${LOGOUT}
|
||||
|
||||
rm ${TMPDIR}/AvailUpgrades >/dev/null 2>/dev/null
|
||||
|
||||
FSMNT="/mnt"
|
||||
|
||||
# Get the freebsd version on this partition
|
||||
get_fbsd_ver() {
|
||||
|
||||
VER="`file ${FSMNT}/bin/sh | grep 'for FreeBSD' | sed 's|for FreeBSD |;|g' | cut -d ';' -f 2 | cut -d ',' -f 1`"
|
||||
if [ "$?" = "0" ] ; then
|
||||
file ${FSMNT}/bin/sh | grep '32-bit' >/dev/null 2>/dev/null
|
||||
if [ "${?}" = "0" ] ; then
|
||||
echo "${1}: FreeBSD ${VER} (32bit)"
|
||||
else
|
||||
echo "${1}: FreeBSD ${VER} (64bit)"
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# Create our device listing
|
||||
SYSDISK="`sysctl kern.disks | cut -d ':' -f 2 | sed 's/^[ \t]*//'`"
|
||||
DEVS=""
|
||||
|
||||
# Now loop through these devices, and list the disk drives
|
||||
for i in ${SYSDISK}
|
||||
do
|
||||
|
||||
# Get the current device
|
||||
DEV="${i}"
|
||||
# Make sure we don't find any cd devices
|
||||
echo "${DEV}" | grep -e "^acd[0-9]" -e "^cd[0-9]" -e "^scd[0-9]" >/dev/null 2>/dev/null
|
||||
if [ "$?" != "0" ] ; then
|
||||
DEVS="${DEVS} `ls /dev/${i}*`"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
# Search for regular UFS / Geom Partitions to upgrade
|
||||
for i in $DEVS
|
||||
do
|
||||
if [ ! -e "${i}a.journal" -a ! -e "${i}a" -a ! -e "${i}p2" -a ! -e "${i}p2.journal" ] ; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ -e "${i}a.journal" ] ; then
|
||||
_dsk="${i}a.journal"
|
||||
elif [ -e "${i}a" ] ; then
|
||||
_dsk="${i}a"
|
||||
elif [ -e "${i}p2" ] ; then
|
||||
_dsk="${i}p2"
|
||||
elif [ -e "${i}p2.journal" ] ; then
|
||||
_dsk="${i}p2.journal"
|
||||
fi
|
||||
|
||||
mount ${_dsk} ${FSMNT} >>${LOGOUT} 2>>${LOGOUT}
|
||||
if [ "${?}" = "0" -a -e "${FSMNT}/bin/sh" ] ; then
|
||||
get_fbsd_ver "`echo ${_dsk} | sed 's|/dev/||g'`"
|
||||
umount -f ${FSMNT} >/dev/null 2>/dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
# Now search for any ZFS root partitions
|
||||
zpool import -o altroot=${FSMNT} -a
|
||||
|
||||
# Unmount any auto-mounted stuff
|
||||
umount_all_dir "${FSMNT}"
|
||||
|
||||
# Get pools
|
||||
_zps="`zpool list | grep -v 'NAME' | cut -d ' ' -f 1`"
|
||||
for _zpools in ${_zps}
|
||||
do
|
||||
mount -t zfs ${_zpools} ${FSMNT} >>${LOGOUT} 2>>${LOGOUT}
|
||||
if [ "${?}" = "0" -a -e "${FSMNT}/bin/sh" ] ; then
|
||||
get_fbsd_ver "${_zpools}"
|
||||
umount -f ${FSMNT} >/dev/null 2>/dev/null
|
||||
fi
|
||||
done
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
FOUND="0"
|
||||
|
||||
# Lets parse the xorg.list file, and see what layouts are supported
|
||||
while read line
|
||||
do
|
||||
|
||||
if [ "$FOUND" = "1" -a ! -z "$line" ]
|
||||
then
|
||||
echo $line | grep '! ' >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
echo "$line"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${FOUND}" = "0" ]
|
||||
then
|
||||
echo $line | grep '! layout' >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
FOUND="1"
|
||||
fi
|
||||
fi
|
||||
|
||||
done < /usr/local/share/X11/xkb/rules/xorg.lst
|
||||
|
||||
exit 0
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
FOUND="0"
|
||||
|
||||
# Lets parse the xorg.list file, and see what models are supported
|
||||
while read line
|
||||
do
|
||||
|
||||
if [ "$FOUND" = "1" -a ! -z "$line" ]
|
||||
then
|
||||
echo $line | grep '! ' >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
model="`echo $line | sed 's|(|[|g'`"
|
||||
model="`echo $model | sed 's|)|]|g'`"
|
||||
echo "$model"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${FOUND}" = "0" ]
|
||||
then
|
||||
echo $line | grep '! model' >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
FOUND="1"
|
||||
fi
|
||||
fi
|
||||
|
||||
done < /usr/local/share/X11/xkb/rules/xorg.lst
|
||||
|
||||
exit 0
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
FOUND="0"
|
||||
|
||||
# Lets parse the xorg.list file, and see what varients are supported
|
||||
while read line
|
||||
do
|
||||
|
||||
if [ "$FOUND" = "1" -a ! -z "$line" ]
|
||||
then
|
||||
echo $line | grep '! ' >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
echo "$line"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${FOUND}" = "0" ]
|
||||
then
|
||||
echo $line | grep '! variant' >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
FOUND="1"
|
||||
fi
|
||||
fi
|
||||
|
||||
done < /usr/local/share/X11/xkb/rules/xorg.lst
|
||||
|
||||
exit 0
|
||||
@@ -1,103 +0,0 @@
|
||||
#!/usr/local/bin/python3.6
|
||||
#
|
||||
# Copyright (c) 2019 GhostBSD
|
||||
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
import os
|
||||
import os.path
|
||||
from db_partition import bios_or_uefi
|
||||
|
||||
|
||||
# Folder use pr the installer.
|
||||
tmp = "/tmp/.gbinstall/"
|
||||
installer = "/usr/local/lib/gbi/"
|
||||
query = "sh /usr/local/etc/lib/backend-query/"
|
||||
if not os.path.exists(tmp):
|
||||
os.makedirs(tmp)
|
||||
|
||||
logo = "/usr/local/lib/gbi/logo.png"
|
||||
boot_file = '%sboot' % tmp
|
||||
disk_schem = '%sscheme' % tmp
|
||||
zfs_config = '%szfs_config' % tmp
|
||||
ufs_config = tmp + 'ufs_config'
|
||||
|
||||
|
||||
class bootManager():
|
||||
|
||||
def get_model(self):
|
||||
return self.box1
|
||||
|
||||
def boot_manager(self, radiobutton, val):
|
||||
self.boot = val
|
||||
boot = open(boot_file, 'w')
|
||||
boot.writelines(self.boot)
|
||||
boot.close()
|
||||
|
||||
def __init__(self):
|
||||
self.box1 = Gtk.VBox(False, 0)
|
||||
self.box1.show()
|
||||
box2 = Gtk.VBox(False, 10)
|
||||
# box2.set_border_width(10)
|
||||
self.box1.pack_start(box2, False, False, 0)
|
||||
box2.show()
|
||||
if bios_or_uefi() == "UEFI":
|
||||
loader = "UEFI"
|
||||
else:
|
||||
loader = "BIOS"
|
||||
if os.path.exists(zfs_config):
|
||||
# Disk Setup
|
||||
read = open(zfs_config, 'r')
|
||||
schem = read.read()
|
||||
# os.remove(zfs_config)
|
||||
elif os.path.exists(ufs_config):
|
||||
# Disk Setup
|
||||
read = open(ufs_config, 'r')
|
||||
schem = read.readlines()
|
||||
else:
|
||||
# Sheme sheme
|
||||
read = open(disk_schem, 'r')
|
||||
schem = read.read()
|
||||
if 'GPT' in schem:
|
||||
scheme = 'GPT'
|
||||
else:
|
||||
scheme = 'MBR'
|
||||
label = Gtk.Label("Boot Option", name="Header")
|
||||
label.set_property("height-request", 40)
|
||||
box2.pack_start(label, False, False, 0)
|
||||
hbox = Gtk.HBox()
|
||||
hbox.show()
|
||||
box2.pack_start(hbox, True, True, 0)
|
||||
bbox1 = Gtk.VBox()
|
||||
bbox1.show()
|
||||
self.refind = Gtk.RadioButton.new_with_label_from_widget(None, "Setup rEFInd boot manager")
|
||||
bbox1.pack_start(self.refind, False, True, 10)
|
||||
self.refind.connect("toggled", self.boot_manager, "refind")
|
||||
self.refind.show()
|
||||
if scheme == 'GPT' and loader == "UEFI":
|
||||
self.refind.set_sensitive(True)
|
||||
else:
|
||||
self.refind.set_sensitive(False)
|
||||
self.bsd = Gtk.RadioButton.new_with_label_from_widget(self.refind, "Setup FreeBSD boot manager")
|
||||
bbox1.pack_start(self.bsd, False, True, 10)
|
||||
self.bsd.connect("toggled", self.boot_manager, "bsd")
|
||||
self.bsd.show()
|
||||
if scheme == 'MBR':
|
||||
self.bsd.set_sensitive(True)
|
||||
else:
|
||||
self.bsd.set_sensitive(False)
|
||||
self.none = Gtk.RadioButton.new_with_label_from_widget(self.bsd, f"FreeBSD {loader} loader only")
|
||||
bbox1.pack_start(self.none, False, True, 10)
|
||||
self.none.connect("toggled", self.boot_manager, "none")
|
||||
self.none.show()
|
||||
hbox.pack_start(bbox1, False, False, 50)
|
||||
self.none.set_active(True)
|
||||
self.boot = "none"
|
||||
boot = open(boot_file, 'w')
|
||||
boot.writelines(self.boot)
|
||||
boot.close()
|
||||
self.box3 = Gtk.VBox(False, 0)
|
||||
self.box3.set_border_width(0)
|
||||
self.box1.pack_start(self.box3, True, True, 0)
|
||||
return
|
||||
@@ -1,120 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
#####################################################################
|
||||
# Copyright (c) 2009-2012, GhostBSD. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistribution's of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistribution's in binary form must reproduce the above
|
||||
# copyright notice,this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# 3. Neither then name of GhostBSD Project nor the names of its
|
||||
# contributors maybe used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#####################################################################
|
||||
# language.py show the language for the installer.
|
||||
|
||||
|
||||
from gi.repository import Gtk, Gdk
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
from create_cfg import gbsd_cfg
|
||||
|
||||
# Folder use for the installer.
|
||||
tmp = "/tmp/.gbinstall/"
|
||||
pcinstallcfg = f'{tmp}pcinstall.cfg'
|
||||
installer = "/usr/local/lib/gbinstall/"
|
||||
logo = f"{installer}logo.png"
|
||||
if not os.path.exists(tmp):
|
||||
os.makedirs(tmp)
|
||||
|
||||
sys.path.append(installer)
|
||||
cssProvider = Gtk.CssProvider()
|
||||
# if os.path.exists(rcconfgbsd):
|
||||
# print(True)
|
||||
cssProvider.load_from_path('/usr/local/lib/gbinstall/ghostbsd-style.css')
|
||||
# elif os.path.exists(rcconfdbsd):
|
||||
# cssProvider.load_from_path('/usr/local/lib/gbi/desktopbsd-style.css')
|
||||
screen = Gdk.Screen.get_default()
|
||||
styleContext = Gtk.StyleContext()
|
||||
styleContext.add_provider_for_screen(screen, cssProvider,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
|
||||
|
||||
|
||||
class Summary:
|
||||
|
||||
def __init__(self, button3):
|
||||
gbsd_cfg()
|
||||
cfg_file = open(pcinstallcfg, 'r')
|
||||
cfg_text = cfg_file.read()
|
||||
cfg_file.close()
|
||||
button3.set_sensitive(True)
|
||||
# Add a Default vertical box
|
||||
self.vbox1 = Gtk.VBox(False, 0)
|
||||
self.vbox1.show()
|
||||
# Add a second vertical box
|
||||
label = Gtk.Label("Installation Summary", name="Header")
|
||||
label.set_property("height-request", 40)
|
||||
self.vbox1.pack_start(label, False, False, 0)
|
||||
grid = Gtk.Grid()
|
||||
self.vbox1.pack_start(grid, True, True, 0)
|
||||
grid.set_row_spacing(10)
|
||||
grid.set_column_spacing(3)
|
||||
grid.set_column_homogeneous(True)
|
||||
grid.set_row_homogeneous(True)
|
||||
grid.set_margin_left(10)
|
||||
grid.set_margin_right(10)
|
||||
grid.set_margin_top(10)
|
||||
grid.set_margin_bottom(10)
|
||||
# Adding a Scrolling Window
|
||||
scrolledwindow = Gtk.ScrolledWindow()
|
||||
scrolledwindow.set_hexpand(True)
|
||||
scrolledwindow.set_vexpand(True)
|
||||
scrolledwindow.show()
|
||||
grid.attach(scrolledwindow, 0, 1, 3, 1)
|
||||
|
||||
self.textview = Gtk.TextView()
|
||||
self.textbuffer = self.textview.get_buffer()
|
||||
self.textbuffer.set_text(cfg_text)
|
||||
scrolledwindow.add(self.textview)
|
||||
|
||||
# self.wellcometext = Gtk.Label(welltext)
|
||||
# self.wellcometext.set_use_markup(True)
|
||||
# table = Gtk.Table()
|
||||
# table.attach(self.wellcome, 0, 1, 1, 2)
|
||||
# wall = Gtk.Label()
|
||||
# table.attach(wall, 0, 1, 2, 3)
|
||||
# table.attach(self.wellcometext, 0, 1, 3, 4)
|
||||
# vhbox.pack_start(table, False, False, 5)
|
||||
# image = Gtk.Image()
|
||||
# image.set_from_file(logo)
|
||||
# image.show()
|
||||
# grid.attach(self.wellcome, 1, 1, 3, 1)
|
||||
# vhbox.pack_start(image, True, True, 5)
|
||||
# grid.attach(vhbox, 2, 2, 2, 9)
|
||||
grid.show()
|
||||
return
|
||||
|
||||
def get_model(self):
|
||||
return self.vbox1
|
||||
@@ -1,130 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2013 GhostBSD
|
||||
#
|
||||
# See COPYING for licence terms.
|
||||
#
|
||||
# create_cfg.py v 1.4 Friday, January 17 2014 Eric Turgeon
|
||||
#
|
||||
|
||||
import os
|
||||
import pickle
|
||||
|
||||
# Directory use from the installer.
|
||||
tmp = "/tmp/.gbinstall/"
|
||||
installer = "/usr/local/lib/gbinstall/"
|
||||
# Installer data file.
|
||||
disk = f'{tmp}disk'
|
||||
layout = f'{tmp}layout'
|
||||
model = f'{tmp}model'
|
||||
pcinstallcfg = f'{tmp}pcinstall.cfg'
|
||||
user_passwd = f'{tmp}user'
|
||||
language = f'{tmp}language'
|
||||
dslice = f'{tmp}slice'
|
||||
left = f'{tmp}left'
|
||||
partlabel = f'{tmp}partlabel'
|
||||
timezone = f'{tmp}timezone'
|
||||
KBFile = f'{tmp}keyboard'
|
||||
boot_file = f'{tmp}boot'
|
||||
disk_schem = f'{tmp}scheme'
|
||||
zfs_config = f'{tmp}zfs_config'
|
||||
ufs_config = f'{tmp}ufs_config'
|
||||
|
||||
|
||||
class gbsd_cfg():
|
||||
def __init__(self):
|
||||
f = open(pcinstallcfg, 'w')
|
||||
# Installation Mode
|
||||
f.writelines('# Installation Mode\n')
|
||||
f.writelines('installMode=fresh\n')
|
||||
f.writelines('installInteractive=no\n')
|
||||
f.writelines('installType=GhostBSD\n')
|
||||
f.writelines('installMedium=livecd\n')
|
||||
f.writelines('packageType=livecd\n')
|
||||
if os.path.exists(zfs_config):
|
||||
# Disk Setup
|
||||
r = open(zfs_config, 'r')
|
||||
zfsconf = r.readlines()
|
||||
for line in zfsconf:
|
||||
if 'partscheme' in line:
|
||||
f.writelines(line)
|
||||
read = open(boot_file, 'r')
|
||||
boot = read.readlines()[0].strip()
|
||||
if boot == 'refind':
|
||||
f.writelines('bootManager=none\n')
|
||||
f.writelines('efiLoader=%s\n' % boot)
|
||||
else:
|
||||
f.writelines('bootManager=%s\n' % boot)
|
||||
f.writelines('efiLoader=none\n')
|
||||
os.remove(boot_file)
|
||||
else:
|
||||
f.writelines(line)
|
||||
# os.remove(zfs_config)
|
||||
elif os.path.exists(ufs_config):
|
||||
# Disk Setup
|
||||
r = open(ufs_config, 'r')
|
||||
ufsconf = r.readlines()
|
||||
for line in ufsconf:
|
||||
if 'partscheme' in line:
|
||||
f.writelines(line)
|
||||
if boot == 'refind':
|
||||
f.writelines('bootManager=none\n')
|
||||
f.writelines('efiLoader=%s\n' % boot)
|
||||
else:
|
||||
f.writelines('bootManager=%s\n' % boot)
|
||||
f.writelines('efiLoader=none\n')
|
||||
os.remove(boot_file)
|
||||
else:
|
||||
f.writelines(line)
|
||||
else:
|
||||
# Disk Setup
|
||||
r = open(disk, 'r')
|
||||
drive = r.readlines()
|
||||
d_output = drive[0].strip()
|
||||
f.writelines('\n# Disk Setup\n')
|
||||
f.writelines(f'disk0={d_output}\n')
|
||||
os.remove(disk)
|
||||
# Partition Slice.
|
||||
p = open(dslice, 'r')
|
||||
line = p.readlines()
|
||||
part = line[0].rstrip()
|
||||
f.writelines(f'partition={part}\n')
|
||||
os.remove(dslice)
|
||||
# Boot Menu
|
||||
read = open(boot_file, 'r')
|
||||
line = read.readlines()
|
||||
boot = line[0].strip()
|
||||
if boot == 'refind':
|
||||
f.writelines('bootManager=none\n')
|
||||
f.writelines('efiLoader=%s\n' % boot)
|
||||
else:
|
||||
f.writelines('bootManager=%s\n' % boot)
|
||||
f.writelines('efiLoader=none\n')
|
||||
# os.remove(boot_file)
|
||||
# Sheme sheme
|
||||
read = open(disk_schem, 'r')
|
||||
shem = read.readlines()[0]
|
||||
f.writelines(shem + '\n')
|
||||
f.writelines('commitDiskPart\n')
|
||||
# os.remove(disk_schem)
|
||||
# Partition Setup
|
||||
f.writelines('\n# Partition Setup\n')
|
||||
part = open(partlabel, 'r')
|
||||
# If slice and auto file exist add first partition line.
|
||||
# But Swap need to be 0 it will take the rest of the freespace.
|
||||
for line in part:
|
||||
if 'BOOT' in line or 'BIOS' in line or 'UEFI' in line:
|
||||
pass
|
||||
else:
|
||||
f.writelines(f'disk0-part={line.strip()}\n')
|
||||
f.writelines('commitDiskLabel\n')
|
||||
os.remove(partlabel)
|
||||
f.writelines('runExtCommand=cat /etc/rc.conf | grep kld_list >> $FSMNT/etc/rc.conf\n')
|
||||
if os.path.exists("/etc/X11/xorg.conf"):
|
||||
f.writelines('runExtCommand=cp /etc/X11/xorg.conf $FSMNT/etc/X11/xorg.conf\n')
|
||||
f.writelines('runScript=/root/iso_to_hd.sh\n')
|
||||
f.writelines('runCommand=rm -f /root/iso_to_hd.sh\n')
|
||||
if os.path.exists(zfs_config):
|
||||
zfsark = """echo 'vfs.zfs.arc_max="512M"' >> /boot/loader.conf"""
|
||||
f.writelines(f'runCommand={zfsark}')
|
||||
f.close()
|
||||
@@ -1,56 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2011 GhostBSD
|
||||
#
|
||||
# See COPYING for licence terms.
|
||||
|
||||
import gtk
|
||||
from subprocess import Popen
|
||||
|
||||
lyrics = """Installation is complete. You need to restart the
|
||||
computer in order to use the new installation.
|
||||
You can continue to use this live media, although
|
||||
any changes you make or documents you save will
|
||||
not be preserved on reboot."""
|
||||
|
||||
|
||||
class PyApp(gtk.Window):
|
||||
def on_reboot(self, widget):
|
||||
Popen('shutdown -r now', shell=True)
|
||||
gtk.main_quit()
|
||||
|
||||
def on_close(self, widget):
|
||||
gtk.main_quit()
|
||||
|
||||
def __init__(self):
|
||||
window = gtk.Window()
|
||||
window.set_position(gtk.WIN_POS_CENTER)
|
||||
window.set_border_width(8)
|
||||
window.connect("destroy", gtk.main_quit)
|
||||
window.set_title("Installation Completed")
|
||||
window.set_icon_from_file("/usr/local/lib/gbi/logo.png")
|
||||
box1 = gtk.VBox(False, 0)
|
||||
window.add(box1)
|
||||
box1.show()
|
||||
box2 = gtk.VBox(False, 10)
|
||||
box2.set_border_width(10)
|
||||
box1.pack_start(box2, True, True, 0)
|
||||
box2.show()
|
||||
label = gtk.Label(lyrics)
|
||||
box2.pack_start(label)
|
||||
box2 = gtk.HBox(False, 10)
|
||||
box2.set_border_width(5)
|
||||
box1.pack_start(box2, False, True, 0)
|
||||
box2.show()
|
||||
table = gtk.Table(1, 2, True)
|
||||
restart = gtk.Button("Restart")
|
||||
restart.connect("clicked", self.on_reboot)
|
||||
Continue = gtk.Button("Continue")
|
||||
Continue.connect("clicked", self.on_close)
|
||||
table.attach(Continue, 0, 1, 0, 1)
|
||||
table.attach(restart, 1, 2, 0, 1)
|
||||
box2.pack_start(table)
|
||||
window.show_all()
|
||||
|
||||
|
||||
PyApp()
|
||||
gtk.main()
|
||||
@@ -1,61 +0,0 @@
|
||||
#!/usr/local/bin/python
|
||||
# Copyright (c) 2011 GhostBSD
|
||||
#
|
||||
# See COPYING for licence terms.
|
||||
|
||||
import gtk
|
||||
from subprocess import Popen
|
||||
|
||||
lyrics = """
|
||||
Please report to
|
||||
, and be sure
|
||||
to provide /tmp/.pc-sysinstall/pc-sysinstall.log.
|
||||
"""
|
||||
|
||||
|
||||
class PyApp:
|
||||
def on_reboot(self, widget):
|
||||
Popen('sudo reboot', shell=True)
|
||||
gtk.main_quit()
|
||||
|
||||
def on_close(self, widget):
|
||||
gtk.main_quit()
|
||||
|
||||
def __init__(self):
|
||||
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
||||
window.set_position(gtk.WIN_POS_CENTER)
|
||||
window.set_border_width(8)
|
||||
window.connect("destroy", gtk.main_quit)
|
||||
window.set_title("Installation Error")
|
||||
# window.set_icon_from_file("/usr/local/lib/gbi/logo.png")
|
||||
box1 = gtk.VBox(False, 0)
|
||||
window.add(box1)
|
||||
box1.show()
|
||||
box2 = gtk.VBox(False, 10)
|
||||
box2.set_border_width(10)
|
||||
box1.pack_start(box2, True, True, 0)
|
||||
box2.show()
|
||||
title = gtk.Label()
|
||||
title.set_use_markup(True)
|
||||
title.set_markup('<b><span size="larger">Installation has failed!</span></b>')
|
||||
label = gtk.Label(lyrics)
|
||||
label.set_use_markup(True)
|
||||
|
||||
label.set_markup("Please report the issue to <a href='http://issues.ghostbsd.org/my_view_page.php'>GhostBSD issue system</a>,\nand be sure to provide /tmp/.pc-sysinstall/pc-sysinstall.log.")
|
||||
box2.pack_start(title)
|
||||
box2.pack_start(label)
|
||||
box2 = gtk.HBox(False, 10)
|
||||
box2.set_border_width(5)
|
||||
box1.pack_start(box2, False, True, 0)
|
||||
box2.show()
|
||||
table = gtk.Table(1, 2, True)
|
||||
ok = gtk.Button("Ok")
|
||||
ok.connect("clicked", self.on_close)
|
||||
table.attach(ok, 0, 2, 0, 1)
|
||||
|
||||
box2.pack_start(table)
|
||||
window.show_all()
|
||||
|
||||
|
||||
PyApp()
|
||||
gtk.main()
|
||||
@@ -1,252 +0,0 @@
|
||||
#!/usr/local/bin/python
|
||||
"""
|
||||
Copyright (c) 2010-2013, GhostBSD. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistribution's of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistribution's in binary form must reproduce the above
|
||||
copyright notice,this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
3. Neither then name of GhostBSD Project nor the names of its
|
||||
contributors maybe used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
installer = "/usr/local/lib/gbinstall/"
|
||||
sys.path.append(installer)
|
||||
from language import Language
|
||||
from installType import Types
|
||||
from use_ufs import use_ufs
|
||||
from partition import Partitions
|
||||
from confirm_installation import Summary
|
||||
from use_zfs import ZFS
|
||||
from db_partition import partition_repos
|
||||
from boot_manager import bootManager
|
||||
from install import installProgress, installSlide
|
||||
logo = "/usr/local/lib/gbinstall/logo.png"
|
||||
tmp = "/tmp/.gbinstall/"
|
||||
if not os.path.exists(tmp):
|
||||
os.makedirs(tmp)
|
||||
disk = '%sdisk' % tmp
|
||||
dslice = '%sslice' % tmp
|
||||
disk_schem = '%sscheme' % tmp
|
||||
zfs_config = '%szfs_config' % tmp
|
||||
ufs_config = '%sufs_config' % tmp
|
||||
partitiondb = "%spartitiondb/" % tmp
|
||||
|
||||
|
||||
class MainWindow():
|
||||
"""Main window class."""
|
||||
|
||||
def delete(self, widget, event=None):
|
||||
"""Close the main window."""
|
||||
if os.path.exists('/tmp/.gbi'):
|
||||
shutil.rmtree('/tmp/.gbi')
|
||||
Gtk.main_quit()
|
||||
return False
|
||||
|
||||
def next_page(self, widget, notebook):
|
||||
"""Go to the next window."""
|
||||
page = self.notebook.get_current_page()
|
||||
if page == 0:
|
||||
if self.types.get_type() == "ufs":
|
||||
partition_repos()
|
||||
udbox = Gtk.VBox(False, 0)
|
||||
udbox.show()
|
||||
self.partition = use_ufs(self.button3)
|
||||
get_ud = self.partition.get_model()
|
||||
udbox.pack_start(get_ud, True, True, 0)
|
||||
label = Gtk.Label("UFS Disk Configuration")
|
||||
self.notebook.insert_page(udbox, label, 1)
|
||||
self.window.show_all()
|
||||
self.notebook.next_page()
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.types.get_type() == "custom":
|
||||
partition_repos()
|
||||
Pbox = Gtk.VBox(False, 0)
|
||||
Pbox.show()
|
||||
self.partition = Partitions(self.button3)
|
||||
get_part = self.partition.get_model()
|
||||
Pbox.pack_start(get_part, True, True, 0)
|
||||
label = Gtk.Label("UFS Custom Configuration")
|
||||
self.notebook.insert_page(Pbox, label, 1)
|
||||
self.window.show_all()
|
||||
self.notebook.next_page()
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.types.get_type() == "zfs":
|
||||
Zbox = Gtk.VBox(False, 0)
|
||||
Zbox.show()
|
||||
self.partition = ZFS(self.button3)
|
||||
get_ZFS = self.partition.get_model()
|
||||
Zbox.pack_start(get_ZFS, True, True, 0)
|
||||
label = Gtk.Label("ZFS Configuration")
|
||||
self.notebook.insert_page(Zbox, label, 1)
|
||||
self.window.show_all()
|
||||
self.notebook.next_page()
|
||||
self.button3.set_sensitive(False)
|
||||
elif page == 1:
|
||||
self.partition.save_selection()
|
||||
Mbox = Gtk.VBox(False, 0)
|
||||
Mbox.show()
|
||||
self.bootmanager = bootManager()
|
||||
get_boot = self.bootmanager.get_model()
|
||||
Mbox.pack_start(get_boot, True, True, 0)
|
||||
label = Gtk.Label("Boot Option")
|
||||
self.notebook.insert_page(Mbox, label, 2)
|
||||
self.window.show_all()
|
||||
self.notebook.next_page()
|
||||
self.button3.set_sensitive(True)
|
||||
elif page == 2:
|
||||
Rbox = Gtk.VBox(False, 0)
|
||||
Rbox.show()
|
||||
self.summary = Summary(self.button3)
|
||||
get_summary = self.summary.get_model()
|
||||
Rbox.pack_start(get_summary, True, True, 0)
|
||||
label = Gtk.Label("Root Password")
|
||||
self.button3.set_label("Install")
|
||||
self.notebook.insert_page(Rbox, label, 3)
|
||||
self.window.show_all()
|
||||
self.notebook.next_page()
|
||||
elif page == 3:
|
||||
# self.adduser.save_selection()
|
||||
Ibox = Gtk.VBox(False, 0)
|
||||
Ibox.show()
|
||||
install = installSlide()
|
||||
get_install = install.get_model()
|
||||
Ibox.pack_start(get_install, True, True, 0)
|
||||
label = Gtk.Label("Installation")
|
||||
self.notebook.insert_page(Ibox, label, 4)
|
||||
self.notebook.next_page()
|
||||
instpro = installProgress()
|
||||
progressBar = instpro.getProgressBar()
|
||||
box1 = Gtk.VBox(False, 0)
|
||||
box1.show()
|
||||
label = Gtk.Label("Progress Bar")
|
||||
box1.pack_end(progressBar, False, False, 0)
|
||||
self.nbButton.insert_page(box1, label, 1)
|
||||
self.nbButton.next_page()
|
||||
self.window.show_all()
|
||||
|
||||
def back_page(self, widget):
|
||||
"""Go back to the previous window."""
|
||||
current_page = self.notebook.get_current_page()
|
||||
if current_page == 1:
|
||||
self.button1.set_sensitive(False)
|
||||
elif current_page == 4:
|
||||
self.button3.set_label("Next")
|
||||
self.notebook.prev_page()
|
||||
new_page = self.notebook.get_current_page()
|
||||
if current_page == 2 and new_page == 1:
|
||||
if os.path.exists(partitiondb):
|
||||
shutil.rmtree(partitiondb)
|
||||
if os.path.exists(tmp + 'create'):
|
||||
os.remove(tmp + 'create')
|
||||
if os.path.exists(tmp + 'delete'):
|
||||
os.remove(tmp + 'delete')
|
||||
if os.path.exists(tmp + 'destroy'):
|
||||
os.remove(tmp + 'destroy')
|
||||
if os.path.exists(tmp + 'partlabel'):
|
||||
os.remove(tmp + 'partlabel')
|
||||
if os.path.exists(zfs_config):
|
||||
os.remove(zfs_config)
|
||||
if os.path.exists(ufs_config):
|
||||
os.remove(ufs_config)
|
||||
if os.path.exists(disk):
|
||||
os.remove(disk)
|
||||
if os.path.exists(dslice):
|
||||
os.remove(dslice)
|
||||
if os.path.exists(disk_schem):
|
||||
os.remove(disk_schem)
|
||||
self.button3.set_sensitive(True)
|
||||
|
||||
def __init__(self):
|
||||
"""Were the Main window start."""
|
||||
self.window = Gtk.Window()
|
||||
self.window.connect("delete_event", self.delete)
|
||||
self.window.set_border_width(0)
|
||||
self.window.set_default_size(800, 500)
|
||||
self.window.set_size_request(800, 500)
|
||||
self.window.set_title("GhostBSD Installer")
|
||||
self.window.set_border_width(0)
|
||||
self.window.set_icon_from_file(logo)
|
||||
mainHBox = Gtk.HBox(False, 0)
|
||||
mainHBox.show()
|
||||
mainVbox = Gtk.VBox(False, 0)
|
||||
mainVbox.show()
|
||||
self.window.add(mainHBox)
|
||||
mainHBox.pack_start(mainVbox, True, True, 0)
|
||||
# Create a new self.notebook
|
||||
self.notebook = Gtk.Notebook()
|
||||
mainVbox.pack_start(self.notebook, True, True, 0)
|
||||
self.notebook.show()
|
||||
self.notebook.set_show_tabs(False)
|
||||
self.notebook.set_show_border(False)
|
||||
vbox = Gtk.VBox(False, 0)
|
||||
vbox.show()
|
||||
self.types = Types()
|
||||
get_types = self.types.get_model()
|
||||
# self.lang = Installs()
|
||||
# get_lang = self.lang.get_model()
|
||||
vbox.pack_start(get_types, True, True, 0)
|
||||
label = Gtk.Label("Types")
|
||||
self.notebook.insert_page(vbox, label, 0)
|
||||
|
||||
# Set what page to start at Language
|
||||
self.notebook.set_current_page(0)
|
||||
|
||||
# Create buttons
|
||||
self.table = Gtk.Table(1, 6, True)
|
||||
|
||||
self.button1 = Gtk.Button(label='Back')
|
||||
self.button1.connect("clicked", self.back_page)
|
||||
self.table.attach(self.button1, 3, 4, 0, 1)
|
||||
self.button1.show()
|
||||
self.button1.set_sensitive(False)
|
||||
|
||||
self.button2 = Gtk.Button(label='Cancel')
|
||||
self.button2.connect("clicked", self.delete)
|
||||
self.table.attach(self.button2, 4, 5, 0, 1)
|
||||
self.button2.show()
|
||||
|
||||
self.button3 = Gtk.Button(label='Next')
|
||||
self.button3.connect("clicked", self.next_page, self.notebook)
|
||||
self.table.attach(self.button3, 5, 6, 0, 1)
|
||||
self.button3.show()
|
||||
|
||||
self.table.set_col_spacings(5)
|
||||
self.table.show()
|
||||
# Create a new notebook
|
||||
self.nbButton = Gtk.Notebook()
|
||||
mainVbox.pack_end(self.nbButton, False, False, 5)
|
||||
self.nbButton.show()
|
||||
self.nbButton.set_show_tabs(False)
|
||||
self.nbButton.set_show_border(False)
|
||||
label = Gtk.Label("Button")
|
||||
self.nbButton.insert_page(self.table, label, 0)
|
||||
self.window.show_all()
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env xdg-open
|
||||
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Icon[C]=/usr/local/lib/gbinstall/install.png
|
||||
Name[C]=GhostBSD Installer
|
||||
Categories=GNOME;GTK;System;
|
||||
NoDisplay=true
|
||||
Exec=sudo gbinstall
|
||||
Comment[C]=GhostBSD Installer
|
||||
Name=GhostBSD Installer
|
||||
Comment=GhostBSD Installer
|
||||
Icon=/usr/local/lib/gbi/install.png
|
||||
@@ -1,65 +0,0 @@
|
||||
#welcome {
|
||||
background-image: url("/usr/local/lib/gbi/slide-images/ghostbsd/welcome.png");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
#software {
|
||||
background-image: url("/usr/local/lib/gbi/slide-images/ghostbsd/software.png");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
#web {
|
||||
background-image: url("/usr/local/lib/gbi/slide-images/ghostbsd/browser.png");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
#email {
|
||||
background-image: url("/usr/local/lib/gbi/slide-images/ghostbsd/email.png");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
#communicate {
|
||||
background-image: url("/usr/local/lib/gbi/slide-images/ghostbsd/social.png");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
#office {
|
||||
background-image: url("/usr/local/lib/gbi/slide-images/ghostbsd/office.png");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
#mutimedia {
|
||||
background-image: url("/usr/local/lib/gbi/slide-images/ghostbsd/music.png");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
#photo {
|
||||
background-image: url("/usr/local/lib/gbi/slide-images/ghostbsd/photo.png");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
#customize {
|
||||
background-image: url("/usr/local/lib/gbi/slide-images/ghostbsd/customize.png");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
#help {
|
||||
background-image: url("/usr/local/lib/gbi/slide-images/ghostbsd/help.png");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
#slideText {
|
||||
color: #F9F9F9;
|
||||
font-weight:bold;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#TransBox {
|
||||
background-color: rgba(0, 0, 0, 0.6)
|
||||
}
|
||||
|
||||
#Header {
|
||||
color: #F9F9F9;
|
||||
background-color: #3C3B37;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 36 KiB |
@@ -1,102 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 595.3 841.9" style="enable-background:new 0 0 595.3 841.9;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#333333;}
|
||||
.st1{fill:url(#SVGID_1_);}
|
||||
.st2{fill:#0079A2;}
|
||||
.st3{fill:url(#path442-8_1_);}
|
||||
.st4{display:none;}
|
||||
.st5{display:inline;fill:#111111;}
|
||||
.st6{fill:#111111;}
|
||||
.st7{fill:url(#SVGID_2_);}
|
||||
.st8{fill:url(#SVGID_3_);}
|
||||
</style>
|
||||
<g id="svg4175" inkscape:version="0.92.3 (2405546, 2018-03-11)" sodipodi:docname="glogo-and-circle.svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg">
|
||||
|
||||
<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="400" inkscape:cy="560" inkscape:document-units="mm" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="1012" inkscape:window-maximized="0" inkscape:window-width="1278" inkscape:window-x="0" inkscape:window-y="0" inkscape:zoom="0.35" pagecolor="#ffffff" showgrid="false">
|
||||
</sodipodi:namedview>
|
||||
<g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1">
|
||||
<g id="g3755-8" transform="matrix(1.2010092,0,0,1.2010092,356.63009,-536.8076)">
|
||||
<g id="path4795-4-4-0-8-5-1-5-2-5" inkscape:connector-curvature="0">
|
||||
<path class="st0" d="M-48.9,1139c-63.8,0-123.9-24.9-169-70c-45.1-45.1-70-105.2-70-169s24.9-123.9,70-169
|
||||
c45.1-45.1,105.2-70,169-70s123.9,24.9,169,70s70,105.2,70,169s-24.9,123.9-70,169C75,1114.1,15,1139-48.9,1139z"/>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-48.8646" y1="654.3084" x2="-48.8646" y2="1244.4216">
|
||||
<stop offset="0" style="stop-color:#C7C7C7"/>
|
||||
<stop offset="0.9646" style="stop-color:#5E5E5E"/>
|
||||
</linearGradient>
|
||||
<path class="st1" d="M-48.9,667.6c128.3,0,232.4,104,232.4,232.4s-104,232.4-232.4,232.4s-232.4-104-232.4-232.4
|
||||
S-177.2,667.6-48.9,667.6 M-48.9,654.3c-33.2,0-65.3,6.5-95.6,19.3c-29.3,12.4-55.5,30.1-78.1,52.6
|
||||
c-22.6,22.6-40.3,48.8-52.6,78.1c-12.8,30.3-19.3,62.5-19.3,95.6s6.5,65.3,19.3,95.6c12.4,29.3,30.1,55.5,52.6,78.1
|
||||
c22.6,22.6,48.8,40.3,78.1,52.6c30.3,12.8,62.5,19.3,95.6,19.3c33.2,0,65.3-6.5,95.6-19.3c29.3-12.4,55.5-30.1,78.1-52.6
|
||||
s40.3-48.8,52.6-78.1c12.8-30.3,19.3-62.5,19.3-95.6s-6.5-65.3-19.3-95.6c-12.4-29.3-30.1-55.5-52.6-78.1
|
||||
C102.3,703.7,76,686,46.8,673.6C16.5,660.8-15.7,654.3-48.9,654.3L-48.9,654.3z"/>
|
||||
</g>
|
||||
<g id="text2985-0-8-7-1-2-9-7-2-9-72-0-3-5-4-23-4-3-1-2-5-2">
|
||||
<path id="path438-3" inkscape:connector-curvature="0" class="st2" d="M113.8,763.3c0,6.3-4,13.9-12.1,22.8
|
||||
c-8,8.9-18,17.4-29.9,25.4c-11.7,8-23.4,14.4-35.1,19.1c2.6-0.9,5.3-1.3,8-1.3c9.1,0,15.2,1.7,18.2,5c0.7,0.7,1.1,1.6,1.1,2.6
|
||||
c0,1-1.7,3.4-5,7.2c-34.7,40.2-66.6,80.1-95.7,119.6c11.9-9.3,22.4-18.1,31.5-26.5c5.1-4.6,11.3-6.9,18.5-6.9
|
||||
c5.3,0,8.6,0.7,9.8,2c1.2,1.4,1.9,2.5,1.9,3.5c0,0.9-0.8,1.9-2.4,3.2c-20.6,18.1-54.3,44.4-101.1,79c-8,9-28.3,30.5-60.8,64.5
|
||||
c-5.8,5.9-12.2,8.9-19.3,8.9c-13.7,0-20.6-3.8-20.6-11.5c0-3.3,2.7-8.7,8-15.9c7.7-11.3,26.4-28.3,56.2-51
|
||||
c6.6-7.3,17.9-19.7,33.9-37.1c30.4-33.1,48.8-54.4,55.1-63.8c-16.8,15.9-29.6,27.2-38.2,33.8c-8.7,6.6-16.7,12.2-24.1,17.1
|
||||
c-7.3,4.8-14,8.7-20.2,11.7c-29.9,14.3-51.2,14.4-64,0.2c-6.4-7-9.6-17.4-9.6-31c0-13.7,3.8-28.8,11.3-45.3
|
||||
c7.5-16.4,17.6-32.6,30.2-48.6c12.6-16.1,27.6-31.7,44.9-46.9c17.3-15.2,35.3-28.6,54-40.1c18.7-11.5,38.3-20.7,59-27.6
|
||||
c20.6-7,40.1-10.6,58.4-10.6c6.3,0,12.2,1.1,17.8,3.2c5.6,2.1,9.5,4.3,11.9,6.7C111,740.3,113.8,749.8,113.8,763.3L113.8,763.3z
|
||||
M6.6,802.1l-0.9,3.7c0,2.1,1.4,3.2,4.3,3.2c7.5,0,17.9-3.6,31-10.9c13.1-7.3,23.7-14.8,31.7-22.4c8-7.7,12.1-14,12.1-19.1
|
||||
c0-4.3-3.8-6.5-11.5-6.5c-13.6,0-28.9,3.3-46,10c-16.9,6.7-33.5,15.3-49.7,26c-16.2,10.6-32.1,22.9-47.8,36.7
|
||||
c-15.7,13.7-29.4,27.5-41.2,41.4c-11.6,13.7-21,27.2-28.2,40.4c-7.2,13.2-10.8,24.5-10.8,33.9c0,3.7,1.1,7,3.2,9.8
|
||||
c2.2,2.8,5.4,4.3,9.6,4.3c13,0,33.9-10,62.7-29.9c28.9-19.9,62.1-47,99.6-81.4c0.5-0.5,1.4-1.4,2.6-2.8c2.7-3.3,5.5-5.7,8.3-7.2
|
||||
c-10.1,4.1-18.4,6.1-24.9,6.1s-11.7-1.4-15.9-4.3c-4.2-2.8-6.3-6.7-6.3-11.5c0-4.9,2.2-9.6,6.5-13.9c4.3-4.3,7.4-6.5,9.1-6.5
|
||||
C5.7,801.1,6.6,801.5,6.6,802.1z"/>
|
||||
</g>
|
||||
<g id="text2985-0-8-7-1-2-9-7-2-9-72-0-3-5-4-2-4-3-5-7-2-0-7">
|
||||
|
||||
<linearGradient id="path442-8_1_" gradientUnits="userSpaceOnUse" x1="927.2061" y1="-598.1527" x2="1031.5614" y2="-598.1527" gradientTransform="matrix(3.4044 0 0 -3.4044 -3338.6394 -1128.1228)">
|
||||
<stop offset="0" style="stop-color:#00B9C5"/>
|
||||
<stop offset="1" style="stop-color:#00B9C5;stop-opacity:0"/>
|
||||
</linearGradient>
|
||||
<path id="path442-8" inkscape:connector-curvature="0" class="st3" d="M113.8,763.3c0,6.3-4,13.9-12.1,22.8
|
||||
c-8,8.9-18,17.4-29.9,25.4c-11.7,8-23.4,14.4-35.1,19.1c2.6-0.9,5.3-1.3,8-1.3c9.1,0,15.2,1.7,18.2,5c0.7,0.7,1.1,1.6,1.1,2.6
|
||||
c0,1-1.7,3.4-5,7.2c-34.7,40.2-66.6,80.1-95.7,119.6c11.9-9.3,22.4-18.1,31.5-26.5c5.1-4.6,11.3-6.9,18.5-6.9
|
||||
c5.3,0,8.6,0.7,9.8,2c1.2,1.4,1.9,2.5,1.9,3.5c0,0.9-0.8,1.9-2.4,3.2c-20.6,18.1-54.3,44.4-101.1,79c-8,9-28.3,30.5-60.8,64.5
|
||||
c-5.8,5.9-12.2,8.9-19.3,8.9c-13.7,0-20.6-3.8-20.6-11.5c0-3.3,2.7-8.7,8-15.9c7.7-11.3,26.4-28.3,56.2-51
|
||||
c6.6-7.3,17.9-19.7,33.9-37.1c30.4-33.1,48.8-54.4,55.1-63.8c-16.8,15.9-29.6,27.2-38.2,33.8c-8.7,6.6-16.7,12.2-24.1,17.1
|
||||
c-7.3,4.8-14,8.7-20.2,11.7c-29.9,14.3-51.2,14.4-64,0.2c-6.4-7-9.6-17.4-9.6-31c0-13.7,3.8-28.8,11.3-45.3
|
||||
c7.5-16.4,17.6-32.6,30.2-48.6c12.6-16.1,27.6-31.7,44.9-46.9c17.3-15.2,35.3-28.6,54-40.1c18.7-11.5,38.3-20.7,59-27.6
|
||||
c20.6-7,40.1-10.6,58.4-10.6c6.3,0,12.2,1.1,17.8,3.2c5.6,2.1,9.5,4.3,11.9,6.7C111,740.3,113.8,749.8,113.8,763.3L113.8,763.3z
|
||||
M6.6,802.1l-0.9,3.7c0,2.1,1.4,3.2,4.3,3.2c7.5,0,17.9-3.6,31-10.9c13.1-7.3,23.7-14.8,31.7-22.4c8-7.7,12.1-14,12.1-19.1
|
||||
c0-4.3-3.8-6.5-11.5-6.5c-13.6,0-28.9,3.3-46,10c-16.9,6.7-33.5,15.3-49.7,26c-16.2,10.6-32.1,22.9-47.8,36.7
|
||||
c-15.7,13.7-29.4,27.5-41.2,41.4c-11.6,13.7-21,27.2-28.2,40.4c-7.2,13.2-10.8,24.5-10.8,33.9c0,3.7,1.1,7,3.2,9.8
|
||||
c2.2,2.8,5.4,4.3,9.6,4.3c13,0,33.9-10,62.7-29.9c28.9-19.9,62.1-47,99.6-81.4c0.5-0.5,1.4-1.4,2.6-2.8c2.7-3.3,5.5-5.7,8.3-7.2
|
||||
c-10.1,4.1-18.4,6.1-24.9,6.1s-11.7-1.4-15.9-4.3c-4.2-2.8-6.3-6.7-6.3-11.5c0-4.9,2.2-9.6,6.5-13.9c4.3-4.3,7.4-6.5,9.1-6.5
|
||||
C5.7,801.1,6.6,801.5,6.6,802.1z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="Guides" class="st4">
|
||||
</g>
|
||||
<g id="Arrow">
|
||||
<g>
|
||||
<g id="Back" class="st4">
|
||||
<polygon class="st5" points="253.3,159.8 347.2,159.8 347.2,253.5 398.8,253.5 300,350.9 206.5,253.5 253.3,253.5 "/>
|
||||
</g>
|
||||
<polygon class="st6" points="190.3,217 182.3,227.3 433,227.3 424.2,217 365.1,216.5 365.8,105.2 357.1,94.9 251.8,94.9
|
||||
243.3,105.2 243.3,216.8 "/>
|
||||
<g id="Front">
|
||||
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="307.6503" y1="105.1751" x2="307.6503" y2="354.418">
|
||||
<stop offset="0" style="stop-color:#FFFFFF"/>
|
||||
<stop offset="1" style="stop-color:#575757"/>
|
||||
</linearGradient>
|
||||
<polygon class="st7" points="243.3,105.2 365.8,105.2 365.8,227.3 433,227.3 304.2,354.4 182.3,227.3 243.3,227.3 "/>
|
||||
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="307.6503" y1="354.418" x2="307.6503" y2="105.1752">
|
||||
<stop offset="0" style="stop-color:#A2A2A2"/>
|
||||
<stop offset="1" style="stop-color:#878787"/>
|
||||
</linearGradient>
|
||||
<path class="st8" d="M364.8,106.2v121.1v1l1,0l64.8,0L304.2,353L184.6,228.3l58.6,0l1,0v-1V106.2L364.8,106.2 M365.8,105.2
|
||||
l-122.5,0v122.1l-61,0l121.9,127.1L433,227.3l-67.2,0V105.2L365.8,105.2z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 13 KiB |
@@ -1,121 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2013 GhostBSD
|
||||
#
|
||||
# See COPYING for licence terms.
|
||||
#
|
||||
# install.py v 0.4 Sunday, February 08 2015 Eric Turgeon
|
||||
#
|
||||
# install.py give the job to pc-sysinstall to install GhostBSD.
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk, GLib
|
||||
import threading
|
||||
# import locale
|
||||
import os
|
||||
from subprocess import Popen, PIPE, STDOUT, call
|
||||
from time import sleep
|
||||
from db_partition import rDeleteParttion, destroyParttion, makingParttion
|
||||
from create_cfg import gbsd_cfg
|
||||
from slides import gbsdSlides
|
||||
# from slides import dbsdSlides
|
||||
import sys
|
||||
installer = "/usr/local/lib/gbi/"
|
||||
sys.path.append(installer)
|
||||
tmp = "/tmp/.gbi/"
|
||||
gbi_path = "/usr/local/lib/gbi/"
|
||||
sysinstall = "/usr/local/sbin/pc-sysinstall"
|
||||
rcconfgbsd = "/etc/rc.conf.ghostbsd"
|
||||
rcconfdbsd = "/etc/rc.conf.desktopbsd"
|
||||
default_site = "/usr/local/lib/gbi/slides/welcome.html"
|
||||
logo = "/usr/local/lib/gbi/logo.png"
|
||||
|
||||
|
||||
def update_progess(probar, bartext):
|
||||
new_val = probar.get_fraction() + 0.000003
|
||||
probar.set_fraction(new_val)
|
||||
probar.set_text(bartext[0:80])
|
||||
|
||||
|
||||
def read_output(command, probar):
|
||||
call('service hald stop', shell=True)
|
||||
GLib.idle_add(update_progess, probar, "Creating pcinstall.cfg")
|
||||
|
||||
# If rc.conf.ghostbsd exists run gbsd_cfg
|
||||
gbsd_cfg()
|
||||
call('umount /media/GhostBSD', shell=True)
|
||||
sleep(2)
|
||||
if os.path.exists(tmp + 'delete'):
|
||||
GLib.idle_add(update_progess, probar, "Deleting partition")
|
||||
rDeleteParttion()
|
||||
sleep(1)
|
||||
# destroy disk partition and create scheme
|
||||
if os.path.exists(tmp + 'destroy'):
|
||||
GLib.idle_add(update_progess, probar, "Creating disk partition")
|
||||
destroyParttion()
|
||||
sleep(1)
|
||||
# create partition
|
||||
if os.path.exists(tmp + 'create'):
|
||||
GLib.idle_add(update_progess, probar, "Creating new partitions")
|
||||
makingParttion()
|
||||
sleep(1)
|
||||
p = Popen(command, shell=True, stdin=PIPE, stdout=PIPE,
|
||||
stderr=STDOUT, close_fds=True, universal_newlines=True)
|
||||
while True:
|
||||
line = p.stdout.readline()
|
||||
if not line:
|
||||
break
|
||||
bartext = line.rstrip()
|
||||
GLib.idle_add(update_progess, probar, bartext)
|
||||
# Those for next 4 line is for debugin only.
|
||||
# filer = open("/tmp/.gbi/tmp", "a")
|
||||
# filer.writelines(bartext)
|
||||
# filer.close
|
||||
print(bartext)
|
||||
call('service hald start', shell=True)
|
||||
if bartext.rstrip() == "Installation finished!":
|
||||
Popen('python2.7 %send.py' % gbi_path, shell=True, close_fds=True)
|
||||
call("rm -rf /tmp/.gbi/", shell=True, close_fds=True)
|
||||
Gtk.main_quit()
|
||||
else:
|
||||
Popen('python2.7 %serror.py' % gbi_path, shell=True, close_fds=True)
|
||||
Gtk.main_quit()
|
||||
|
||||
|
||||
class installSlide():
|
||||
|
||||
def close_application(self, widget, event=None):
|
||||
Gtk.main_quit()
|
||||
|
||||
def __init__(self):
|
||||
self.mainHbox = Gtk.HBox(False, 0)
|
||||
self.mainHbox.show()
|
||||
|
||||
self.mainVbox = Gtk.VBox(False, 0)
|
||||
self.mainVbox.show()
|
||||
self.mainHbox.pack_start(self.mainVbox, True, True, 0)
|
||||
# if os.path.exists(rcconfgbsd):
|
||||
slide = gbsdSlides()
|
||||
# elif os.path.exists(rcconfdbsd):
|
||||
# slide = dbsdSlides()
|
||||
getSlides = slide.get_slide()
|
||||
self.mainVbox.pack_start(getSlides, True, True, 0)
|
||||
|
||||
def get_model(self):
|
||||
return self.mainHbox
|
||||
|
||||
|
||||
class installProgress():
|
||||
|
||||
def __init__(self):
|
||||
self.pbar = Gtk.ProgressBar()
|
||||
self.pbar.set_show_text(True)
|
||||
# command = '%s -c %spcinstall.cfg' % (sysinstall, tmp)
|
||||
# thr = threading.Thread(target=read_output,
|
||||
# args=(command, self.pbar))
|
||||
# thr.setDaemon(True)
|
||||
# thr.start()
|
||||
self.pbar.show()
|
||||
|
||||
def getProgressBar(self):
|
||||
return self.pbar
|
||||
@@ -1,81 +0,0 @@
|
||||
#!/usr/local/bin//python
|
||||
#
|
||||
# Copyright (c) 2015 GhostBSD
|
||||
#
|
||||
# See COPYING for licence terms.
|
||||
#
|
||||
# type.py v 0.5 Thursday, Mar 28 2013 19:31:53 Eric Turgeon
|
||||
#
|
||||
# type.py create and delete partition slice for GhostBSD system.
|
||||
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk, Gdk
|
||||
import os
|
||||
import os.path
|
||||
|
||||
# Folder use pr the installer.
|
||||
tmp = "/tmp/.gbinstall/"
|
||||
installer = "/usr/local/lib/gbinstall/"
|
||||
if not os.path.exists(tmp):
|
||||
os.makedirs(tmp)
|
||||
|
||||
logo = "/usr/local/lib/gbinstall/logo.png"
|
||||
disk_file = '%sdisk' % tmp
|
||||
boot_file = '%sboot' % tmp
|
||||
signal = '%ssignal' % tmp
|
||||
|
||||
cssProvider = Gtk.CssProvider()
|
||||
# if os.path.exists(rcconfgbsd):
|
||||
# print(True)
|
||||
cssProvider.load_from_path('/usr/local/lib/gbinstall/ghostbsd-style.css')
|
||||
# elif os.path.exists(rcconfdbsd):
|
||||
# cssProvider.load_from_path('/usr/local/lib/gbi/desktopbsd-style.css')
|
||||
screen = Gdk.Screen.get_default()
|
||||
styleContext = Gtk.StyleContext()
|
||||
styleContext.add_provider_for_screen(screen, cssProvider,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
|
||||
|
||||
|
||||
class Types():
|
||||
|
||||
def fstype(self, radiobutton, val):
|
||||
self.ne = val
|
||||
pass_file = open(signal, 'w')
|
||||
pass_file.writelines(self.ne)
|
||||
pass_file.close
|
||||
return
|
||||
|
||||
def get_type(self):
|
||||
return self.ne
|
||||
|
||||
def get_model(self):
|
||||
return self.vbox1
|
||||
|
||||
def __init__(self):
|
||||
self.vbox1 = Gtk.VBox(False, 0)
|
||||
self.vbox1.show()
|
||||
label = Gtk.Label("Installation Type", name="Header")
|
||||
label.set_property("height-request", 40)
|
||||
self.vbox1.pack_start(label, False, False, 0)
|
||||
vbox = Gtk.VBox()
|
||||
hbox = Gtk.HBox()
|
||||
self.vbox1.pack_start(hbox, False, False, 10)
|
||||
full_ufs = Gtk.RadioButton.new_with_label_from_widget(None, "UFS Full Disk Configuration")
|
||||
vbox.pack_start(full_ufs, False, True, 10)
|
||||
full_ufs.connect("toggled", self.fstype, "ufs")
|
||||
self.ne = 'zfs'
|
||||
pass_file = open(signal, 'w')
|
||||
pass_file.writelines(self.ne)
|
||||
pass_file.close
|
||||
full_ufs.show()
|
||||
custom_ufs = Gtk.RadioButton.new_with_label_from_widget(full_ufs, "UFS Custom Disk Configuration")
|
||||
vbox.pack_start(custom_ufs, False, True, 10)
|
||||
custom_ufs.connect("toggled", self.fstype, "custom")
|
||||
custom_ufs.show()
|
||||
full_zfs = Gtk.RadioButton.new_with_label_from_widget(custom_ufs, "ZFS Full Disk Configuration(Recommended option for BE)")
|
||||
vbox.pack_start(full_zfs, False, True, 10)
|
||||
full_zfs.connect("toggled", self.fstype, "zfs")
|
||||
full_ufs.show()
|
||||
hbox.pack_start(vbox, False, False, 50)
|
||||
full_zfs.set_active(True)
|
||||
@@ -1,154 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
#####################################################################
|
||||
# Copyright (c) 2009-2012, GhostBSD. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistribution's of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistribution's in binary form must reproduce the above
|
||||
# copyright notice,this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# 3. Neither then name of GhostBSD Project nor the names of its
|
||||
# contributors maybe used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#####################################################################
|
||||
# language.py show the language for the installer.
|
||||
|
||||
|
||||
from gi.repository import Gtk, Gdk
|
||||
import os
|
||||
import os.path
|
||||
from sys_handler import language_dictionary
|
||||
# Folder use for the installer.
|
||||
tmp = "/tmp/.gbinstall/"
|
||||
installer = "/usr/local/lib/gbinstall/"
|
||||
if not os.path.exists(tmp):
|
||||
os.makedirs(tmp)
|
||||
logo = "/usr/local/lib/gbinstall/logo.png"
|
||||
langfile = '%slanguage' % tmp
|
||||
lang_dictionary = language_dictionary()
|
||||
# Text to be replace be multiple language file.
|
||||
title = "Welcome To GhostBSD!"
|
||||
welltext = """Select the language you want to use with GhostBSD."""
|
||||
|
||||
|
||||
cssProvider = Gtk.CssProvider()
|
||||
# if os.path.exists(rcconfgbsd):
|
||||
# print(True)
|
||||
cssProvider.load_from_path('/usr/local/lib/gbinstall/ghostbsd-style.css')
|
||||
# elif os.path.exists(rcconfdbsd):
|
||||
# cssProvider.load_from_path('/usr/local/lib/gbi/desktopbsd-style.css')
|
||||
screen = Gdk.Screen.get_default()
|
||||
styleContext = Gtk.StyleContext()
|
||||
styleContext.add_provider_for_screen(screen, cssProvider,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
|
||||
|
||||
|
||||
class Language:
|
||||
|
||||
# On selection it overwrite the delfaut language file.
|
||||
def Language_Selection(self, tree_selection):
|
||||
model, treeiter = tree_selection.get_selected()
|
||||
if treeiter is not None:
|
||||
value = model[treeiter][0]
|
||||
self.language = lang_dictionary[value]
|
||||
return
|
||||
|
||||
def Language_Columns(self, treeView):
|
||||
cell = Gtk.CellRendererText()
|
||||
column = Gtk.TreeViewColumn(None, cell, text=0)
|
||||
column_header = Gtk.Label('Language')
|
||||
column_header.set_use_markup(True)
|
||||
column_header.show()
|
||||
column.set_widget(column_header)
|
||||
column.set_sort_column_id(0)
|
||||
treeView.append_column(column)
|
||||
return
|
||||
|
||||
def save_selection(self):
|
||||
lang_file = open(langfile, 'w')
|
||||
lang_file.writelines(self.language)
|
||||
lang_file.close()
|
||||
return
|
||||
|
||||
# Initial definition.
|
||||
def __init__(self):
|
||||
# Add a Default vertical box
|
||||
self.vbox1 = Gtk.VBox(False, 0)
|
||||
self.vbox1.show()
|
||||
label = Gtk.Label("Welcome To GhostBSD!", name="Header")
|
||||
label.set_property("height-request", 40)
|
||||
self.vbox1.pack_start(label, False, False, 0)
|
||||
grid = Gtk.Grid()
|
||||
self.vbox1.pack_start(grid, True, True, 0)
|
||||
grid.set_row_spacing(10)
|
||||
grid.set_column_spacing(3)
|
||||
grid.set_column_homogeneous(True)
|
||||
grid.set_row_homogeneous(True)
|
||||
grid.set_margin_left(10)
|
||||
grid.set_margin_right(10)
|
||||
grid.set_margin_top(10)
|
||||
grid.set_margin_bottom(10)
|
||||
# Adding a Scrolling Window
|
||||
sw = Gtk.ScrolledWindow()
|
||||
sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
|
||||
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||
# Adding a treestore and store language in it.
|
||||
store = Gtk.TreeStore(str)
|
||||
for line in lang_dictionary:
|
||||
store.append(None, [line])
|
||||
treeView = Gtk.TreeView(store)
|
||||
treeView.set_model(store)
|
||||
treeView.set_rules_hint(True)
|
||||
self.Language_Columns(treeView)
|
||||
tree_selection = treeView.get_selection()
|
||||
tree_selection.set_mode(Gtk.SelectionMode.SINGLE)
|
||||
tree_selection.connect("changed", self.Language_Selection)
|
||||
sw.add(treeView)
|
||||
sw.show()
|
||||
grid.attach(sw, 1, 2, 1, 9)
|
||||
# add text in a label.
|
||||
vhbox = Gtk.VBox(False, 0)
|
||||
vhbox.set_border_width(10)
|
||||
vhbox.show()
|
||||
self.wellcome = Gtk.Label('<span size="xx-large"><b>' + title + '</b></span>')
|
||||
self.wellcome.set_use_markup(True)
|
||||
self.wellcometext = Gtk.Label(welltext)
|
||||
self.wellcometext.set_use_markup(True)
|
||||
table = Gtk.Table()
|
||||
# table.attach(self.wellcome, 0, 1, 1, 2)
|
||||
# wall = Gtk.Label()
|
||||
# table.attach(wall, 0, 1, 2, 3)
|
||||
table.attach(self.wellcometext, 0, 1, 3, 4)
|
||||
vhbox.pack_start(table, False, False, 5)
|
||||
image = Gtk.Image()
|
||||
image.set_from_file(logo)
|
||||
image.show()
|
||||
# grid.attach(self.wellcome, 1, 1, 3, 1)
|
||||
vhbox.pack_start(image, True, True, 5)
|
||||
grid.attach(vhbox, 2, 2, 2, 9)
|
||||
grid.show()
|
||||
return
|
||||
|
||||
def get_model(self):
|
||||
return self.vbox1
|
||||
|
Before Width: | Height: | Size: 9.7 KiB |
@@ -1,730 +0,0 @@
|
||||
#!/usr/local/bin/python
|
||||
"""
|
||||
Copyright (c) 2010-2017, GhostBSD. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistribution's of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistribution's in binary form must reproduce the above
|
||||
copyright notice,this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
"""
|
||||
#
|
||||
# partition.py v 1.3 Friday, January 17 2014 Eric Turgeon
|
||||
#
|
||||
# auto_partition.py create and delete partition slice for GhostBSD installer
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk, Gdk
|
||||
import os
|
||||
import shutil
|
||||
from db_partition import partition_repos, disk_query, Delete_partition
|
||||
from db_partition import partition_query, label_query, bios_or_uefi
|
||||
from db_partition import autoDiskPartition, autoFreeSpace, first_is_free
|
||||
from db_partition import createLabel, scheme_query, how_partition
|
||||
from db_partition import diskSchemeChanger, createSlice, createPartition
|
||||
from db_partition import efi_exist
|
||||
|
||||
|
||||
# Folder use pr the installer.
|
||||
tmp = "/tmp/.gbinstall/"
|
||||
installer = "/usr/local/lib/gbinstall/"
|
||||
query = "sh /usr/local/lib/gbinstall/backend-query/"
|
||||
if not os.path.exists(tmp):
|
||||
os.makedirs(tmp)
|
||||
|
||||
add_part = 'gpart add'
|
||||
disk_part = '%sdisk-part.sh' % query
|
||||
disk_label = '%sdisk-label.sh' % query
|
||||
detect_sheme = '%sdetect-sheme.sh' % query
|
||||
|
||||
part = '%sdisk-part.sh' % query
|
||||
memory = 'sysctl hw.physmem'
|
||||
disk_list = '%sdisk-list.sh' % query
|
||||
disk_info = '%sdisk-info.sh' % query
|
||||
disk_label = '%sdisk-label.sh' % query
|
||||
disk_schem = '%sscheme' % tmp
|
||||
disk_file = '%sdisk' % tmp
|
||||
psize = '%spart_size' % tmp
|
||||
logo = "/usr/local/lib/gbinstall/logo.png"
|
||||
Part_label = '%spartlabel' % tmp
|
||||
part_schem = '%sscheme' % tmp
|
||||
partitiondb = "%spartitiondb/" % tmp
|
||||
boot_file = "%sboot" % tmp
|
||||
ufs_Partiton_list = []
|
||||
|
||||
|
||||
cssProvider = Gtk.CssProvider()
|
||||
cssProvider.load_from_path('/usr/local/lib/gbinstall/ghostbsd-style.css')
|
||||
screen = Gdk.Screen.get_default()
|
||||
styleContext = Gtk.StyleContext()
|
||||
styleContext.add_provider_for_screen(screen, cssProvider,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
|
||||
|
||||
|
||||
class Partitions():
|
||||
|
||||
def on_fs(self, widget):
|
||||
self.fs = widget.get_active_text()
|
||||
|
||||
def on_label(self, widget):
|
||||
self.label = widget.get_active_text()
|
||||
|
||||
def save_selection(self):
|
||||
pass
|
||||
|
||||
def on_add_label(self, widget, entry, inumb, path, create):
|
||||
if self.fs == '' or self.label == '':
|
||||
pass
|
||||
else:
|
||||
fs = self.fs
|
||||
lb = self.label
|
||||
cnumb = entry.get_value_as_int()
|
||||
lnumb = inumb - cnumb
|
||||
createLabel(path, lnumb, cnumb, lb, fs, create)
|
||||
self.window.hide()
|
||||
self.update()
|
||||
|
||||
def on_add_partition(self, widget, entry, inumb, path, create):
|
||||
if self.fs == '' or self.label == '':
|
||||
pass
|
||||
else:
|
||||
fs = self.fs
|
||||
lb = self.label
|
||||
cnumb = entry.get_value_as_int()
|
||||
lnumb = inumb - cnumb
|
||||
createPartition(path, lnumb, inumb, cnumb, lb, fs, create)
|
||||
self.window.hide()
|
||||
self.update()
|
||||
|
||||
def cancel(self, widget):
|
||||
self.window.hide()
|
||||
|
||||
def labelEditor(self, path, pslice, size, scheme, modify):
|
||||
numb = int(size)
|
||||
self.window = Gtk.Window()
|
||||
self.window.set_title("Add Partition")
|
||||
self.window.set_border_width(0)
|
||||
self.window.set_size_request(480, 200)
|
||||
self.window.set_icon_from_file(logo)
|
||||
box1 = Gtk.VBox(False, 0)
|
||||
self.window.add(box1)
|
||||
box1.show()
|
||||
box2 = Gtk.VBox(False, 10)
|
||||
box2.set_border_width(10)
|
||||
box1.pack_start(box2, True, True, 0)
|
||||
box2.show()
|
||||
# create label
|
||||
# label0 = Gtk.Label("Create Partition Label")
|
||||
table = Gtk.Table(1, 2, True)
|
||||
label1 = Gtk.Label("Type:")
|
||||
label2 = Gtk.Label("Size(MB):")
|
||||
label3 = Gtk.Label("Mount point:")
|
||||
self.fstype = Gtk.ComboBoxText()
|
||||
self.fstype.append_text('UFS')
|
||||
self.fstype.append_text('UFS+S')
|
||||
self.fstype.append_text('UFS+J')
|
||||
self.fstype.append_text('UFS+SUJ')
|
||||
self.fstype.append_text('SWAP')
|
||||
if scheme == 'GPT':
|
||||
if bios_or_uefi() == "UEFI":
|
||||
self.fstype.append_text("UEFI")
|
||||
self.fs = "UEFI"
|
||||
else:
|
||||
self.fstype.append_text("BOOT")
|
||||
self.fs = "BOOT"
|
||||
if self.fs == "UEFI" and efi_exist(self.disk) is False:
|
||||
if not os.path.exists(Part_label):
|
||||
self.fstype.set_active(5)
|
||||
elif len(self.prttn) == 0:
|
||||
self.fstype.set_active(5)
|
||||
elif self.fs == "BOOT":
|
||||
if not os.path.exists(Part_label):
|
||||
self.fstype.set_active(5)
|
||||
elif len(self.prttn) == 0:
|
||||
self.fstype.set_active(5)
|
||||
elif self.lablebehind == "/":
|
||||
self.fstype.set_active(4)
|
||||
self.fs = "SWAP"
|
||||
else:
|
||||
self.fstype.set_active(3)
|
||||
self.fs = "UFS+SUJ"
|
||||
self.fstype.connect("changed", self.on_fs)
|
||||
adj = Gtk.Adjustment(numb, 0, numb, 1, 100, 0)
|
||||
self.entry = Gtk.SpinButton(adjustment=adj)
|
||||
if modify is True:
|
||||
self.entry.set_editable(False)
|
||||
else:
|
||||
self.entry.set_editable(True)
|
||||
self.mountpoint = Gtk.ComboBoxText()
|
||||
# self.mountpoint.append_text('select labels')
|
||||
self.label = "none"
|
||||
self.mountpoint.append_text('none')
|
||||
# The space for root '/ ' is to recognise / from the file.
|
||||
self.mountpoint.append_text('/')
|
||||
if os.path.exists(Part_label):
|
||||
if scheme == 'GPT' and len(self.prttn) == 1:
|
||||
self.mountpoint.append_text('/boot')
|
||||
elif scheme == 'MBR' and len(self.prttn) == 0:
|
||||
self.mountpoint.append_text('/boot')
|
||||
elif scheme == 'MBR' and not os.path.exists(Part_label):
|
||||
self.mountpoint.append_text('/boot')
|
||||
self.mountpoint.append_text('/etc')
|
||||
self.mountpoint.append_text('/root')
|
||||
self.mountpoint.append_text('/tmp')
|
||||
self.mountpoint.append_text('/usr')
|
||||
self.mountpoint.append_text('/usr/home')
|
||||
self.mountpoint.append_text('/var')
|
||||
self.mountpoint.set_active(0)
|
||||
self.mountpoint.connect("changed", self.on_label)
|
||||
# table.attach(label0, 0, 2, 0, 1)
|
||||
table.attach(label1, 0, 1, 1, 2)
|
||||
table.attach(self.fstype, 1, 2, 1, 2)
|
||||
table.attach(label2, 0, 1, 2, 3)
|
||||
table.attach(self.entry, 1, 2, 2, 3)
|
||||
table.attach(label3, 0, 1, 3, 4)
|
||||
table.attach(self.mountpoint, 1, 2, 3, 4)
|
||||
box2.pack_start(table, False, False, 0)
|
||||
box2 = Gtk.HBox(False, 10)
|
||||
box2.set_border_width(5)
|
||||
box1.pack_start(box2, False, True, 0)
|
||||
box2.show()
|
||||
# Add button
|
||||
bbox = Gtk.HButtonBox()
|
||||
bbox.set_border_width(5)
|
||||
bbox.set_spacing(10)
|
||||
button = Gtk.Button(stock=Gtk.STOCK_CANCEL)
|
||||
button.connect("clicked", self.cancel)
|
||||
bbox.add(button)
|
||||
button = Gtk.Button(stock=Gtk.STOCK_ADD)
|
||||
if modify is False:
|
||||
if scheme == 'MBR':
|
||||
button.connect("clicked", self.on_add_label, self.entry,
|
||||
numb, path, True)
|
||||
elif scheme == 'GPT' and self.fs == 'BOOT':
|
||||
button.connect("clicked", self.on_add_partition, self.entry,
|
||||
numb, path, True)
|
||||
elif scheme == 'GPT' and self.fs == 'UEFI' and efi_exist(self.disk) is False:
|
||||
button.connect("clicked", self.on_add_partition, self.entry,
|
||||
numb, path, True)
|
||||
else:
|
||||
button.connect("clicked", self.on_add_partition, self.entry,
|
||||
numb, path, False)
|
||||
else:
|
||||
if scheme == 'MBR':
|
||||
button.connect("clicked", self.on_add_label, self.entry, numb,
|
||||
path, False)
|
||||
elif scheme == 'GPT':
|
||||
button.connect("clicked", self.on_add_partition, self.entry,
|
||||
numb, path, False)
|
||||
bbox.add(button)
|
||||
box2.pack_end(bbox, True, True, 5)
|
||||
self.window.show_all()
|
||||
|
||||
def sheme_selection(self, combobox):
|
||||
model = combobox.get_model()
|
||||
index = combobox.get_active()
|
||||
data = model[index][0]
|
||||
value = data.partition(':')[0]
|
||||
self.scheme = value
|
||||
|
||||
def add_gpt_mbr(self, widget, data):
|
||||
diskSchemeChanger(self.scheme, self.path, self.slice, self.size)
|
||||
self.update()
|
||||
self.window.hide()
|
||||
if data is False:
|
||||
if scheme_query(self.path) == "MBR" and self.path[1] < 4:
|
||||
self.sliceEditor()
|
||||
elif scheme_query(self.path) == "GPT":
|
||||
self.labelEditor(self.path, self.slice, self.size, 'GPT', False)
|
||||
|
||||
def autoSchemePartition(self, widget):
|
||||
diskSchemeChanger(self.scheme, self.path, self.slice, self.size)
|
||||
self.update()
|
||||
autoDiskPartition(self.slice, self.size, self.scheme)
|
||||
self.update()
|
||||
self.window.hide()
|
||||
|
||||
def schemeEditor(self, data):
|
||||
self.window = Gtk.Window()
|
||||
self.window.set_title("Partition Scheme")
|
||||
self.window.set_border_width(0)
|
||||
self.window.set_size_request(400, 150)
|
||||
self.window.set_icon_from_file(logo)
|
||||
box1 = Gtk.VBox(False, 0)
|
||||
self.window.add(box1)
|
||||
box1.show()
|
||||
box2 = Gtk.VBox(False, 10)
|
||||
box2.set_border_width(10)
|
||||
box1.pack_start(box2, True, True, 0)
|
||||
box2.show()
|
||||
# Creating MBR or GPT drive
|
||||
label = Gtk.Label('<b>Select a partition scheme for this drive:</b>')
|
||||
label.set_use_markup(True)
|
||||
# Adding a combo box to selecting MBR or GPT sheme.
|
||||
self.scheme = 'GPT'
|
||||
shemebox = Gtk.ComboBoxText()
|
||||
shemebox.append_text("GPT: GUID Partition Table")
|
||||
shemebox.append_text("MBR: DOS Partition")
|
||||
shemebox.connect('changed', self.sheme_selection)
|
||||
shemebox.set_active(0)
|
||||
table = Gtk.Table(1, 2, True)
|
||||
table.attach(label, 0, 2, 0, 1)
|
||||
table.attach(shemebox, 0, 2, 1, 2)
|
||||
box2.pack_start(table, False, False, 0)
|
||||
box2 = Gtk.HBox(False, 10)
|
||||
box2.set_border_width(5)
|
||||
box1.pack_start(box2, False, True, 0)
|
||||
box2.show()
|
||||
# Add create_scheme button
|
||||
bbox = Gtk.HButtonBox()
|
||||
bbox.set_border_width(5)
|
||||
bbox.set_spacing(10)
|
||||
button = Gtk.Button(stock=Gtk.STOCK_ADD)
|
||||
if data is None:
|
||||
button.connect("clicked", self.autoSchemePartition)
|
||||
else:
|
||||
button.connect("clicked", self.add_gpt_mbr, data)
|
||||
bbox.add(button)
|
||||
box2.pack_end(bbox, True, True, 5)
|
||||
self.window.show_all()
|
||||
|
||||
def get_value(self, widget, entry):
|
||||
psize = int(entry.get_value_as_int())
|
||||
rs = int(self.size) - psize
|
||||
createSlice(psize, rs, self.path)
|
||||
self.update()
|
||||
self.window.hide()
|
||||
|
||||
def sliceEditor(self):
|
||||
numb = int(self.size)
|
||||
self.window = Gtk.Window()
|
||||
self.window.set_title("Add Partition")
|
||||
self.window.set_border_width(0)
|
||||
self.window.set_size_request(400, 150)
|
||||
self.window.set_icon_from_file(logo)
|
||||
box1 = Gtk.VBox(False, 0)
|
||||
self.window.add(box1)
|
||||
box1.show()
|
||||
box2 = Gtk.VBox(False, 10)
|
||||
box2.set_border_width(10)
|
||||
box1.pack_start(box2, True, True, 0)
|
||||
box2.show()
|
||||
# create Partition slice
|
||||
# label = Gtk.Label('<b>Create a New Partition Slice</b>')
|
||||
# label.set_use_markup(True)
|
||||
# label.set_alignment(0, .5)
|
||||
table = Gtk.Table(1, 2, True)
|
||||
label1 = Gtk.Label("Size(MB):")
|
||||
adj = Gtk.Adjustment(numb, 0, numb, 1, 100, 0)
|
||||
self.entry = Gtk.SpinButton(adjustment=adj)
|
||||
self.entry.set_numeric(True)
|
||||
# table.attach(label, 0, 2, 0, 1)
|
||||
table.attach(label1, 0, 1, 1, 2)
|
||||
table.attach(self.entry, 1, 2, 1, 2)
|
||||
box2.pack_start(table, False, False, 0)
|
||||
box2 = Gtk.HBox(False, 10)
|
||||
box2.set_border_width(5)
|
||||
box1.pack_start(box2, False, True, 0)
|
||||
box2.show()
|
||||
# Add button
|
||||
bbox = Gtk.HButtonBox()
|
||||
bbox.set_border_width(5)
|
||||
bbox.set_spacing(10)
|
||||
button = Gtk.Button(stock=Gtk.STOCK_CANCEL)
|
||||
button.connect("clicked", self.cancel)
|
||||
bbox.add(button)
|
||||
button = Gtk.Button(stock=Gtk.STOCK_ADD)
|
||||
button.connect("clicked", self.get_value, self.entry)
|
||||
bbox.add(button)
|
||||
box2.pack_end(bbox, True, True, 5)
|
||||
self.window.show_all()
|
||||
|
||||
def update(self):
|
||||
oldpath = self.path
|
||||
self.Tree_Store()
|
||||
self.treeview.expand_all()
|
||||
self.treeview.row_activated(oldpath, self.treeview.get_columns()[0])
|
||||
self.treeview.set_cursor(oldpath)
|
||||
|
||||
def delete_partition(self, widget):
|
||||
part = self.slice
|
||||
Delete_partition(part, self.path)
|
||||
self.update()
|
||||
|
||||
def delete_create_button(self):
|
||||
bbox = Gtk.HButtonBox()
|
||||
bbox.set_border_width(5)
|
||||
bbox.set_spacing(10)
|
||||
self.create_bt = Gtk.Button("Create")
|
||||
self.create_bt.connect("clicked", self.create_partition)
|
||||
bbox.add(self.create_bt)
|
||||
self.delete_bt = Gtk.Button("Delete")
|
||||
self.delete_bt.connect("clicked", self.delete_partition)
|
||||
bbox.add(self.delete_bt)
|
||||
self.modifi_bt = Gtk.Button("Modify")
|
||||
self.modifi_bt.connect("clicked", self.modify_partition)
|
||||
# bbox.add(self.modifi_bt)
|
||||
self.revert_bt = Gtk.Button("Revert")
|
||||
self.revert_bt.connect("clicked", self.revertChange)
|
||||
bbox.add(self.revert_bt)
|
||||
self.auto_bt = Gtk.Button("Auto")
|
||||
self.auto_bt.connect("clicked", self.autoPartition)
|
||||
bbox.add(self.auto_bt)
|
||||
return bbox
|
||||
|
||||
def modify_partition(self, widget):
|
||||
if len(self.path) == 3:
|
||||
if self.slice != 'freespace':
|
||||
self.labelEditor(self.path, self.slice, self.size, 'MBR', True)
|
||||
elif len(self.path) == 2 and self.slice != 'freespace':
|
||||
if scheme_query(self.path) == "GPT":
|
||||
self.labelEditor(self.path, self.slice, self.size, 'GPT', True)
|
||||
|
||||
def autoPartition(self, widget):
|
||||
if len(self.path) == 3:
|
||||
pass
|
||||
# elif len(self.path) == 1 and self.scheme is None:
|
||||
# self.schemeEditor(None)
|
||||
# self.update()
|
||||
# elif len(self.path) == 1:
|
||||
# autoDiskPartition(self.slice, self.size, self.scheme)
|
||||
# self.Tree_Store()
|
||||
# self.treeview.expand_all()
|
||||
# self.treeview.set_cursor(self.path)
|
||||
elif self.slice == 'freespace':
|
||||
autoFreeSpace(self.path, self.size)
|
||||
self.Tree_Store()
|
||||
self.treeview.expand_all()
|
||||
self.treeview.set_cursor(self.path)
|
||||
elif len(self.path) == 2:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
self.update()
|
||||
|
||||
def revertChange(self, widget):
|
||||
if os.path.exists(partitiondb):
|
||||
shutil.rmtree(partitiondb)
|
||||
if os.path.exists(tmp + 'create'):
|
||||
os.remove(tmp + 'create')
|
||||
if os.path.exists(tmp + 'delete'):
|
||||
os.remove(tmp + 'delete')
|
||||
if os.path.exists(tmp + 'destroy'):
|
||||
os.remove(tmp + 'destroy')
|
||||
if os.path.exists(Part_label):
|
||||
os.remove(Part_label)
|
||||
partition_repos()
|
||||
self.Tree_Store()
|
||||
self.treeview.expand_all()
|
||||
|
||||
def create_partition(self, widget):
|
||||
if len(self.path) == 2 and how_partition(self.path) == 1 and self.slice == 'freespace':
|
||||
self.schemeEditor(False)
|
||||
elif len(self.path) == 3:
|
||||
if self.slice == 'freespace':
|
||||
self.labelEditor(self.path, self.slice, self.size, 'MBR', False)
|
||||
elif len(self.path) == 2 and self.slice == 'freespace':
|
||||
if scheme_query(self.path) == "MBR" and self.path[1] < 4:
|
||||
self.sliceEditor()
|
||||
elif scheme_query(self.path) == "GPT":
|
||||
self.labelEditor(self.path, self.slice, self.size, 'GPT', False)
|
||||
else:
|
||||
if how_partition(self.path) == 1:
|
||||
self.schemeEditor(True)
|
||||
elif how_partition(self.path) == 0:
|
||||
self.schemeEditor(True)
|
||||
else:
|
||||
pass
|
||||
|
||||
def partition_selection(self, widget):
|
||||
model, self.iter, = widget.get_selected()
|
||||
print(self.iter)
|
||||
if self.iter is None:
|
||||
return
|
||||
self.path = model.get_path(self.iter)
|
||||
tree_iter3 = model.get_iter(self.path[0])
|
||||
self.scheme = model.get_value(tree_iter3, 3)
|
||||
self.disk = model.get_value(tree_iter3, 0)
|
||||
tree_iter = model.get_iter(self.path)
|
||||
self.slice = model.get_value(tree_iter, 0)
|
||||
self.size = model.get_value(tree_iter, 1)
|
||||
if len(self.path) == 2 and self.path[1] > 0 and self.scheme == "MBR":
|
||||
pathbehind = str(self.path[0]) + ":" + str(int(self.path[1] - 1))
|
||||
tree_iter2 = model.get_iter(pathbehind)
|
||||
self.slicebehind = model.get_value(tree_iter2, 0)
|
||||
sl = int(self.path[1]) + 1
|
||||
if 'freespace' in self.slicebehind:
|
||||
slbehind = self.path[1]
|
||||
else:
|
||||
slbehind = int(self.slicebehind.partition('s')[2])
|
||||
elif len(self.path) == 2 and self.path[1] > 0 and self.scheme == "GPT":
|
||||
pathbehind = str(self.path[0]) + ":" + str(int(self.path[1] - 1))
|
||||
tree_iter2 = model.get_iter(pathbehind)
|
||||
self.slicebehind = model.get_value(tree_iter2, 0)
|
||||
self.lablebehind = model.get_value(tree_iter2, 2)
|
||||
sl = int(self.path[1]) + 1
|
||||
if 'freespace' in self.slicebehind:
|
||||
slbehind = self.path[1]
|
||||
else:
|
||||
slbehind = int(self.slicebehind.partition('p')[2])
|
||||
elif len(self.path) == 3 and self.path[2] > 0 and self.scheme == "MBR":
|
||||
if self.path[1] > 0:
|
||||
pathbehind1 = str(self.path[0]) + ":" + str(int(self.path[1] - 1))
|
||||
tree_iter2 = model.get_iter(pathbehind1)
|
||||
self.slicebehind = model.get_value(tree_iter2, 0)
|
||||
else:
|
||||
self.slicebehind = None
|
||||
pathbehind2 = str(self.path[0]) + ":" + str(self.path[1]) + ":" + str(int(self.path[2] - 1))
|
||||
tree_iter3 = model.get_iter(pathbehind2)
|
||||
self.lablebehind = model.get_value(tree_iter3, 2)
|
||||
sl = int(self.path[1]) + 1
|
||||
if self.slicebehind is None:
|
||||
slbehind = self.path[1]
|
||||
elif 'freespace' in self.slicebehind:
|
||||
slbehind = self.path[1]
|
||||
else:
|
||||
slbehind = int(self.slicebehind.partition('s')[2])
|
||||
else:
|
||||
self.slicebehind = None
|
||||
self.lablebehind = None
|
||||
sl = 1
|
||||
slbehind = 0
|
||||
if 'freespace' in self.slice:
|
||||
if self.path[1] > 3 and self.scheme == "MBR":
|
||||
self.create_bt.set_sensitive(False)
|
||||
elif self.slicebehind is None:
|
||||
self.create_bt.set_sensitive(True)
|
||||
elif sl == slbehind:
|
||||
self.create_bt.set_sensitive(False)
|
||||
elif slbehind > 4:
|
||||
self.create_bt.set_sensitive(False)
|
||||
else:
|
||||
self.create_bt.set_sensitive(True)
|
||||
self.delete_bt.set_sensitive(False)
|
||||
self.modifi_bt.set_sensitive(False)
|
||||
self.auto_bt.set_sensitive(True)
|
||||
elif 's' in self.slice:
|
||||
self.create_bt.set_sensitive(False)
|
||||
self.delete_bt.set_sensitive(True)
|
||||
# self.modifi_bt.set_sensitive(True)
|
||||
self.auto_bt.set_sensitive(False)
|
||||
elif 'p' in self.slice:
|
||||
self.create_bt.set_sensitive(False)
|
||||
self.delete_bt.set_sensitive(True)
|
||||
# self.modifi_bt.set_sensitive(True)
|
||||
self.auto_bt.set_sensitive(False)
|
||||
else:
|
||||
self.delete_bt.set_sensitive(False)
|
||||
self.modifi_bt.set_sensitive(False)
|
||||
self.auto_bt.set_sensitive(False)
|
||||
how_many_prt = how_partition(self.path)
|
||||
firstisfree = first_is_free(self.path)
|
||||
if how_many_prt == 1 and firstisfree == 'freespace':
|
||||
self.create_bt.set_sensitive(False)
|
||||
elif how_partition(self.path) == 0:
|
||||
self.create_bt.set_sensitive(True)
|
||||
else:
|
||||
self.create_bt.set_sensitive(False)
|
||||
if os.path.exists(Part_label):
|
||||
rd = open(Part_label, 'r')
|
||||
self.prttn = rd.readlines()
|
||||
rtbt = False
|
||||
for line in self.prttn:
|
||||
if "/boot\n" in line:
|
||||
rtbt = True
|
||||
break
|
||||
# If Find GPT scheme.
|
||||
if os.path.exists(disk_schem):
|
||||
rschm = open(disk_schem, 'r')
|
||||
schm = rschm.readlines()[0]
|
||||
efi = efi_exist(self.disk)
|
||||
if 'GPT' in schm:
|
||||
if len(self.prttn) >= 2:
|
||||
if 'BOOT' in self.prttn[0]:
|
||||
if rtbt is True and "/boot\n" not in self.prttn[1]:
|
||||
self.button3.set_sensitive(False)
|
||||
elif "/boot\n" in self.prttn[1]:
|
||||
if len(self.prttn) >= 3:
|
||||
if '/\n' in self.prttn[2]:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif '/\n' in self.prttn[1]:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif 'UEFI' in self.prttn[0] and efi is False:
|
||||
if rtbt is True and "/boot\n" not in self.prttn[1]:
|
||||
self.button3.set_sensitive(False)
|
||||
elif "/boot\n" in self.prttn[1]:
|
||||
if len(self.prttn) >= 3:
|
||||
if '/\n' in self.prttn[2]:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif '/\n' in self.prttn[1]:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif rtbt is True and "/boot\n" not in self.prttn[1]:
|
||||
self.button3.set_sensitive(False)
|
||||
elif "/boot\n" in self.prttn[0] and efi is True:
|
||||
if len(self.prttn) >= 2:
|
||||
if '/\n' in self.prttn[1]:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif '/\n' in self.prttn[0] and efi is True:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
if len(self.prttn) >= 1:
|
||||
if "/boot\n" in self.prttn[0]:
|
||||
if len(self.prttn) >= 2:
|
||||
if '/\n' in self.prttn[1]:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif '/\n' in self.prttn[0]:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
|
||||
def __init__(self, button3):
|
||||
self.button3 = button3
|
||||
self.vbox1 = Gtk.VBox(False, 0)
|
||||
self.vbox1.show()
|
||||
# Title
|
||||
label = Gtk.Label("UFS Partition Editor", name="Header")
|
||||
label.set_property("height-request", 40)
|
||||
self.vbox1.pack_start(label, False, False, 0)
|
||||
|
||||
# Choosing disk to Select Create or delete partition.
|
||||
label = Gtk.Label("<b>Select a drive:</b>")
|
||||
label.set_use_markup(True)
|
||||
|
||||
sw = Gtk.ScrolledWindow(hexpand=True, vexpand=True)
|
||||
sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
|
||||
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||
self.store = Gtk.TreeStore(str, str, str, str, 'gboolean')
|
||||
self.Tree_Store()
|
||||
self.treeview = Gtk.TreeView(self.store)
|
||||
self.treeview.set_model(self.store)
|
||||
self.treeview.set_rules_hint(True)
|
||||
cell = Gtk.CellRendererText()
|
||||
column = Gtk.TreeViewColumn(None, cell, text=0)
|
||||
column_header = Gtk.Label('Partition')
|
||||
column_header.set_use_markup(True)
|
||||
column_header.show()
|
||||
column.set_widget(column_header)
|
||||
column.set_sort_column_id(0)
|
||||
cell2 = Gtk.CellRendererText()
|
||||
column2 = Gtk.TreeViewColumn(None, cell2, text=0)
|
||||
column_header2 = Gtk.Label('Size(MB)')
|
||||
column_header2.set_use_markup(True)
|
||||
column_header2.show()
|
||||
column2.set_widget(column_header2)
|
||||
cell3 = Gtk.CellRendererText()
|
||||
column3 = Gtk.TreeViewColumn(None, cell3, text=0)
|
||||
column_header3 = Gtk.Label('Mount Point')
|
||||
column_header3.set_use_markup(True)
|
||||
column_header3.show()
|
||||
column3.set_widget(column_header3)
|
||||
cell4 = Gtk.CellRendererText()
|
||||
column4 = Gtk.TreeViewColumn(None, cell4, text=0)
|
||||
column_header4 = Gtk.Label('System/Type')
|
||||
column_header4.set_use_markup(True)
|
||||
column_header4.show()
|
||||
column4.set_widget(column_header4)
|
||||
column.set_attributes(cell, text=0)
|
||||
column2.set_attributes(cell2, text=1)
|
||||
column3.set_attributes(cell3, text=2)
|
||||
column4.set_attributes(cell4, text=3)
|
||||
self.treeview.append_column(column)
|
||||
self.treeview.append_column(column2)
|
||||
self.treeview.append_column(column3)
|
||||
self.treeview.append_column(column4)
|
||||
self.treeview.set_reorderable(True)
|
||||
self.treeview.expand_all()
|
||||
self.tree_selection = self.treeview.get_selection()
|
||||
self.tree_selection.set_mode(Gtk.SelectionMode.SINGLE)
|
||||
self.tree_selection.connect("changed", self.partition_selection)
|
||||
sw.add(self.treeview)
|
||||
sw.show()
|
||||
|
||||
box2 = Gtk.VBox(False, 10)
|
||||
box2.set_border_width(10)
|
||||
self.vbox1.pack_start(box2, True, True, 0)
|
||||
box2.show()
|
||||
box2.pack_start(sw, True, True, 0)
|
||||
|
||||
box2 = Gtk.HBox(False, 10)
|
||||
box2.set_border_width(0)
|
||||
self.vbox1.pack_start(box2, False, False, 0)
|
||||
box2.show()
|
||||
self.scheme = 'GPT'
|
||||
box2.pack_start(self.delete_create_button(),
|
||||
False, False, 10)
|
||||
return
|
||||
|
||||
def Tree_Store(self):
|
||||
self.store.clear()
|
||||
for disk in disk_query():
|
||||
shem = disk[-1]
|
||||
piter = self.store.append(None, [disk[0], str(disk[1]),
|
||||
disk[2], disk[3], True])
|
||||
if shem == "GPT":
|
||||
for pi in partition_query(disk[0]):
|
||||
self.store.append(piter, [pi[0], str(pi[1]), pi[2],
|
||||
pi[3], True])
|
||||
elif shem == "MBR":
|
||||
for pi in partition_query(disk[0]):
|
||||
piter1 = self.store.append(piter, [pi[0], str(pi[1]),
|
||||
pi[2], pi[3], True])
|
||||
if pi[0] == 'freespace':
|
||||
pass
|
||||
else:
|
||||
for li in label_query(pi[0]):
|
||||
self.store.append(piter1, [li[0], str(li[1]),
|
||||
li[2], li[3], True])
|
||||
return self.store
|
||||
|
||||
def get_model(self):
|
||||
self.tree_selection.select_path(0)
|
||||
return self.vbox1
|
||||
|
Before Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 2.1 MiB |
|
Before Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 2.1 MiB |
@@ -1,267 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk, Gdk, GLib
|
||||
import threading
|
||||
from time import sleep
|
||||
import sys
|
||||
|
||||
installer = "/usr/local/lib/gbinstall/"
|
||||
rcconfgbsd = "/etc/rc.conf.ghostbsd"
|
||||
rcconfdbsd = "/etc/rc.conf.desktopbsd"
|
||||
|
||||
sys.path.append(installer)
|
||||
cssProvider = Gtk.CssProvider()
|
||||
# if os.path.exists(rcconfgbsd):
|
||||
# print(True)
|
||||
cssProvider.load_from_path('/usr/local/lib/gbinstall/ghostbsd-style.css')
|
||||
# elif os.path.exists(rcconfdbsd):
|
||||
# cssProvider.load_from_path('/usr/local/lib/gbi/desktopbsd-style.css')
|
||||
screen = Gdk.Screen.get_default()
|
||||
styleContext = Gtk.StyleContext()
|
||||
styleContext.add_provider_for_screen(screen, cssProvider,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
|
||||
|
||||
|
||||
class gbsdSlides:
|
||||
def Welcome(self):
|
||||
vBox = Gtk.VBox(False, 0)
|
||||
vBox.show()
|
||||
label = Gtk.Label("Welcome to GhostBSD!", name="Header")
|
||||
label.set_property("height-request", 40)
|
||||
vBox.pack_start(label, False, False, 0)
|
||||
hBox = Gtk.HBox(False, 0, name="welcome")
|
||||
hBox.show()
|
||||
vBox.pack_end(hBox, True, True, 0)
|
||||
vBox2 = Gtk.VBox(False, 0)
|
||||
vBox2.show()
|
||||
label2 = Gtk.Label(name="slideText")
|
||||
label2.set_markup("Thank you for choosing GhostBSD. We hope you enjoy the BSD experience.\n\n"
|
||||
"We believe every computer operating system should be elegant, lightweight and secure. It should respect your privacy and give the user true freedom. GhostBSD makes FreeBSD desktop computing much easier.\n\n"
|
||||
"We want GhostBSD to work for you. So while your software is installing, this slideshow will introduce you to GhostBSD.")
|
||||
label2.set_justify(Gtk.Justification.LEFT)
|
||||
label2.set_line_wrap(True)
|
||||
# label2.set_max_width_chars(10)
|
||||
label2.set_alignment(0.0, 0.2)
|
||||
hBox2 = Gtk.HBox(False, 0, name="TransBox")
|
||||
hBox2.show()
|
||||
hBox.pack_start(hBox2, True, True, 0)
|
||||
hBox2.pack_start(label2, True, True, 30)
|
||||
label3 = Gtk.Label()
|
||||
hBox.pack_end(label3, True, True, 160)
|
||||
return vBox
|
||||
|
||||
def Software(self):
|
||||
vBox = Gtk.VBox(False, 0)
|
||||
vBox.show()
|
||||
label = Gtk.Label("Install more software ", name="Header")
|
||||
label.set_property("height-request", 40)
|
||||
vBox.pack_start(label, False, False, 0)
|
||||
hBox = Gtk.HBox(False, 0, name="software")
|
||||
hBox.show()
|
||||
vBox.pack_end(hBox, True, True, 0)
|
||||
label2 = Gtk.Label(name="slideText")
|
||||
label2.set_markup("Search, install, upgrade and uninstall software with the Software Station software manager.\n\n"
|
||||
"Software Station is a powerful tool to manage GhostBSD/FreeBSD software. It has a simple interface which consists of just 2 panels, a list of all available software packages including results of searches and a tab widget showing 6 useful tabs for information, files, transaction, output, news, and a quick help guide.\n\n"
|
||||
"There are over 25,000 software packages available to install.")
|
||||
label2.set_justify(Gtk.Justification.LEFT)
|
||||
label2.set_line_wrap(True)
|
||||
label2.set_alignment(0.1, 0.2)
|
||||
hBox2 = Gtk.HBox(False, 0, name="TransBox")
|
||||
hBox2.show()
|
||||
hBox.pack_start(hBox2, True, True, 0)
|
||||
hBox2.pack_start(label2, True, True, 30)
|
||||
label3 = Gtk.Label()
|
||||
hBox.pack_end(label3, True, True, 160)
|
||||
return vBox
|
||||
|
||||
def TheWeb(self):
|
||||
vBox = Gtk.VBox(False, 0)
|
||||
vBox.show()
|
||||
label = Gtk.Label("Make the most of the web", name="Header")
|
||||
label.set_property("height-request", 40)
|
||||
vBox.pack_start(label, False, False, 0)
|
||||
hBox = Gtk.HBox(False, 0, name="web")
|
||||
hBox.show()
|
||||
vBox.pack_end(hBox, True, True, 0)
|
||||
label2 = Gtk.Label(name="slideText")
|
||||
label2.set_markup("GhostBSD comes with Mozilla Firefox, the web browser used by millions of people around the world.\n\n"
|
||||
"Browse the web safely and privately, share your files, software and multimedia, send and receive e-mail and communicate with friends and family.\n\n"
|
||||
"Web browsers such as Chromium and Epiphany are easily installable.")
|
||||
label2.set_justify(Gtk.Justification.LEFT)
|
||||
label2.set_line_wrap(True)
|
||||
label2.set_alignment(0.1, 0.2)
|
||||
hBox2 = Gtk.HBox(False, 0, name="TransBox")
|
||||
hBox2.show()
|
||||
hBox.pack_start(hBox2, True, True, 0)
|
||||
hBox2.pack_start(label2, True, True, 30)
|
||||
label3 = Gtk.Label()
|
||||
hBox.pack_end(label3, True, True, 160)
|
||||
return vBox
|
||||
|
||||
def email(self):
|
||||
vBox = Gtk.VBox(False, 0)
|
||||
vBox.show()
|
||||
label = Gtk.Label("Make the most of the web", name="Header")
|
||||
label.set_property("height-request", 40)
|
||||
vBox.pack_start(label, False, False, 0)
|
||||
hBox = Gtk.HBox(False, 0, name="web")
|
||||
hBox.show()
|
||||
vBox.pack_end(hBox, True, True, 0)
|
||||
label2 = Gtk.Label(name="slideText")
|
||||
label2.set_markup("GhostBSD comes with Mozilla Firefox, the web browser used by millions of people around the world.\n\n"
|
||||
"Browse the web safely and privately, share your files, software and multimedia, send and receive e-mail and communicate with friends and family.\n\n"
|
||||
"Web browsers such as Chromium and Epiphany are easily installable.")
|
||||
label2.set_justify(Gtk.Justification.LEFT)
|
||||
label2.set_line_wrap(True)
|
||||
label2.set_alignment(0.1, 0.2)
|
||||
hBox2 = Gtk.HBox(False, 0, name="TransBox")
|
||||
hBox2.show()
|
||||
hBox.pack_start(hBox2, True, True, 0)
|
||||
hBox2.pack_start(label2, True, True, 30)
|
||||
label3 = Gtk.Label()
|
||||
hBox.pack_end(label3, True, True, 160)
|
||||
return vBox
|
||||
|
||||
def Photos(self):
|
||||
vBox = Gtk.VBox(False, 0)
|
||||
vBox.show()
|
||||
label = Gtk.Label(name="Header")
|
||||
label.set_markup('Organize, retouch and share your photos')
|
||||
label.set_property("height-request", 40)
|
||||
vBox.pack_start(label, False, False, 0)
|
||||
hBox = Gtk.HBox(False, 0, name="photo")
|
||||
hBox.show()
|
||||
vBox.pack_end(hBox, True, True, 0)
|
||||
label2 = Gtk.Label(name="slideText")
|
||||
label2.set_markup("With Shotwell it is really easy to organize and share your photos.\n\n"
|
||||
"Use the export option to copy your photos to a remote computer, iPod, a custom HTML gallery or to services such as Flickr, Facebook, PicasaWeb and more.\n\n"
|
||||
"For more advanced photos editing, Gimp is available for installation.")
|
||||
label2.set_justify(Gtk.Justification.LEFT)
|
||||
label2.set_line_wrap(True)
|
||||
label2.set_alignment(0.1, 0.2)
|
||||
hBox2 = Gtk.HBox(False, 0, name="TransBox")
|
||||
hBox2.show()
|
||||
hBox.pack_start(hBox2, True, True, 0)
|
||||
hBox2.pack_start(label2, True, True, 30)
|
||||
label3 = Gtk.Label()
|
||||
hBox.pack_end(label3, True, True, 160)
|
||||
return vBox
|
||||
|
||||
def MultiMedia(self):
|
||||
vBox = Gtk.VBox(False, 0)
|
||||
vBox.show()
|
||||
label = Gtk.Label("Play your movies and music", name="Header")
|
||||
label.set_property("height-request", 40)
|
||||
vBox.pack_start(label, False, False, 0)
|
||||
hBox = Gtk.HBox(False, 0, name="mutimedia")
|
||||
hBox.show()
|
||||
vBox.pack_end(hBox, True, True, 0)
|
||||
label2 = Gtk.Label(name="slideText")
|
||||
label2.set_markup("GhostBSD is ready to play videos and music from the web, CDs and DVDs.\n\n"
|
||||
"The Exaile audio player lets you organize your music and listen to Internet radio, podcasts and more, as well as synchronize your audio collection to a portable audio player.\n\n"
|
||||
"\nGnome MPlayer allows you to easily watch videos from your computer or DVD.")
|
||||
label2.set_justify(Gtk.Justification.LEFT)
|
||||
label2.set_line_wrap(True)
|
||||
label2.set_alignment(0.1, 0.2)
|
||||
hBox2 = Gtk.HBox(False, 0, name="TransBox")
|
||||
hBox2.show()
|
||||
hBox.pack_start(hBox2, True, True, 0)
|
||||
hBox2.pack_start(label2, True, True, 30)
|
||||
label3 = Gtk.Label()
|
||||
hBox.pack_end(label3, True, True, 160)
|
||||
return vBox
|
||||
|
||||
def communicate(self):
|
||||
vBox = Gtk.VBox(False, 0)
|
||||
vBox.show()
|
||||
label = Gtk.Label("Play your movies and music", name="Header")
|
||||
label.set_property("height-request", 40)
|
||||
vBox.pack_start(label, False, False, 0)
|
||||
hBox = Gtk.HBox(False, 0, name="communicate")
|
||||
hBox.show()
|
||||
vBox.pack_end(hBox, True, True, 0)
|
||||
label2 = Gtk.Label(name="slideText")
|
||||
label2.set_markup("GhostBSD is ready to play videos and music from the web, CDs and DVDs.\n\n"
|
||||
"The Exaile audio player lets you organize your music and listen to Internet radio, podcasts and more, as well as synchronize your audio collection to a portable audio player.\n\n"
|
||||
"\nGnome MPlayer allows you to easily watch videos from your computer or DVD.")
|
||||
label2.set_justify(Gtk.Justification.LEFT)
|
||||
label2.set_line_wrap(True)
|
||||
label2.set_alignment(0.1, 0.2)
|
||||
hBox2 = Gtk.HBox(False, 0, name="TransBox")
|
||||
hBox2.show()
|
||||
hBox.pack_start(hBox2, True, True, 0)
|
||||
hBox2.pack_start(label2, True, True, 30)
|
||||
label3 = Gtk.Label()
|
||||
hBox.pack_end(label3, True, True, 160)
|
||||
return vBox
|
||||
|
||||
def Help(self):
|
||||
vBox = Gtk.VBox(False, 0)
|
||||
vBox.show()
|
||||
label = Gtk.Label("Help & Support", name="Header")
|
||||
label.set_property("height-request", 40)
|
||||
vBox.pack_start(label, False, False, 0)
|
||||
hBox = Gtk.HBox(False, 0, name="help")
|
||||
hBox.show()
|
||||
vBox.pack_end(hBox, True, True, 0)
|
||||
label2 = Gtk.Label(name="slideText")
|
||||
label2.set_markup("Check out the forums for answers to all your GhostBSD questions.\n\n"
|
||||
"There's a good chance your question has already been answered and if not, you'll find volunteers eager to help.\n\n"
|
||||
"For more support options go to our <a href='http://www.ghostbsd.org/support'>support page</a>.")
|
||||
label2.set_justify(Gtk.Justification.LEFT)
|
||||
label2.set_line_wrap(True)
|
||||
label2.set_alignment(0.1, 0.2)
|
||||
hBox2 = Gtk.HBox(False, 0, name="TransBox")
|
||||
hBox2.show()
|
||||
hBox.pack_start(hBox2, True, True, 0)
|
||||
hBox2.pack_start(label2, True, True, 30)
|
||||
label3 = Gtk.Label()
|
||||
hBox.pack_end(label3, True, True, 160)
|
||||
return vBox
|
||||
|
||||
def SlideRight(self):
|
||||
if self.stack.get_visible_child() == self.welcome:
|
||||
self.stack.set_visible_child(self.software)
|
||||
elif self.stack.get_visible_child() == self.software:
|
||||
self.stack.set_visible_child(self.web)
|
||||
elif self.stack.get_visible_child() == self.web:
|
||||
self.stack.set_visible_child(self.photos)
|
||||
elif self.stack.get_visible_child() == self.photos:
|
||||
self.stack.set_visible_child(self.multimedia)
|
||||
elif self.stack.get_visible_child() == self.multimedia:
|
||||
self.stack.set_visible_child(self.help)
|
||||
elif self.stack.get_visible_child() == self.help:
|
||||
self.stack.set_visible_child(self.welcome)
|
||||
|
||||
def __init__(self):
|
||||
self.hBox = Gtk.HBox(False, 0)
|
||||
self.hBox.show()
|
||||
self.stack = Gtk.Stack()
|
||||
self.hBox.add(self.stack)
|
||||
# Adding slide self.grid in to stack
|
||||
self.welcome = self.Welcome()
|
||||
self.stack.add_named(self.welcome, "welcome")
|
||||
self.software = self.Software()
|
||||
self.stack.add_named(self.software, "software")
|
||||
self.web = self.TheWeb()
|
||||
self.stack.add_named(self.web, "web")
|
||||
self.photos = self.Photos()
|
||||
self.stack.add_named(self.photos, "photos")
|
||||
self.multimedia = self.MultiMedia()
|
||||
self.stack.add_named(self.multimedia, "multimedia")
|
||||
self.help = self.Help()
|
||||
self.stack.add_named(self.help, "help")
|
||||
self.stack.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT)
|
||||
self.stack.show()
|
||||
thr = threading.Thread(target=self.slidesThreading)
|
||||
thr.setDaemon(True)
|
||||
thr.start()
|
||||
|
||||
def get_slide(self):
|
||||
return self.hBox
|
||||
|
||||
def slidesThreading(self):
|
||||
while 1:
|
||||
sleep(60)
|
||||
GLib.idle_add(self.SlideRight)
|
||||
@@ -1,77 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
|
||||
def language_dictionary():
|
||||
langs = Popen('pc-sysinstall query-langs', shell=True, stdin=PIPE,
|
||||
stdout=PIPE, universal_newlines=True,
|
||||
close_fds=True).stdout.readlines()
|
||||
dictionary = {}
|
||||
for line in langs:
|
||||
lang_list = line.rstrip()
|
||||
lang_name = lang_list.partition(' ')[2]
|
||||
lang_code = lang_list.partition(' ')[0]
|
||||
dictionary[lang_name] = lang_code
|
||||
return dictionary
|
||||
|
||||
|
||||
def keyboard_dictionary():
|
||||
xkeyboard_layouts = Popen('pc-sysinstall xkeyboard-layouts', shell=True,
|
||||
stdout=PIPE,
|
||||
universal_newlines=True).stdout.readlines()
|
||||
dictionary = {}
|
||||
for line in xkeyboard_layouts:
|
||||
keyboard_list = list(filter(None, line.rstrip().split(' ')))
|
||||
kb_name = keyboard_list[1].strip()
|
||||
kb_layouts = keyboard_list[0].strip()
|
||||
kb_variant = None
|
||||
dictionary[kb_name] = {'layout': kb_layouts, 'variant': kb_variant}
|
||||
|
||||
xkeyboard_variants = Popen('pc-sysinstall xkeyboard-variants', shell=True,
|
||||
stdout=PIPE,
|
||||
universal_newlines=True).stdout.readlines()
|
||||
for line in xkeyboard_variants:
|
||||
xkb_variant = line.rstrip()
|
||||
kb_name = xkb_variant.partition(':')[2].strip()
|
||||
keyboard_list = list(filter
|
||||
(None, xkb_variant.partition(':')[0].split()))
|
||||
kb_layouts = keyboard_list[1].strip()
|
||||
kb_variant = keyboard_list[0].strip()
|
||||
dictionary[kb_name] = {'layout': kb_layouts, 'variant': kb_variant}
|
||||
return dictionary
|
||||
|
||||
|
||||
def keyboard_models():
|
||||
xkeyboard_models = Popen('pc-sysinstall xkeyboard-models', shell=True,
|
||||
stdout=PIPE,
|
||||
universal_newlines=True).stdout.readlines()
|
||||
dictionary = {}
|
||||
for line in xkeyboard_models:
|
||||
kbm_name = line.rstrip().partition(' ')[2]
|
||||
kbm_code = line.rstrip().partition(' ')[0]
|
||||
dictionary[kbm_name] = kbm_code
|
||||
return dictionary
|
||||
|
||||
|
||||
def timezone_dictionary():
|
||||
tz_list = Popen('pc-sysinstall list-tzones', shell=True,
|
||||
stdout=PIPE, universal_newlines=True).stdout.readlines()
|
||||
city_list = []
|
||||
dictionary = {}
|
||||
last_continent = ''
|
||||
for zone in tz_list:
|
||||
zone_list = zone.partition(':')[0].rstrip().split('/')
|
||||
continent = zone_list[0]
|
||||
if continent != last_continent:
|
||||
city_list = []
|
||||
if len(zone_list) == 3:
|
||||
city = zone_list[1] + '/' + zone_list[2]
|
||||
elif len(zone_list) == 4:
|
||||
city = zone_list[1] + '/' + zone_list[2] + '/' + zone_list[3]
|
||||
else:
|
||||
city = zone_list[1]
|
||||
city_list.append(city)
|
||||
dictionary[continent] = city_list
|
||||
last_continent = continent
|
||||
return dictionary
|
||||
@@ -1,532 +0,0 @@
|
||||
#!/usr/local/bin/python
|
||||
"""
|
||||
Copyright (c) 2014-2016, GhostBSD. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistribution's of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistribution's in binary form must reproduce the above
|
||||
copyright notice,this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
"""
|
||||
|
||||
from gi.repository import Gtk, Gdk
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
from subprocess import Popen, PIPE, STDOUT
|
||||
from db_partition import zfs_disk_query, zfs_disk_size_query, bios_or_uefi
|
||||
|
||||
# Folder use pr the installer.
|
||||
tmp = "/tmp/.gbinstall/"
|
||||
|
||||
if not os.path.exists(tmp):
|
||||
os.makedirs(tmp)
|
||||
|
||||
logo = "/usr/local/lib/gbinstall/logo.png"
|
||||
memory = 'sysctl hw.physmem'
|
||||
|
||||
Part_label = '%sufs_config' % tmp
|
||||
part_schem = '%sscheme' % tmp
|
||||
boot_file = '%sboot' % tmp
|
||||
|
||||
ufs_dsk_list = []
|
||||
|
||||
cssProvider = Gtk.CssProvider()
|
||||
# if os.path.exists(rcconfgbsd):
|
||||
# print(True)
|
||||
cssProvider.load_from_path('/usr/local/lib/gbinstall/ghostbsd-style.css')
|
||||
# elif os.path.exists(rcconfdbsd):
|
||||
# cssProvider.load_from_path('/usr/local/lib/gbi/desktopbsd-style.css')
|
||||
screen = Gdk.Screen.get_default()
|
||||
styleContext = Gtk.StyleContext()
|
||||
styleContext.add_provider_for_screen(screen, cssProvider,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
|
||||
|
||||
|
||||
# Find if pasword contain only lower case and number
|
||||
def lowerCase(strg, search=re.compile(r'[^a-z]').search):
|
||||
return not bool(search(strg))
|
||||
|
||||
|
||||
# Find if pasword contain only upper case
|
||||
def upperCase(strg, search=re.compile(r'[^A-Z]').search):
|
||||
return not bool(search(strg))
|
||||
|
||||
|
||||
# Find if pasword contain only lower case and number
|
||||
def lowerandNunber(strg, search=re.compile(r'[^a-z0-9]').search):
|
||||
return not bool(search(strg))
|
||||
|
||||
|
||||
# Find if pasword contain only upper case and number
|
||||
def upperandNunber(strg, search=re.compile(r'[^A-Z0-9]').search):
|
||||
return not bool(search(strg))
|
||||
|
||||
|
||||
# Find if pasword contain only lower and upper case and
|
||||
def lowerUpperCase(strg, search=re.compile(r'[^a-zA-Z]').search):
|
||||
return not bool(search(strg))
|
||||
|
||||
|
||||
# Find if pasword contain only lower and upper case and
|
||||
def lowerUpperNumber(strg, search=re.compile(r'[^a-zA-Z0-9]').search):
|
||||
return not bool(search(strg))
|
||||
|
||||
|
||||
# Find if pasword contain only lowercase, uppercase numbers and some special character.
|
||||
def allCharacter(strg, search=re.compile(r'[^a-zA-Z0-9~\!@#\$%\^&\*_\+":;\'\-]').search):
|
||||
return not bool(search(strg))
|
||||
|
||||
|
||||
class use_ufs():
|
||||
def save_selection(self):
|
||||
disk_size = int(ufs_dsk_list[0].partition('-')[2].rstrip()) - 2
|
||||
swap_size = int(self.swap_entry.get_text())
|
||||
root_size = disk_size - swap_size
|
||||
if self.disk_encript is True:
|
||||
dgeli = '.eli'
|
||||
else:
|
||||
dgeli = ''
|
||||
pfile = open(Part_label, 'w')
|
||||
pfile.writelines('disk0=%s\n' % ufs_dsk_list[0].partition('-')[0].rstrip())
|
||||
if self.mirror is True:
|
||||
ufs_disk = ufs_dsk_list
|
||||
disk_len = len(ufs_disk) - 1
|
||||
num = 1
|
||||
mirror_dsk = ''
|
||||
while disk_len != 0:
|
||||
mirror_dsk += ufs_disk[num].partition('-')[0].rstrip() + " "
|
||||
print(mirror_dsk)
|
||||
num += 1
|
||||
disk_len -= 1
|
||||
pfile.writelines("mirror=%s\n" % mirror_dsk)
|
||||
pfile.writelines("mirrorlab=%s\n" % self.mirrorbl)
|
||||
else:
|
||||
pfile.writelines("#mirror=\n")
|
||||
pfile.writelines("#mirrorlab=\n")
|
||||
pfile.writelines('partition=ALL\n')
|
||||
pfile.writelines('partscheme=%s\n' % self.scheme)
|
||||
pfile.writelines('commitDiskPart\n\n')
|
||||
if bios_or_uefi() == "UEFI":
|
||||
root_size = root_size - 100
|
||||
else:
|
||||
root_size = root_size - 1
|
||||
zfsPart = 'disk0-part=%s%s %s /\n' % (self.fs, dgeli, root_size)
|
||||
pfile.writelines(zfsPart)
|
||||
if swap_size != 0:
|
||||
pfile.writelines('disk0-part=SWAP%s %s none\n' % (dgeli, swap_size))
|
||||
if self.disk_encript is True:
|
||||
pfile.writelines('encpass=%s\n' % self.password.get_text())
|
||||
else:
|
||||
pfile.writelines('#encpass=None\n')
|
||||
pfile.writelines('commitDiskLabel\n')
|
||||
pfile.close()
|
||||
|
||||
def sheme_selection(self, combobox):
|
||||
model = combobox.get_model()
|
||||
index = combobox.get_active()
|
||||
data = model[index][0]
|
||||
self.scheme = data
|
||||
|
||||
def mirror_selection(self, combobox):
|
||||
model = combobox.get_model()
|
||||
index = combobox.get_active()
|
||||
data = model[index][0]
|
||||
self.mirrorbl = data
|
||||
|
||||
def on_check_mirror(self, widget):
|
||||
if widget.get_active():
|
||||
self.mirrorbl_box.set_sensitive(True)
|
||||
self.mirror = True
|
||||
else:
|
||||
self.mirrorbl_box.set_sensitive(False)
|
||||
self.mirror = False
|
||||
if self.mirror is False:
|
||||
self.mirrorTips.set_text("Please select one drive")
|
||||
if len(ufs_dsk_list) != 1:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(True)
|
||||
elif self.mirror is True:
|
||||
self.mirrorTips.set_text("Please select 2 drive for mirroring")
|
||||
if len(ufs_dsk_list) > 1:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
|
||||
def on_check(self, widget):
|
||||
if widget.get_active():
|
||||
self.zfs_four_k = True
|
||||
else:
|
||||
self.zfs_four_k = False
|
||||
|
||||
def on_check_encrypt(self, widget):
|
||||
if widget.get_active():
|
||||
self.password.set_sensitive(True)
|
||||
self.repassword.set_sensitive(True)
|
||||
self.disk_encript = True
|
||||
# self.swap_encrypt_check.set_active(True)
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.password.set_sensitive(False)
|
||||
self.repassword.set_sensitive(False)
|
||||
self.disk_encript = False
|
||||
# self.swap_encrypt_check.set_active(False)
|
||||
if self.mirror is False:
|
||||
if len(ufs_dsk_list) != 1:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(True)
|
||||
elif self.mirror is True:
|
||||
if len(ufs_dsk_list) > 1:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
|
||||
def on_check_swap_encrypt(self, widget):
|
||||
if widget.get_active():
|
||||
self.swap_encrypt = True
|
||||
else:
|
||||
self.swap_encrypt = False
|
||||
|
||||
def on_check_swap_mirror(self, widget):
|
||||
if widget.get_active():
|
||||
self.swap_mirror = True
|
||||
else:
|
||||
self.swap_mirror = False
|
||||
|
||||
def chosefs(self, combobox):
|
||||
model = combobox.get_model()
|
||||
index = combobox.get_active()
|
||||
data = model[index][0]
|
||||
self.fs = data
|
||||
|
||||
def __init__(self, button3):
|
||||
self.button3 = button3
|
||||
self.vbox1 = Gtk.VBox(False, 0)
|
||||
self.vbox1.show()
|
||||
# Title
|
||||
label = Gtk.Label("UFS Full Disk Configuration", name="Header")
|
||||
label.set_property("height-request", 40)
|
||||
self.vbox1.pack_start(label, False, False, 0)
|
||||
# Chose disk
|
||||
sw = Gtk.ScrolledWindow(hexpand=True, vexpand=True)
|
||||
sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
|
||||
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||
store = Gtk.TreeStore(str, str, str, 'gboolean')
|
||||
for disk in zfs_disk_query():
|
||||
dsk = disk.partition(':')[0].rstrip()
|
||||
dsk_name = disk.partition(':')[2].rstrip()
|
||||
dsk_size = zfs_disk_size_query(dsk).rstrip()
|
||||
store.append(None, [dsk, dsk_size, dsk_name, False])
|
||||
treeView = Gtk.TreeView(store)
|
||||
treeView.set_model(store)
|
||||
treeView.set_rules_hint(True)
|
||||
self.check_cell = Gtk.CellRendererToggle()
|
||||
self.check_cell.set_property('activatable', True)
|
||||
self.check_cell.connect('toggled', self.col1_toggled_cb, store)
|
||||
cell = Gtk.CellRendererText()
|
||||
column = Gtk.TreeViewColumn(None, cell, text=0)
|
||||
column_header = Gtk.Label('Disk')
|
||||
column_header.set_use_markup(True)
|
||||
column_header.show()
|
||||
column.set_widget(column_header)
|
||||
column.set_sort_column_id(0)
|
||||
cell2 = Gtk.CellRendererText()
|
||||
column2 = Gtk.TreeViewColumn(None, cell2, text=0)
|
||||
column_header2 = Gtk.Label('Size(MB)')
|
||||
column_header2.set_use_markup(True)
|
||||
column_header2.show()
|
||||
column2.set_widget(column_header2)
|
||||
cell3 = Gtk.CellRendererText()
|
||||
column3 = Gtk.TreeViewColumn(None, cell3, text=0)
|
||||
column_header3 = Gtk.Label('Name')
|
||||
column_header3.set_use_markup(True)
|
||||
column_header3.show()
|
||||
column3.set_widget(column_header3)
|
||||
column1 = Gtk.TreeViewColumn("Check", self.check_cell)
|
||||
column1.add_attribute(self.check_cell, "active", 3)
|
||||
column.set_attributes(cell, text=0)
|
||||
column2.set_attributes(cell2, text=1)
|
||||
column3.set_attributes(cell3, text=2)
|
||||
treeView.append_column(column1)
|
||||
treeView.append_column(column)
|
||||
treeView.append_column(column2)
|
||||
treeView.append_column(column3)
|
||||
tree_selection = treeView.get_selection()
|
||||
tree_selection.set_mode(Gtk.SelectionMode.SINGLE)
|
||||
sw.add(treeView)
|
||||
sw.show()
|
||||
self.mirrorTips = Gtk.Label('Please select one drive')
|
||||
self.mirrorTips.set_justify(Gtk.Justification.LEFT)
|
||||
self.mirrorTips.set_alignment(0.01, 0.5)
|
||||
self.mirror = False
|
||||
mirror_check = Gtk.CheckButton('Disk Mirror')
|
||||
mirror_check.connect("toggled", self.on_check_mirror)
|
||||
self.mirrorbl_box = Gtk.ComboBoxText()
|
||||
self.mirrorbl_box.append_text("load")
|
||||
self.mirrorbl_box.append_text("prefer")
|
||||
self.mirrorbl_box.append_text("round-robin")
|
||||
self.mirrorbl_box.append_text("split")
|
||||
self.mirrorbl_box.connect('changed', self.mirror_selection)
|
||||
self.mirrorbl_box.set_active(0)
|
||||
self.mirrorbl_box.set_sensitive(False)
|
||||
self.mirrorbl = 'load'
|
||||
# Creating MBR or GPT drive
|
||||
label = Gtk.Label('<b>Partition Scheme</b>')
|
||||
label.set_use_markup(True)
|
||||
# Adding a combo box to selecting MBR or GPT sheme.
|
||||
self.scheme = 'GPT'
|
||||
shemebox = Gtk.ComboBoxText()
|
||||
shemebox.append_text("GPT")
|
||||
shemebox.append_text("MBR")
|
||||
shemebox.connect('changed', self.sheme_selection)
|
||||
shemebox.set_active(0)
|
||||
if bios_or_uefi() == "UEFI":
|
||||
shemebox.set_sensitive(False)
|
||||
else:
|
||||
shemebox.set_sensitive(True)
|
||||
# Swap Size
|
||||
ram = Popen(memory, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT,
|
||||
universal_newlines=True, close_fds=True)
|
||||
mem = ram.stdout.read()
|
||||
swap = 512
|
||||
swp_size_label = Gtk.Label('<b>Swap Size(MB)</b>')
|
||||
swp_size_label.set_use_markup(True)
|
||||
self.swap_entry = Gtk.Entry()
|
||||
self.swap_entry.set_text(str(swap))
|
||||
self.swap_entry.connect('changed', self.digit_only)
|
||||
# Swap encription
|
||||
self.swap_encrypt = False
|
||||
self.swap_encrypt_check = Gtk.CheckButton("Encrypt Swap")
|
||||
self.swap_encrypt_check.connect("toggled", self.on_check_swap_encrypt)
|
||||
# Swap mirror
|
||||
self.swap_mirror = False
|
||||
swap_mirror_check = Gtk.CheckButton("Mirror Swap")
|
||||
swap_mirror_check.connect("toggled", self.on_check_swap_mirror)
|
||||
# GELI Disk encription
|
||||
self.disk_encript = False
|
||||
encrypt_check = Gtk.CheckButton("Encrypt Disk")
|
||||
encrypt_check.connect("toggled", self.on_check_encrypt)
|
||||
encrypt_check.set_sensitive(True)
|
||||
# password
|
||||
self.passwd_label = Gtk.Label("Password")
|
||||
self.password = Gtk.Entry()
|
||||
self.password.set_sensitive(False)
|
||||
self.password.set_visibility(False)
|
||||
self.password.connect("changed", self.passwdstrength)
|
||||
self.strenght_label = Gtk.Label()
|
||||
self.strenght_label.set_alignment(0.1, 0.5)
|
||||
self.vpasswd_label = Gtk.Label("Verify it")
|
||||
self.repassword = Gtk.Entry()
|
||||
self.repassword.set_sensitive(False)
|
||||
self.repassword.set_visibility(False)
|
||||
self.repassword.connect("changed", self.passwdVerification)
|
||||
# set image for password matching
|
||||
fslabel = Gtk.Label("File System:")
|
||||
self.fstype = Gtk.ComboBoxText()
|
||||
self.fstype.append_text('UFS')
|
||||
self.fstype.append_text('UFS+S')
|
||||
self.fstype.append_text('UFS+J')
|
||||
self.fstype.append_text('UFS+SUJ')
|
||||
self.fstype.set_active(3)
|
||||
self.fstype.connect("changed", self.chosefs)
|
||||
self.fs = "UFS+SUJ"
|
||||
grid = Gtk.Grid()
|
||||
grid.set_row_spacing(10)
|
||||
grid.set_margin_left(10)
|
||||
grid.set_margin_right(10)
|
||||
grid.set_margin_top(10)
|
||||
grid.set_margin_bottom(10)
|
||||
# grid.set_column_homogeneous(True)
|
||||
# grid.set_row_homogeneous(True)
|
||||
# grid.attach(Title, 0, 0, 9, 2)
|
||||
grid.attach(mirror_check, 0, 2, 1, 1)
|
||||
grid.attach(self.mirrorbl_box, 1, 2, 1, 1)
|
||||
grid.attach(label, 0, 9, 2, 1)
|
||||
grid.attach(shemebox, 2, 9, 1, 1)
|
||||
grid.attach(self.mirrorTips, 1, 3, 8, 1)
|
||||
grid.attach(sw, 0, 4, 9, 4)
|
||||
grid.attach(fslabel, 5, 9, 2, 1)
|
||||
grid.attach(self.fstype, 7, 9, 1, 1)
|
||||
grid.attach(swp_size_label, 5, 2, 2, 1)
|
||||
grid.attach(self.swap_entry, 7, 2, 1, 1)
|
||||
# grid.attach(self.swap_encrypt_check, 9, 15, 11, 12)
|
||||
# grid.attach(swap_mirror_check, 9, 15, 11, 12)
|
||||
# grid.attach(encrypt_check, 1, 9, 2, 1)
|
||||
# grid.attach(self.passwd_label, 1, 10, 1, 1)
|
||||
# grid.attach(self.password, 2, 10, 2, 1)
|
||||
# grid.attach(self.strenght_label, 4, 10, 2, 1)
|
||||
# grid.attach(self.vpasswd_label, 1, 11, 1, 1)
|
||||
# grid.attach(self.repassword, 2, 11, 2, 1)
|
||||
# grid.attach(self.img, 4, 11, 2, 1)
|
||||
self.vbox1.pack_start(grid, True, True, 0)
|
||||
return
|
||||
|
||||
def get_model(self):
|
||||
del ufs_dsk_list[:]
|
||||
return self.vbox1
|
||||
|
||||
def digit_only(self, *args):
|
||||
text = self.swap_entry.get_text().strip()
|
||||
self.swap_entry.set_text(''.join([i for i in text if i in '0123456789']))
|
||||
|
||||
def col1_toggled_cb(self, cell, path, model):
|
||||
model[path][3] = not model[path][3]
|
||||
if model[path][3] is False:
|
||||
ufs_dsk_list.remove(model[path][0] + "-" + model[path][1])
|
||||
if self.mirror is False:
|
||||
if len(ufs_dsk_list) != 1:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(True)
|
||||
elif self.mirror is True:
|
||||
if len(ufs_dsk_list) > 1:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
ufs_dsk_list.extend([model[path][0] + "-" + model[path][1]])
|
||||
if self.mirror is False:
|
||||
if len(ufs_dsk_list) != 1:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(True)
|
||||
elif self.mirror is True:
|
||||
if len(ufs_dsk_list) > 1:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
print(ufs_dsk_list)
|
||||
return
|
||||
|
||||
def passwdstrength(self, widget):
|
||||
passwd = self.password.get_text()
|
||||
if len(passwd) <= 4:
|
||||
self.strenght_label.set_text("Super Weak")
|
||||
elif len(passwd) <= 8:
|
||||
if lowerCase(passwd) or upperCase(passwd) or passwd.isdigit():
|
||||
self.strenght_label.set_text("Super Weak")
|
||||
elif lowerandNunber(passwd):
|
||||
self.strenght_label.set_text("Very Weak")
|
||||
elif upperandNunber(passwd):
|
||||
self.strenght_label.set_text("Very Weak")
|
||||
elif lowerUpperCase(passwd):
|
||||
self.strenght_label.set_text("Very Weak")
|
||||
elif lowerUpperNumber(passwd):
|
||||
self.strenght_label.set_text("Fairly Weak")
|
||||
elif allCharacter(passwd):
|
||||
self.strenght_label.set_text("Weak")
|
||||
elif len(passwd) <= 12:
|
||||
if lowerCase(passwd) or upperCase(passwd) or passwd.isdigit():
|
||||
self.strenght_label.set_text("Very Weak")
|
||||
elif lowerandNunber(passwd):
|
||||
self.strenght_label.set_text("Fairly Weak")
|
||||
elif upperandNunber(passwd):
|
||||
self.strenght_label.set_text("Fairly Weak")
|
||||
elif lowerUpperCase(passwd):
|
||||
self.strenght_label.set_text("Fairly Weak")
|
||||
elif lowerUpperNumber(passwd):
|
||||
self.strenght_label.set_text("Weak")
|
||||
elif allCharacter(passwd):
|
||||
self.strenght_label.set_text("Strong")
|
||||
elif len(passwd) <= 16:
|
||||
if lowerCase(passwd) or upperCase(passwd) or passwd.isdigit():
|
||||
self.strenght_label.set_text("Fairly Weak")
|
||||
elif lowerandNunber(passwd):
|
||||
self.strenght_label.set_text("Weak")
|
||||
elif upperandNunber(passwd):
|
||||
self.strenght_label.set_text("Weak")
|
||||
elif lowerUpperCase(passwd):
|
||||
self.strenght_label.set_text("Weak")
|
||||
elif lowerUpperNumber(passwd):
|
||||
self.strenght_label.set_text("Strong")
|
||||
elif allCharacter(passwd):
|
||||
self.strenght_label.set_text("Fairly Strong")
|
||||
elif len(passwd) <= 20:
|
||||
if lowerCase(passwd) or upperCase(passwd) or passwd.isdigit():
|
||||
self.strenght_label.set_text("Weak")
|
||||
elif lowerandNunber(passwd):
|
||||
self.strenght_label.set_text("Strong")
|
||||
elif upperandNunber(passwd):
|
||||
self.strenght_label.set_text("Strong")
|
||||
elif lowerUpperCase(passwd):
|
||||
self.strenght_label.set_text("Strong")
|
||||
elif lowerUpperNumber(passwd):
|
||||
self.strenght_label.set_text("Fairly Strong")
|
||||
elif allCharacter(passwd):
|
||||
self.strenght_label.set_text("Very Strong")
|
||||
elif len(passwd) <= 24:
|
||||
if lowerCase(passwd) or upperCase(passwd) or passwd.isdigit():
|
||||
self.strenght_label.set_text("Strong")
|
||||
elif lowerandNunber(passwd):
|
||||
self.strenght_label.set_text("Fairly Strong")
|
||||
elif upperandNunber(passwd):
|
||||
self.strenght_label.set_text("Fairly Strong")
|
||||
elif lowerUpperCase(passwd):
|
||||
self.strenght_label.set_text("Fairly Strong")
|
||||
elif lowerUpperNumber(passwd):
|
||||
self.strenght_label.set_text("Very Strong")
|
||||
elif allCharacter(passwd):
|
||||
self.strenght_label.set_text("Super Strong")
|
||||
elif len(passwd) > 24:
|
||||
if lowerCase(passwd) or upperCase(passwd) or passwd.isdigit():
|
||||
self.strenght_label.set_text("Fairly Strong")
|
||||
else:
|
||||
self.strenght_label.set_text("Super Strong")
|
||||
|
||||
def passwdVerification(self, widget):
|
||||
if self.password.get_text() == self.repassword.get_text():
|
||||
self.img.set_from_stock(Gtk.STOCK_YES, 5)
|
||||
if self.mirror == "single disk":
|
||||
if len(zfs_dsk_list) != 1:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(True)
|
||||
elif self.mirror == "2 disk mirror":
|
||||
if len(zfs_dsk_list) == 2:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "3 disk raidz1":
|
||||
if len(zfs_dsk_list) == 3:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "4 disk raidz2":
|
||||
if len(zfs_dsk_list) == 4:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "5 disk raidz3":
|
||||
if len(zfs_dsk_list) == 5:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "2+ disk stripe":
|
||||
if len(zfs_dsk_list) >= 2:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.img.set_from_stock(Gtk.STOCK_NO, 5)
|
||||
self.button3.set_sensitive(False)
|
||||
@@ -1,702 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Copyright (c) 2014-2016, GhostBSD. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistribution's of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistribution's in binary form must reproduce the above
|
||||
copyright notice,this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
"""
|
||||
|
||||
from gi.repository import Gtk, Gdk
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
from subprocess import Popen, PIPE, STDOUT
|
||||
from db_partition import zfs_disk_query, zfs_disk_size_query, bios_or_uefi
|
||||
|
||||
# Folder use pr the installer.
|
||||
tmp = "/tmp/.gbinstall/"
|
||||
installer = "/usr/local/lib/gbinstall/"
|
||||
query = "sh /usr/local/lib/gbinstall/backend-query/"
|
||||
if not os.path.exists(tmp):
|
||||
os.makedirs(tmp)
|
||||
|
||||
logo = "/usr/local/lib/gbinstall/logo.png"
|
||||
memory = 'sysctl hw.physmem'
|
||||
auto = '%sauto' % tmp
|
||||
disk_info = '%sdisk-info.sh' % query
|
||||
disk_file = '%sdisk' % tmp
|
||||
dslice = '%sslice' % tmp
|
||||
Part_label = '%szfs_config' % tmp
|
||||
part_schem = '%sscheme' % tmp
|
||||
boot_file = '%sboot' % tmp
|
||||
|
||||
global zfs_dsk_list
|
||||
zfs_dsk_list = []
|
||||
|
||||
|
||||
cssProvider = Gtk.CssProvider()
|
||||
# if os.path.exists(rcconfgbsd):
|
||||
# print(True)
|
||||
cssProvider.load_from_path('/usr/local/lib/gbinstall/ghostbsd-style.css')
|
||||
# elif os.path.exists(rcconfdbsd):
|
||||
# cssProvider.load_from_path('/usr/local/lib/gbi/desktopbsd-style.css')
|
||||
screen = Gdk.Screen.get_default()
|
||||
styleContext = Gtk.StyleContext()
|
||||
styleContext.add_provider_for_screen(screen, cssProvider,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
|
||||
|
||||
|
||||
# Find if pasword contain only lower case and number
|
||||
def lowerCase(strg, search=re.compile(r'[^a-z]').search):
|
||||
return not bool(search(strg))
|
||||
|
||||
|
||||
# Find if pasword contain only upper case
|
||||
def upperCase(strg, search=re.compile(r'[^A-Z]').search):
|
||||
return not bool(search(strg))
|
||||
|
||||
|
||||
# Find if pasword contain only lower case and number
|
||||
def lowerandNunber(strg, search=re.compile(r'[^a-z0-9]').search):
|
||||
return not bool(search(strg))
|
||||
|
||||
|
||||
# Find if pasword contain only upper case and number
|
||||
def upperandNunber(strg, search=re.compile(r'[^A-Z0-9]').search):
|
||||
return not bool(search(strg))
|
||||
|
||||
|
||||
# Find if pasword contain only lower and upper case and
|
||||
def lowerUpperCase(strg, search=re.compile(r'[^a-zA-Z]').search):
|
||||
return not bool(search(strg))
|
||||
|
||||
|
||||
# Find if pasword contain only lower and upper case and
|
||||
def lowerUpperNumber(strg, search=re.compile(r'[^a-zA-Z0-9]').search):
|
||||
return not bool(search(strg))
|
||||
|
||||
|
||||
# Find if pasword contain only lowercase, uppercase numbers
|
||||
# and some special character.
|
||||
def allCharacter(strg, search=re.compile(r'[^a-zA-Z0-9~\!@#\$%\^&\*_\+":;\'\-]').search):
|
||||
return not bool(search(strg))
|
||||
|
||||
|
||||
class ZFS():
|
||||
def save_selection(self):
|
||||
SIZE = int(zfs_dsk_list[0].partition('-')[2].rstrip()) - 2
|
||||
SWAP = int(self.swap_entry.get_text())
|
||||
ZFS_NUM = SIZE - SWAP
|
||||
if self.disk_encript is True:
|
||||
dgeli = '.eli'
|
||||
else:
|
||||
dgeli = ''
|
||||
pfile = open(Part_label, 'w')
|
||||
if self.zpool is True:
|
||||
pfile.writelines("zpoolName=%s\n" % self.pool.get_text())
|
||||
else:
|
||||
pfile.writelines("#zpoolName=None\n")
|
||||
if self.zfs_four_k is True:
|
||||
pfile.writelines('zfsForce4k=YES\n\n')
|
||||
else:
|
||||
pfile.writelines('#zfsForce4k=No\n\n')
|
||||
pfile.writelines('disk0=%s\n' % zfs_dsk_list[0].partition('-')[0].rstrip())
|
||||
pfile.writelines('partition=ALL\n')
|
||||
pfile.writelines('partscheme=%s\n' % self.scheme)
|
||||
pfile.writelines('commitDiskPart\n\n')
|
||||
if self.poolType == 'none':
|
||||
pool_disk = '\n'
|
||||
else:
|
||||
ZFS_disk = zfs_dsk_list
|
||||
disk_len = len(ZFS_disk) - 1
|
||||
num = 1
|
||||
mirror_dsk = ''
|
||||
while disk_len != 0:
|
||||
mirror_dsk += ' ' + ZFS_disk[num].partition('-')[0].rstrip()
|
||||
print(mirror_dsk)
|
||||
num += 1
|
||||
disk_len -= 1
|
||||
pool_disk = ' (%s:%s)\n' % (self.poolType, mirror_dsk)
|
||||
if bios_or_uefi() == "UEFI":
|
||||
ZFS_NUM = ZFS_NUM - 100
|
||||
else:
|
||||
ZFS_NUM = ZFS_NUM - 1
|
||||
zfslayout = "/(compress=lz4|atime=off),/root(compress=lz4)," \
|
||||
"/tmp(compress=lz4),/usr(canmount=off|mountpoint=none)," \
|
||||
"/usr/home(compress=lz4),/usr/jails(compress=lz4)," \
|
||||
"/usr/obj(compress=lz4),/usr/ports(compress=lz4)," \
|
||||
"/usr/src(compress=lz4)," \
|
||||
"/var(canmount=off|atime=on|mountpoint=none)," \
|
||||
"/var/audit(compress=lz4),/var/log(compress=lz4)," \
|
||||
"/var/mail(compress=lz4),/var/tmp(compress=lz4)"
|
||||
zfsPart = 'disk0-part=ZFS%s %s %s%s' % (dgeli, ZFS_NUM, zfslayout,
|
||||
pool_disk)
|
||||
pfile.writelines(zfsPart)
|
||||
if SWAP != 0:
|
||||
pfile.writelines('disk0-part=SWAP%s %s none\n' % ('', SWAP))
|
||||
if self.disk_encript is True:
|
||||
pfile.writelines('encpass=%s\n' % self.password.get_text())
|
||||
else:
|
||||
pfile.writelines('#encpass=None\n')
|
||||
pfile.writelines('commitDiskLabel\n')
|
||||
pfile.close()
|
||||
|
||||
def sheme_selection(self, combobox):
|
||||
model = combobox.get_model()
|
||||
index = combobox.get_active()
|
||||
data = model[index][0]
|
||||
self.scheme = data.partition(':')[0]
|
||||
|
||||
def mirror_selection(self, combobox):
|
||||
model = combobox.get_model()
|
||||
index = combobox.get_active()
|
||||
mirror_mesage = " (select the smallest disk first)"
|
||||
data = model[index][0]
|
||||
self.mirror = data
|
||||
if self.mirror == "single disk":
|
||||
self.poolType = 'none'
|
||||
self.mirrorTips.set_text("Please select one drive")
|
||||
if len(zfs_dsk_list) != 1:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(True)
|
||||
elif self.mirror == "2 disk mirror":
|
||||
self.poolType = 'mirror'
|
||||
mir_msg1 = f"Please select 2 drive for mirroring{mirror_mesage}"
|
||||
self.mirrorTips.set_text(mir_msg1)
|
||||
if len(zfs_dsk_list) == 2:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "3 disk raidz1":
|
||||
self.poolType = 'raidz1'
|
||||
self.mirrorTips.set_text("Please select 3 drive for raidz1" + mirror_mesage)
|
||||
if len(zfs_dsk_list) == 3:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "4 disk raidz2":
|
||||
self.poolType = 'raidz2'
|
||||
self.mirrorTips.set_text("Please select 4 drive for raidz2" + mirror_mesage)
|
||||
if len(zfs_dsk_list) == 4:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "5 disk raidz3":
|
||||
self.poolType = 'raidz3'
|
||||
self.mirrorTips.set_text("Please select 5 drive for raidz3" + mirror_mesage)
|
||||
if len(zfs_dsk_list) == 5:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "2+ disk stripe":
|
||||
self.poolType = 'stripe'
|
||||
self.mirrorTips.set_text("Please select 2 or more drive for stripe" + mirror_mesage)
|
||||
if len(zfs_dsk_list) >= 2:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
|
||||
def on_check_poll(self, widget):
|
||||
if widget.get_active():
|
||||
self.pool.set_sensitive(True)
|
||||
self.zpool = True
|
||||
else:
|
||||
self.pool.set_sensitive(False)
|
||||
self.zpool = False
|
||||
|
||||
def on_check(self, widget):
|
||||
if widget.get_active():
|
||||
self.zfs_four_k = True
|
||||
else:
|
||||
self.zfs_four_k = False
|
||||
|
||||
def on_check_encrypt(self, widget):
|
||||
if widget.get_active():
|
||||
self.password.set_sensitive(True)
|
||||
self.repassword.set_sensitive(True)
|
||||
self.disk_encript = True
|
||||
# self.swap_encrypt_check.set_active(True)
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.password.set_sensitive(False)
|
||||
self.repassword.set_sensitive(False)
|
||||
self.disk_encript = False
|
||||
# self.swap_encrypt_check.set_active(False)
|
||||
if self.mirror == "single disk":
|
||||
if len(zfs_dsk_list) != 1:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(True)
|
||||
elif self.mirror == "2 disk mirror":
|
||||
if len(zfs_dsk_list) == 2:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "3 disk raidz1":
|
||||
if len(zfs_dsk_list) == 3:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "4 disk raidz2":
|
||||
if len(zfs_dsk_list) == 4:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "5 disk raidz3":
|
||||
if len(zfs_dsk_list) == 5:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "2+ disk stripe":
|
||||
if len(zfs_dsk_list) >= 2:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
|
||||
def on_check_swap_encrypt(self, widget):
|
||||
if widget.get_active():
|
||||
self.swap_encrypt = True
|
||||
else:
|
||||
self.swap_encrypt = False
|
||||
|
||||
def on_check_swap_mirror(self, widget):
|
||||
if widget.get_active():
|
||||
self.swap_mirror = True
|
||||
else:
|
||||
self.swap_mirror = False
|
||||
|
||||
def __init__(self, button3):
|
||||
self.button3 = button3
|
||||
self.vbox1 = Gtk.VBox(False, 0)
|
||||
self.vbox1.show()
|
||||
# Title
|
||||
label = Gtk.Label("ZFS Full Disk Configuration", name="Header")
|
||||
label.set_property("height-request", 40)
|
||||
self.vbox1.pack_start(label, False, False, 0)
|
||||
# Chose disk
|
||||
sw = Gtk.ScrolledWindow(hexpand=True, vexpand=True)
|
||||
sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
|
||||
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||
self.store = Gtk.TreeStore(str, str, str, 'gboolean')
|
||||
for disk in zfs_disk_query():
|
||||
dsk = disk.partition(':')[0].rstrip()
|
||||
dsk_name = disk.partition(':')[2].rstrip()
|
||||
dsk_size = zfs_disk_size_query(dsk).rstrip()
|
||||
self.store.append(None, [dsk, dsk_size, dsk_name, False])
|
||||
treeView = Gtk.TreeView(self.store)
|
||||
treeView.set_model(self.store)
|
||||
treeView.set_rules_hint(True)
|
||||
self.check_cell = Gtk.CellRendererToggle()
|
||||
self.check_cell.set_property('activatable', True)
|
||||
self.check_cell.connect('toggled', self.col1_toggled_cb, self.store)
|
||||
cell = Gtk.CellRendererText()
|
||||
column = Gtk.TreeViewColumn(None, cell, text=0)
|
||||
column_header = Gtk.Label('Disk')
|
||||
column_header.set_use_markup(True)
|
||||
column_header.show()
|
||||
column.set_widget(column_header)
|
||||
column.set_sort_column_id(0)
|
||||
cell2 = Gtk.CellRendererText()
|
||||
column2 = Gtk.TreeViewColumn(None, cell2, text=0)
|
||||
column_header2 = Gtk.Label('Size(MB)')
|
||||
column_header2.set_use_markup(True)
|
||||
column_header2.show()
|
||||
column2.set_widget(column_header2)
|
||||
cell3 = Gtk.CellRendererText()
|
||||
column3 = Gtk.TreeViewColumn(None, cell3, text=0)
|
||||
column_header3 = Gtk.Label('Name')
|
||||
column_header3.set_use_markup(True)
|
||||
column_header3.show()
|
||||
column3.set_widget(column_header3)
|
||||
column1 = Gtk.TreeViewColumn("Check", self.check_cell)
|
||||
column1.add_attribute(self.check_cell, "active", 3)
|
||||
column.set_attributes(cell, text=0)
|
||||
column2.set_attributes(cell2, text=1)
|
||||
column3.set_attributes(cell3, text=2)
|
||||
treeView.append_column(column1)
|
||||
treeView.append_column(column)
|
||||
treeView.append_column(column2)
|
||||
treeView.append_column(column3)
|
||||
tree_selection = treeView.get_selection()
|
||||
tree_selection.set_mode(Gtk.SelectionMode.SINGLE)
|
||||
sw.add(treeView)
|
||||
sw.show()
|
||||
self.mirrorTips = Gtk.Label('Please select one drive')
|
||||
self.mirrorTips.set_justify(Gtk.Justification.LEFT)
|
||||
self.mirrorTips.set_alignment(0.01, 0.5)
|
||||
# Mirro, raidz and stripe
|
||||
self.mirror = 'none'
|
||||
mirror_label = Gtk.Label('<b>Pool Type</b>')
|
||||
mirror_label.set_use_markup(True)
|
||||
mirror_box = Gtk.ComboBoxText()
|
||||
mirror_box.append_text("single disk")
|
||||
mirror_box.append_text("2 disk mirror")
|
||||
mirror_box.append_text("3 disk raidz1")
|
||||
mirror_box.append_text("4 disk raidz2")
|
||||
mirror_box.append_text("5 disk raidz3")
|
||||
mirror_box.append_text("2+ disk stripe")
|
||||
mirror_box.connect('changed', self.mirror_selection)
|
||||
mirror_box.set_active(0)
|
||||
|
||||
# Pool Name
|
||||
self.zpool = False
|
||||
pool_check = Gtk.CheckButton('Pool Name')
|
||||
pool_check.connect("toggled", self.on_check_poll)
|
||||
self.pool = Gtk.Entry()
|
||||
self.pool.set_text('tank')
|
||||
self.pool.set_sensitive(False)
|
||||
# Creating MBR or GPT drive
|
||||
scheme_label = Gtk.Label('<b>Partition Scheme</b>')
|
||||
scheme_label.set_use_markup(True)
|
||||
# Adding a combo box to selecting MBR or GPT sheme.
|
||||
self.scheme = 'GPT'
|
||||
shemebox = Gtk.ComboBoxText()
|
||||
shemebox.append_text("GPT")
|
||||
shemebox.append_text("MBR")
|
||||
shemebox.connect('changed', self.sheme_selection)
|
||||
shemebox.set_active(0)
|
||||
if bios_or_uefi() == "UEFI":
|
||||
shemebox.set_sensitive(False)
|
||||
else:
|
||||
shemebox.set_sensitive(True)
|
||||
# Force 4k Sectors
|
||||
self.zfs_four_k = "True"
|
||||
zfs4kcheck = Gtk.CheckButton("Force ZFS 4k block size")
|
||||
zfs4kcheck.connect("toggled", self.on_check)
|
||||
zfs4kcheck.set_active(True)
|
||||
# Swap Size
|
||||
ram = Popen(memory, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT,
|
||||
universal_newlines=True, close_fds=True)
|
||||
mem = ram.stdout.read()
|
||||
swap = 512
|
||||
swp_size_label = Gtk.Label('<b>Swap Size(MB)</b>')
|
||||
swp_size_label.set_use_markup(True)
|
||||
self.swap_entry = Gtk.Entry()
|
||||
self.swap_entry.set_text(str(swap))
|
||||
self.swap_entry.connect('changed', self.digit_only)
|
||||
# Swap encription
|
||||
self.swap_encrypt = False
|
||||
self.swap_encrypt_check = Gtk.CheckButton("Encrypt Swap")
|
||||
self.swap_encrypt_check.connect("toggled", self.on_check_swap_encrypt)
|
||||
# Swap mirror
|
||||
self.swap_mirror = False
|
||||
swap_mirror_check = Gtk.CheckButton("Mirror Swap")
|
||||
swap_mirror_check.connect("toggled", self.on_check_swap_mirror)
|
||||
# GELI Disk encription
|
||||
self.disk_encript = False
|
||||
encrypt_check = Gtk.CheckButton("Encrypt Disk")
|
||||
encrypt_check.connect("toggled", self.on_check_encrypt)
|
||||
encrypt_check.set_sensitive(True)
|
||||
# password
|
||||
self.passwd_label = Gtk.Label("Password")
|
||||
self.password = Gtk.Entry()
|
||||
self.password.set_sensitive(False)
|
||||
self.password.set_visibility(False)
|
||||
self.password.connect("changed", self.passwdstrength)
|
||||
self.strenght_label = Gtk.Label()
|
||||
self.strenght_label.set_alignment(0.1, 0.5)
|
||||
self.vpasswd_label = Gtk.Label("Verify it")
|
||||
self.repassword = Gtk.Entry()
|
||||
self.repassword.set_sensitive(False)
|
||||
self.repassword.set_visibility(False)
|
||||
self.repassword.connect("changed", self.passwdVerification)
|
||||
# set image for password matching
|
||||
self.img = Gtk.Image()
|
||||
self.img.set_alignment(0.2, 0.5)
|
||||
# table = Gtk.Table(12, 12, True)
|
||||
grid = Gtk.Grid()
|
||||
grid.set_row_spacing(10)
|
||||
grid.set_margin_left(10)
|
||||
grid.set_margin_right(10)
|
||||
grid.set_margin_top(10)
|
||||
grid.set_margin_bottom(10)
|
||||
# grid.set_column_homogeneous(True)
|
||||
# grid.set_row_homogeneous(True)
|
||||
# grid.attach(Title, 1, 1, 10, 1)
|
||||
grid.attach(mirror_label, 1, 2, 1, 1)
|
||||
grid.attach(mirror_box, 2, 2, 1, 1)
|
||||
grid.attach(pool_check, 7, 2, 2, 1)
|
||||
grid.attach(self.pool, 9, 2, 2, 1)
|
||||
grid.attach(self.mirrorTips, 1, 3, 8, 1)
|
||||
grid.attach(zfs4kcheck, 9, 3, 2, 1)
|
||||
grid.attach(sw, 1, 4, 10, 3)
|
||||
grid.attach(scheme_label, 1, 9, 1, 1)
|
||||
grid.attach(shemebox, 2, 9, 1, 1)
|
||||
grid.attach(swp_size_label, 9, 9, 1, 1)
|
||||
grid.attach(self.swap_entry, 10, 9, 1, 1)
|
||||
# grid.attach(self.swap_encrypt_check, 9, 15, 11, 12)
|
||||
# grid.attach(swap_mirror_check, 9, 15, 11, 12)
|
||||
# grid.attach(encrypt_check, 2, 8, 2, 1)
|
||||
# grid.attach(self.passwd_label, 1, 9, 1, 1)
|
||||
# grid.attach(self.password, 2, 9, 2, 1)
|
||||
# grid.attach(self.strenght_label, 4, 9, 2, 1)
|
||||
# grid.attach(self.vpasswd_label, 1, 10, 1, 1)
|
||||
# grid.attach(self.repassword, 2, 10, 2, 1)
|
||||
# grid.attach(self.img, 4, 10, 2, 1)
|
||||
self.vbox1.pack_start(grid, True, True, 0)
|
||||
return
|
||||
|
||||
def get_model(self):
|
||||
return self.vbox1
|
||||
|
||||
def digit_only(self, *args):
|
||||
text = self.swap_entry.get_text().strip()
|
||||
self.swap_entry.set_text(''.join([i for i in text if i in '0123456789']))
|
||||
|
||||
def check_if_small_disk(self, size):
|
||||
if len(zfs_dsk_list) != 0:
|
||||
for line in zfs_dsk_list:
|
||||
if int(line.partition('-')[2]) > int(size):
|
||||
returns = True
|
||||
break
|
||||
else:
|
||||
returns = False
|
||||
else:
|
||||
returns = False
|
||||
return returns
|
||||
|
||||
def col1_toggled_cb(self, cell, path, model):
|
||||
model[path][3] = not model[path][3]
|
||||
if model[path][3] is False:
|
||||
zfs_dsk_list.remove(model[path][0] + "-" + model[path][1])
|
||||
if self.mirror == "single disk":
|
||||
if len(zfs_dsk_list) != 1:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(True)
|
||||
elif self.mirror == "2 disk mirror":
|
||||
if len(zfs_dsk_list) == 2:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "3 disk raidz1":
|
||||
if len(zfs_dsk_list) == 3:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "4 disk raidz2":
|
||||
if len(zfs_dsk_list) == 4:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "5 disk raidz3":
|
||||
if len(zfs_dsk_list) == 5:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "2+ disk stripe":
|
||||
if len(zfs_dsk_list) >= 2:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
if self.check_if_small_disk(model[path][1]) is False:
|
||||
zfs_dsk_list.extend([model[path][0] + "-" + model[path][1]])
|
||||
if self.mirror == "single disk":
|
||||
if len(zfs_dsk_list) != 1:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(True)
|
||||
elif self.mirror == "2 disk mirror":
|
||||
if len(zfs_dsk_list) == 2:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "3 disk raidz1":
|
||||
if len(zfs_dsk_list) == 3:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "4 disk raidz2":
|
||||
if len(zfs_dsk_list) == 4:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "5 disk raidz3":
|
||||
if len(zfs_dsk_list) == 5:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "2+ disk stripe":
|
||||
if len(zfs_dsk_list) >= 2:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.check_cell.set_sensitive(False)
|
||||
self.small_disk_warning()
|
||||
|
||||
print(zfs_dsk_list)
|
||||
return True
|
||||
|
||||
def small_disk_warning(self):
|
||||
window = Gtk.Window()
|
||||
window.set_title("Warning")
|
||||
window.set_border_width(0)
|
||||
# window.set_size_request(480, 200)
|
||||
window.set_icon_from_file(logo)
|
||||
box1 = Gtk.VBox(False, 0)
|
||||
window.add(box1)
|
||||
box1.show()
|
||||
box2 = Gtk.VBox(False, 10)
|
||||
box2.set_border_width(10)
|
||||
box1.pack_start(box2, True, True, 0)
|
||||
box2.show()
|
||||
warning_text = "Smallest disk need to be SELECTED first!\n"
|
||||
warning_text += "All the disk selected will reset."
|
||||
label = Gtk.Label(warning_text)
|
||||
# Add button
|
||||
box2.pack_start(label, True, True, 0)
|
||||
bbox = Gtk.HButtonBox()
|
||||
bbox.set_border_width(5)
|
||||
bbox.set_spacing(10)
|
||||
button = Gtk.Button(stock=Gtk.STOCK_OK)
|
||||
button.connect("clicked", self.resset_selection, window)
|
||||
bbox.add(button)
|
||||
box2.pack_end(bbox, True, True, 5)
|
||||
window.show_all()
|
||||
|
||||
def resset_selection(self, widget, window):
|
||||
global zfs_dsk_list
|
||||
zfs_dsk_list = []
|
||||
rows = len(self.store)
|
||||
for row in range(0, rows):
|
||||
self.store[row][3] = False
|
||||
row += 1
|
||||
self.check_cell.set_sensitive(True)
|
||||
window.hide()
|
||||
|
||||
def passwdstrength(self, widget):
|
||||
passwd = self.password.get_text()
|
||||
if len(passwd) <= 4:
|
||||
self.strenght_label.set_text("Super Weak")
|
||||
elif len(passwd) <= 8:
|
||||
if lowerCase(passwd) or upperCase(passwd) or passwd.isdigit():
|
||||
self.strenght_label.set_text("Super Weak")
|
||||
elif lowerandNunber(passwd):
|
||||
self.strenght_label.set_text("Very Weak")
|
||||
elif upperandNunber(passwd):
|
||||
self.strenght_label.set_text("Very Weak")
|
||||
elif lowerUpperCase(passwd):
|
||||
self.strenght_label.set_text("Very Weak")
|
||||
elif lowerUpperNumber(passwd):
|
||||
self.strenght_label.set_text("Fairly Weak")
|
||||
elif allCharacter(passwd):
|
||||
self.strenght_label.set_text("Weak")
|
||||
elif len(passwd) <= 12:
|
||||
if lowerCase(passwd) or upperCase(passwd) or passwd.isdigit():
|
||||
self.strenght_label.set_text("Very Weak")
|
||||
elif lowerandNunber(passwd):
|
||||
self.strenght_label.set_text("Fairly Weak")
|
||||
elif upperandNunber(passwd):
|
||||
self.strenght_label.set_text("Fairly Weak")
|
||||
elif lowerUpperCase(passwd):
|
||||
self.strenght_label.set_text("Fairly Weak")
|
||||
elif lowerUpperNumber(passwd):
|
||||
self.strenght_label.set_text("Weak")
|
||||
elif allCharacter(passwd):
|
||||
self.strenght_label.set_text("Strong")
|
||||
elif len(passwd) <= 16:
|
||||
if lowerCase(passwd) or upperCase(passwd) or passwd.isdigit():
|
||||
self.strenght_label.set_text("Fairly Weak")
|
||||
elif lowerandNunber(passwd):
|
||||
self.strenght_label.set_text("Weak")
|
||||
elif upperandNunber(passwd):
|
||||
self.strenght_label.set_text("Weak")
|
||||
elif lowerUpperCase(passwd):
|
||||
self.strenght_label.set_text("Weak")
|
||||
elif lowerUpperNumber(passwd):
|
||||
self.strenght_label.set_text("Strong")
|
||||
elif allCharacter(passwd):
|
||||
self.strenght_label.set_text("Fairly Strong")
|
||||
elif len(passwd) <= 20:
|
||||
if lowerCase(passwd) or upperCase(passwd) or passwd.isdigit():
|
||||
self.strenght_label.set_text("Weak")
|
||||
elif lowerandNunber(passwd):
|
||||
self.strenght_label.set_text("Strong")
|
||||
elif upperandNunber(passwd):
|
||||
self.strenght_label.set_text("Strong")
|
||||
elif lowerUpperCase(passwd):
|
||||
self.strenght_label.set_text("Strong")
|
||||
elif lowerUpperNumber(passwd):
|
||||
self.strenght_label.set_text("Fairly Strong")
|
||||
elif allCharacter(passwd):
|
||||
self.strenght_label.set_text("Very Strong")
|
||||
elif len(passwd) <= 24:
|
||||
if lowerCase(passwd) or upperCase(passwd) or passwd.isdigit():
|
||||
self.strenght_label.set_text("Strong")
|
||||
elif lowerandNunber(passwd):
|
||||
self.strenght_label.set_text("Fairly Strong")
|
||||
elif upperandNunber(passwd):
|
||||
self.strenght_label.set_text("Fairly Strong")
|
||||
elif lowerUpperCase(passwd):
|
||||
self.strenght_label.set_text("Fairly Strong")
|
||||
elif lowerUpperNumber(passwd):
|
||||
self.strenght_label.set_text("Very Strong")
|
||||
elif allCharacter(passwd):
|
||||
self.strenght_label.set_text("Super Strong")
|
||||
elif len(passwd) > 24:
|
||||
if lowerCase(passwd) or upperCase(passwd) or passwd.isdigit():
|
||||
self.strenght_label.set_text("Fairly Strong")
|
||||
else:
|
||||
self.strenght_label.set_text("Super Strong")
|
||||
|
||||
def passwdVerification(self, widget):
|
||||
if self.password.get_text() == self.repassword.get_text():
|
||||
self.img.set_from_stock(Gtk.STOCK_YES, 5)
|
||||
if self.mirror == "single disk":
|
||||
if len(zfs_dsk_list) != 1:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.button3.set_sensitive(True)
|
||||
elif self.mirror == "2 disk mirror":
|
||||
if len(zfs_dsk_list) == 2:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "3 disk raidz1":
|
||||
if len(zfs_dsk_list) == 3:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "4 disk raidz2":
|
||||
if len(zfs_dsk_list) == 4:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "5 disk raidz3":
|
||||
if len(zfs_dsk_list) == 5:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
elif self.mirror == "2+ disk stripe":
|
||||
if len(zfs_dsk_list) >= 2:
|
||||
self.button3.set_sensitive(True)
|
||||
else:
|
||||
self.button3.set_sensitive(False)
|
||||
else:
|
||||
self.img.set_from_stock(Gtk.STOCK_NO, 5)
|
||||
self.button3.set_sensitive(False)
|
||||